protected void btnSave_Click(object sender, EventArgs e) { DtCms.BLL.Admin bll = new DtCms.BLL.Admin(); DtCms.Model.Admin model = bll.GetModel(this.Id); string UserPwd = txtUserPwd.Text.Trim(); string UserLevel = string.Empty; int UserType = Convert.ToInt32(rblUserType.SelectedValue); if (UserType > 1) { UserLevel = "," + Request.Form["cbLevel"].Trim() + ","; } if (UserPwd != null && UserPwd != "") { model.UserPwd = DtCms.Common.DESEncrypt.Encrypt(UserPwd); } model.ReadName = txtReadName.Text.Trim(); model.UserEmail = txtUserEmail.Text.Trim(); model.UserType = UserType; model.IsLock = Convert.ToInt32(rblIsLock.SelectedValue); model.UserLevel = UserLevel; bll.Update(model); JscriptPrint("管理员修改成功啦!", "List.aspx", "Success"); }
//赋值操作 private void ShowInfo(int editID) { DtCms.BLL.Admin bll = new DtCms.BLL.Admin(); DtCms.Model.Admin model = new DtCms.Model.Admin(); model = bll.GetModel(editID); txtUserName.Text = model.UserName; if (model.IsLock == 1) { this.rblIsLock.Items[1].Selected = true; } else { this.rblIsLock.Items[0].Selected = true; } txtReadName.Text = model.ReadName; txtUserEmail.Text = model.UserEmail; this.strLevel = model.UserLevel; this.strType = model.UserType; if (model.UserType == 1) { this.rblUserType.Items[0].Selected = true; } if (model.UserType == 2) { this.rblUserType.Items[1].Selected = true; } if (model.UserType == 3) { this.rblUserType.Items[2].Selected = true; } }
protected void loginsubmit_Click(object sender, ImageClickEventArgs e) { string UserName = txtUserName.Text.Trim(); string UserPwd = txtUserPwd.Text.Trim(); if (UserName.Equals("") || UserPwd.Equals("")) { lbMsg.Text = "请输入您要登录用户名或密码"; } else { if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 3) { lbMsg.Text = "登录错误超过3次,请关闭浏览器重新登录。"; } else if (bll.chkAdminLogin(UserName, UserPwd)) { DtCms.Model.Admin model = new DtCms.Model.Admin(); model = bll.GetModel(UserName); Session["AdminNo"] = model.Id; Session["AdminName"] = model.UserName; Session["AdminType"] = model.UserType; Session["AdminLevel"] = model.UserLevel; //设置超时时间 Session.Timeout = 45; Session["AdminLoginSun"] = null; //Syscms.Model.websetModel webset = new Syscms.Bll.webSetBll().loadConfig(Server.MapPath(ConfigurationManager.AppSettings["Configpath"].ToString())); //Syscms.Common.FsLog.SaveLogs(webset.weblogPath, model.UserName, "登录"); Response.Redirect("admin_index.aspx"); } else { lbMsg.Text = "您输入的用户名或密码不正确"; } } }