Introduction: When the summer vacation arrives, the school's canteen is basically closed, and the food made in the rest of the window is really hard to eat, so we carried forward the spirit of self-help, full-fledged food, I decided to cook in the dormitory with GF (it cannot be discovered by the building manager; otherwise it will be criticized and depressed ). Then GF proposed to write down the daily expenses and see how much it will save in the end. Now that you want to keep an account, you need to have an accounting software. I searched the internet and found a software called Xianglong family account book (or free version, like one, basically, it can meet our needs (we can record revenue and expenditure by day, develop categories, calculate statistics, retrieve qualified accounts, and also provide user management and database backup functions ). However, I have always had a habit of developing some daily software on my own and expressing my ideas in software. Now I am learning C #, and I decided to use C # to develop one. (The theme is finally rolled around in the seven turns and eight turns)
The basic functions are similar to those of the above software. Let's talk about my thoughts:
1,View daily accounts using the tree control, Divided into three levels: year, month, and day. When you click the day node, you can view the detailed account (what you bought and how much you spent) of the day. When you click the month node, you can only view the daily expenses of the month, not Displayed in detail. The effect is similar to that of the year.Use the DataGrid to display records.
2. I think of two ways to store data,One is to use access for storage.In this way, you can use ADO. Net to perform simple operations (Q: Does sqlhelper support access ?), The following is an example of Database Modeling:
Create a table, account, which contains the following fields:
year |
month |
day |
type |
expenditure items / TD> |
expenditure amount / TD> |
This design is mainly because of its own level of food, so I chose a model with the least brains. Although this method is redundant, there is a multi-value dependency on the year, month, and day, and the statistical value is not listed in a single column (so you do not need to perform the sum operation every time you view the account ). However, I don't think it will affect performance much when there are few records, so I am too lazy. Let's just list the statistical values. The year, month, and day must all have their own statistical values. Every time you modify an account, it involves modifying four tables, which is quite troublesome.
In addition, XML is used.In my opinion, this is also the best way, because it is originally intended to express a tree object, using it to store can reduce a lot of redundancy, dom can be used to load the entire memory at a time (I don't think there will be more than kb even if there are thousands of records), but the Statistical Computation is troublesome, find them one by one using XPath.
The current idea is to use access first, and then use XML to implement one. Two methods are used to implement one interface and one factory mode. (For another question, you can use the DataGrid to load databases and XML files)
3. Call the calendar control when adding accounts to obtain the date selected by the user. When verifying user input, I only restrict the amount input (using a regular expression). The classification is selected after the user is created.
4. Using an INI file to record the account Node Selected last time has other preferences.
Because it was the first C # project, I did not dare to make it too complicated (search by condition, database backup, and user management). I would like to make the earliest version first. I am preparing for the postgraduate entrance exam. I don't have time to do it. I will go home at the end of the month and start to get the first version within a week or two, reserved APIs.
Even the level is definitely a beginner, and the idea is very good. Don't laugh. You are welcome to discuss more.