using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls Using system.Web.ui.htmlcontrols;
Namespace Objlogin.quicklyBuildModel {/// /// LogINQUICKLYMODEL's summary description. (Last updated Preprints 6.28) /// summary> public class LoginQuicklyModel: System.Web.UI.Page {protected System.Web.UI.WebControls.Label Label1; protected System.Web.UI.WebControls.Label Label2; protected System.Web.UI.WebControls.TextBox tbUserName; protected System.Web.UI.WebControls.TextBox tbPassword; protected System.Web.UI.WebControls.Button btnLogin; protected System.Web.UI.WebControls.RequiredFieldValidator ValidatorToPassword; protected System. Web.ui.WebControls.RequidFieldValidator ValidatorTouserName; /// /// User object /// summary> private user; private void page_load (Object sender, system.eventargs e) {// Place here User code to initialize page}
#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} /// /// Designer Supports the required method - Do not use the code editor to modify the // / this method. /// summary> private () {this.btnlogin.click = new system.eventhandler (this.btnlogin_click; this.load = new system.eventhandler (this.page_load);
} #Endregion
Private void btnlogin_click (object sender, system.eventargs e) {this.user = new user (this.tbusername.text); if (this.user.checkloginok (true) // if (this. User.checkloginok (false) {
WriteToseession (); // Apply this.user.initsession (); implement response.redirect ("detail.aspx");} else showloginfailMessage ();} /// /// Write user information Session /// summary> private void writetosesis () {session ["username"] = this.user.username; session ["userrank"] = 1;}
/// /// Display login failed information /// summary> private void showloginfailMessage () {response.write (this.user.getcheckloginfailMessage ());}}}