/// <summary> /// 获取数据库用户信息 /// </summary> private void GetUserInfo() { Info_User_BLL infoUserBll = new Info_User_BLL(); Info_User_Model infoUserModel = infoUserBll.GetModel(new Guid(UserID)); TextBox1.Text = infoUserModel.UserName; TextBox2.Text = infoUserModel.UserSex.ToString(); TextBox3.Text = infoUserModel.UserPhone; TextBox4.Text = infoUserModel.AccountNum; TextBox4.ReadOnly = true; TextBox5.Text = infoUserModel.Pwd; }
protected void Button1_OnClick(object sender, EventArgs e) { Info_User_BLL infoUserBll = new Info_User_BLL(); Info_User_Model infoUserModel = infoUserBll.GetModel(new Guid(UserID)); infoUserModel.UserName = TextBox1.Text; infoUserModel.UserSex = Convert.ToInt32(TextBox2.Text); infoUserModel.UserPhone = TextBox3.Text; infoUserModel.AccountNum = TextBox4.Text; infoUserModel.Pwd = TextBox5.Text; bool result = infoUserBll.Update(infoUserModel); if (result) { Response.Write("更新成功"); Response.Redirect("Login.aspx"); } else { Response.Write("更新失败,请联系管理员"); } }
protected void Button1_OnClick(object sender, EventArgs e) { string AccountNum = TextBox1.Text.Trim(); string Pwd = TextBox2.Text.Trim(); Info_User_BLL infoUserBll = new Info_User_BLL(); /* * // 是否登录 * List<Info_User_Model> ds = * infoUserBll.GetModelList("AccountNum='" + AccountNum + "' and Pwd='" + Pwd + "'"); * if (ds.Count > 0) * { * Info_User_Model infoUserModel = ds.FirstOrDefault(); * Response.Write("<div class='alert alert-success' role='alert'>登录成功</div>"); * CookieHelper.SetCookie("UserID", infoUserModel.UserID.ToString(), DateTime.Now.AddMinutes(10)); * Response.Redirect("LogList.aspx?AccountNum=" + AccountNum + "&UserID=" + infoUserModel.UserID); * } * else * { * Response.Write("<div class='alert alert-danger' role='alert'>登录失败</div>"); * } */ // 自定义登录 Info_User_Model infoUserModel = infoUserBll.GetModel(AccountNum, Pwd); if (infoUserModel != null) { Response.Write("<div class='alert alert-success' role='alert'>登录成功</div>"); CookieHelper.SetCookie("UserID", infoUserModel.UserID.ToString(), DateTime.Now.AddMinutes(10)); Response.Redirect("LogList.aspx?AccountNum=" + AccountNum + "&UserID=" + infoUserModel.UserID); } else { Response.Write("<div class='alert alert-danger' role='alert'>登录失败</div>"); } }