After a version, today is almost three-layer architecture behind the end of the code, this version is finished, the next is the foreground of the production, the front desk is not familiar with, still in-depth study. After a while to write, today first write the background code.
The three-tier architecture includes the DAL layer, the BLL layer, the UI layer (the Web layer), and the first few editions focus on the DAL, which is the writing of the data Access layer code. In fact, the code in the BLL layer is easy to write, really flexible to use, or need some algorithmic aspects of the base, the BLL business logic layer, mainly dealing with the logic of things, this layer does not involve and do not need to write the code in the database, because in the DAL layer has been written to complete, You only need to define it in the BLL.
Some of the code in the following HIBLL:
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingSystem.Text;5 usingSystem.Threading.Tasks;6 7 usingSystem.Data;8 usingSystem.Data.SqlClient;9 usingDAL;Ten usingModel; One A namespaceBLL - { - Public classPERSONMG the { -Persondao PD =NULL; - - Publicpersonmg () + { -PD =NewPersondao (); + } A at /// <summary> - ///Increase Employee Information - /// </summary> - /// <param name= "name" >name of employee to add</param> - /// <param name= "Sex" >the gender of the employee to be added</param> - /// <param name= "Salary" >Employee pay to add</param> in /// <returns>return True or False value: if it is true, add success if it is false display add failed</returns> - Public BOOLInsert (person p) to { + returnPd.insert (p); - } the * /// <summary> $ ///Delete Employee InformationPanax Notoginseng /// </summary> - /// <param name= "id" >to delete an employee's ID</param> the /// <returns>return True or False value: If the deletion is true, the deletion is unsuccessful if it is a fake display</returns> + Public BOOLDelete (person p) A { the returnPd.delete (p); + } - $ /// <summary> $ ///Change Employee Information - /// </summary> - /// <param name= "id" >employee number to change</param> the /// <param name= "name" >name of employee to change</param> - /// <param name= "Sex" >the gender of the employee to change</param>Wuyi /// <param name= "Salary" >employee's salary to be changed</param> the /// <returns>returns TRUE or false: If the change is true, the change is False if the display changes are unsuccessful</returns> - Public BOOLUpdate (person p) Wu { - returnpd.update (p); About } $ - /// <summary> - ///determine if employee names are duplicated - /// </summary> A /// <param name= "name" >name of employee to be judged</param> + /// <returns>returns the True and False value: if it is really a duplicate, if it is false to add</returns> the Public BOOLRepeat (person p) - { $ returnpd.repeat (p); the } the } the}
Simple Web three-tier architecture system "Fifth Edition"