Use Asp.net MVC + LINQ + mvc_scaffold_gen_setup.exe to generate a complete three-step household account manager Program

Source: Internet
Author: User
Tags actionlink
[Preface] last month, I submitted two articles in the same series Article :
Use Asp.net MVC + LINQ + mvc_scaffold_gen_setup.exe to generate a complete big housekeeping Program ("one ")
Use Asp.net MVC + LINQ + mvc_scaffold_gen_setup.exe to generate a complete big housekeeping Program ("2" for short ")
After three weeks, I can record my experiences. At this time, I am always the most happy. It is a sense of harvest, not something else. I would like to take this opportunity to manage my thoughts, find yourself a reason not to play games ......
The three weeks have been very unusual. I have to go to work during the day. It's hard to open it when I come back at night. Program I am not familiar with writing and writing, and I am not familiar with it. I am very slow in development and have little information. During the weekend, I was busy watching the rocket games, and I slept late. My classmates asked me to go out to karaoke, and I had to think about the reason why I couldn't do it. Last weekend, the Department organized a tour to Yangzhou. After eating dried silk and the lion's head, Yangzhou Fried Rice was also indispensable. I had a good time playing with the thin West Lake and Heyuan, and I was quite relaxed with my colleagues, it's no pleasure to play cards and kill games together on the bus. Rather than playing, it is better to improve the feeling between colleagues. Unfortunately, Yangzhou students in the same dormitory of the University lost contact and did not see the previous one. I wish him all the best! By the way, I remember Dudu was from Yangzhou. On that night in Yangzhou, I went to the internet cafe. When I opened my blog, I really thought of Dudu ......
Speaking of work, I have been busy upgrading the project over the past few days. upgrading from net1.1 to 2.0 is very annoying and helpless, with no experience, slow progress, many errors, and hard changes. Next time, I will share my experience with you.
Go to the topic.
[Body]
I remember that at the end of "2", I left three Problem :
Questions left behind

1) The server control reapter used on the page must be declared in codefile; otherwise it cannot be identified. Why? All server controls must be declared. I didn't see an example above. What is going on? Please help me find the reason.
[Answer later than 2008.04.17] Right-click the solution --> convert to web applications to convert the solution into a web application. This convert actually adds the corresponding test. Designer. CS file to each page (such as test. aspx), and then stores the declaration of the control on the page. In fact, this answer should have been thought of for a long time. Instead, I forgot the fundamental web application file structure.
2) on the page before modification Code The foreach statement in can use <% = html. actionlink ("edit", "edit", new {id = item. childclassid}) %> to put an edit link directly. The link address is childclass/edit /[Childclassid ],
Now the problem is, after I use the reapter control to directly bind the data source, how can I perform a similar operation <% = html. actionlink ("edit", "edit", new {id = item. childclassid}) %> is this method used to directly generate an edit link? The doubt is that [ Childclassid ] Upload <% = Html. actionlink ("edit", "edit ",......) %> "...... .
Solution: replace item. childclassid with new {id = eval ("childclassid ")}.
3) 2008.04.17 add one question : When childclass information is displayed, since model. childclassinfo only has the primaryclassid attribute, how does one display the primaryclassname corresponding to primaryclassid? Add the primaryclassname attribute in model. childclassinfo ?? Or in controllers? Supplement: This is actually a category of class design, and has little to do with MVC.

Problem 1 has been solved, convert to Web applications.
Problem 2 has been solved. Use new {id = eval ("childclassid")} to replace item. childclassid.
Problem 3 has been resolved. For details, referThe download demo is provided at the end of this article.The code in the "model/classviewdata. cs" file in the file, and the complex entity classes using list, new, and edit are constructed independently.

[Function Introduction]
The following describes the functions of this released program:
All functions (see "business introduction" in "2") can be used, and expenditures, income, and lending are easy to understand.
Transfers are transferred between two accounts, which is easy to understand. I forgot to add the amount field to my account. For more information, seeThis provides the latest database script for download.Added two fields.
Nothing else. I just manually added a LINQ expression to obtain the subclass of "income" and the subclass of "expenditure, because the code generated by LINQ to classes does not provide similar functions.
You can pay attention to model/classviewdata. basically, the edit, list, and new functions in Cs are directly associated with these entity classes. It can be called Vo. I don't know whether the concept is correct or not.
In addition, as for the delete operations in the program, we should ignore whether the business is correct or reasonable. For convenience, let alone. In fact, I would like to add a field isvalid. The delete operation only changes the isvalid of this field to 0. However, I am too lazy to change it... and there is almost no function in the program to verify the data validity.

[summary]
I first listed the functions of this book program and created a database, but it is still a bit missing. I added two fields in the middle, it can only be said that the requirements are not clear. Every time you modify the database, it is very troublesome and extremely undesirable. In particular, you need to re-Add the dbml file by using the class of LINQ to classes to generate the ORM code. Also, I used to name every entity class "[database name] Info". However, every time dbml is generated, the model class is changed. Fortunately, the reconstruction function of VS is available, modify n places, and N is equal to the number of data tables ......
[Conclusion]
I don't know what to write anymore. I have been sleepy recently and have yawned constantly. If I don't talk about it, I will upload it to the program and script. If you have any questions, you can reply below. I will try my best to answer them. I hope you can give more comments. On the one hand, you can learn about MVC, and on the other hand, you can develop better for this family book. By the way, I plan to add similar functions such as "Financial Planning" to it.
[data download]
latest program download: accountbook0506_newest.rar
latest database script download: accountbookdb0506_newest.rar
, it is not deleted yet .)
[Information Feedback]
......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.