Simple web layer-3 architecture system (fifth edition) and web layer-3 (Fifth Edition)

Source: Internet
Author: User

Simple web layer-3 architecture system (fifth edition) and web layer-3 (Fifth Edition)

Next to the previous version, the three-tier architecture background code is almost finished today. After this version is completed, the front-end code is created. The front-end is not familiar and is still learning in depth. After a while, I wrote the background code.

 

The three-layer architecture includes the DAL layer, BLL layer, and UI Layer (that is, the web layer). The previous versions focus on the DAL layer, that is, writing data access layer code. In fact, The BLL Layer Code is easy to compile. To use it flexibly, you still need some algorithm basics. The BLL business logic layer mainly handles logic, this layer does not involve much and does not need to write the code in the database. Because the code has been completed in the DAL layer, you only need to define and use it in BLL.

 

Some code in hiBLL below:

1 using System; 2 using System. collections. generic; 3 using System. linq; 4 using System. text; 5 using System. threading. tasks; 6 7 using System. data; 8 using System. data. sqlClient; 9 using DAL; 10 using Model; 11 12 namespace BLL13 {14 public class personMG15 {16 personDAO pd = null; 17 18 public personMG () 19 {20 pd = new personDAO (); 21} 22 23 // <summary> 24 // Add employee information 25 // </summary> 26 // <param name = "name"> employee name </param> 27 // <param name = "sex"> gender of the employee to be added </param> 28 /// <param name = "salary"> Yes the added employee's salary </param> 29 // <returns> returns the true value: if it is true, it is successfully added. If it is false, adding failed </returns> 30 public bool insert (person p) 31 {32 return pd. insert (p ); 33} 34 35 // <summary> 36 // Delete employee information 37 // </summary> 38 // <param name = "id"> Delete employee </param> 39 // <returns> returns the true value: if it is true, the deletion is successful. If it is false, the deletion fails. </returns> 40 public bool delete (person p) 41 {42 return pd. delete (p ); 43} 44 45 // <summary> 46 // change employee information 47 // </summary> 48 // <param name = "id"> employee ID </param> 49 // <param name = "name"> name of the employee to be changed </param> 50 /// <param name = "sex"> Yes change employee gender </param> 51 // <param name = "salary"> the employee's salary to be changed </param> 52 // <returns> returns the true value: if the change is true, the change is successful. If the change is false, the change fails. </returns> 53 public bool update (person p) 54 {55 return pd. update (p ); 56} 57 58 // <summary> 59 // judge whether the employee name is repeated 60 // </summary> 61 // <param name = "name"> Yes the name of the employee to be judged </param> 62 // <returns> returns the true value: if it is true, it indicates duplicate. If it is false, add </returns> 63 public bool repeat (person p) 64 {65 return pd. repeat (p); 66} 67} 68}

 

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.