Explain the login function and member management function in the dining item
--------------------------------------------------------------------------------------------
Three-tier project: Relational data C # class data table name Class name field encapsulated into attribute three layer each function separate login window point login-"Call the BLL Method-" Call DAL Method-"Database Database-" dal-"bll-" ui- --------------------------------------------------------------------------------------------Singleton mode:
//private static readonly memberform Mf =new memberform (); public static Memberform Getmemberform ()//{//return Mf; } private static memberform _instance; public static Memberform Instance {get {if (_instance = = NULL | | _instance. isdisposed) {_instance = new memberform (); } return _instance;}} Private Memberform () {InitializeComponent ();}
Show only once, Singleton mode private static membereditform _instance; Show only once, Singleton mode private static membereditform _instance; <summary>// /ture to modify false for new// </summary> private static bool _isedit; Ture Modify false new//<summary>/////</summary>// <param name= "Isedit" > Whether to modify </param>// <param name= "Member" > Modified objects </param>/// <returns></ returns> public static Membereditform single (bool isedit, Member Member) { if (_instance = = NULL || _instance. isdisposed) { _instance = new membereditform (member); } _isedit = isedit; return _instance;}
Random number
1. Generate random number r=new random (); int num = R.next (+ +); String strdate = DateTime.Now.ToString ("Yyyymmddhhmmss"); Txtnum.text = strdate + num;
Load list:
MEMBERTYPEBLL BLL = new membertypebll (); list<membertype> list = BLL. Getmembertypes (false); List. Insert (0,new membertype () {Name = "Please select", Id =-1}); Cmbtype.datasource = list; Cmbtype.displaymember = "Name"; Displayed value cmbtype.valuemember = "Id";//Saved value
Pop-up or close the window after the prompt window is finished
Msgmd.msgdivshow ("Login succeeded. ", 1, Bind); ..... private void Bind () { dialogresult=DialogResult.OK; This. Cclose (); }
relational data is converted to object data, and special values are processed (null,<=0, etc.)
Write generic SQL statements as much as possible (do not have special functions in the statement, because the functions of each version function differently)
such as Peng Network: http://www.rupeng.com
such as Peng Network. NET three-tier architecture chapter II Login and Membership management