protected void Button1_Click(object sender, EventArgs e) { yinxiang.BLL.k3_2Operator bll = new yinxiang.BLL.k3_2Operator(); string user_name = this.txtUsername.Value.Trim(); string user_pwd = this.txtPass.Value.Trim(); Boolean loginFlag; loginFlag = bll.Exists_new(user_name, user_pwd); if (loginFlag == true) { User user = new User(); user.Name = user_name; user.PassWord = user_pwd; Session["user"] = user; Session["username"] = user_name; Session["password"] = user_pwd; Response.Redirect("MainPage.aspx", false); } else { this.lblMsg.Text = "登录失败!"; } }
private void ShowInfo(int UserID) { yinxiang.BLL.k3_2Operator bll = new yinxiang.BLL.k3_2Operator(); yinxiang.Model.k3_2Operator model = bll.GetModel(UserID); this.lblUserID.Text = model.UserID.ToString(); this.lblOperatorName.Text = model.OperatorName; this.txtPassWord.Text = model.PassWord; this.txtIsAdmin.Text = model.IsAdmin; this.txtNote.Text = model.Note; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtOperatorName.Text.Trim().Length == 0) { strErr += "OperatorName不能为空!\\n"; } if (this.txtPassWord.Text.Trim().Length == 0) { strErr += "PassWord不能为空!\\n"; } if (this.txtIsAdmin.Text.Trim().Length == 0) { strErr += "IsAdmin不能为空!\\n"; } if (this.txtNote.Text.Trim().Length == 0) { strErr += "Note不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string OperatorName = this.txtOperatorName.Text; string PassWord = this.txtPassWord.Text; string IsAdmin = this.txtIsAdmin.Text; string Note = this.txtNote.Text; yinxiang.Model.k3_2Operator model = new yinxiang.Model.k3_2Operator(); model.OperatorName = OperatorName; model.PassWord = PassWord; model.IsAdmin = IsAdmin; model.Note = Note; yinxiang.BLL.k3_2Operator bll = new yinxiang.BLL.k3_2Operator(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }