/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string userName = this.Login1.UserName; string pwd = this.Login1.Password; // admin login // if (userName == "admin") { if (pwd == "admin") { WaterUserLevel level = WaterUserLevelFactory.CreateWaterLevel(WaterUserLevelEnum.Ju); //SessionManager.WaterUserSession.WaterUser = WaterUserFactory.CreateWaterUser(level); SessionManager.LoginSession.WaterUser = WaterUserFactory.CreateWaterUser(level); e.Authenticated = true; } return; } int userID, waterUserID; bool b = UserDBI.CanLogin(userName, pwd, out userID, out waterUserID); if (b) { LoginSession ls = SessionManager.LoginSession; ls.LoginUserName = userName; ls.LoginUserID = userID; ls.WaterUser = WaterUserFactory.CreateWaterUserByID(waterUserID); ls.User = UserClass.CreateUser(userID); } e.Authenticated = b; Trace.Warn("authenticate : " + b.ToString()); }
/// <summary> /// /// </summary> private void Bind() { DataTable tbl = UserDBI.GetUserDataTable(); //this.GridView1.DataSource = tbl; //this.GridView1.DataBind(); H.DataSource = tbl; H.Bind(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataKey dk = this.GridView1.DataKeys[e.RowIndex]; int userid = Convert.ToInt32(dk.Value); UserDBI.DeleteUser(userid); Bind(); }