protected void btn_Find_Click(object sender, EventArgs e) { if (tb_Name.Text.Trim() == "" || tb_Number.Text.Trim() == "") { webclass.Show(this, "请填写完整信息"); } else { BLL.B_AdminInfo b_admin = new BLL.B_AdminInfo(); Model.AdminInfo model = new Model.AdminInfo(); try { model = b_admin.GetAdminInfo(tb_Name.Text, Convert.ToInt32(tb_Number.Text).ToString()); } catch (Exception err) { webclass.Show(this, err.Message); } if (model != null) { webclass.Show(this, "您的密码是:" + model.PWD); } else { webclass.Show(this, "未找到该管理员信息"); } } }
protected void btn_Change_Click(object sender, EventArgs e) { BLL.B_AdminInfo b_admin = new BLL.B_AdminInfo(); Model.AdminInfo ainfo = b_admin.GetAdminInfo((int)Session["UID"]); if (ainfo != null) { if (ainfo.PWD == tb_old.Text) { if (tb_p1.Text.Trim() == tb_p1.Text.Trim()) { bool result = b_admin.ChangePWD(tb_p1.Text.Trim(), (int)Session["UID"]); if (result == true) { webclass.Show(this, "修改成功"); } else { webclass.Show(this, "修改失败"); } } else { webclass.Show(this, "密码不一致"); } } else { webclass.Show(this, "密码错误"); } } else { webclass.Show(this, "用户信息不存在,请重新登陆"); } }
protected void btn_login_Click(object sender, EventArgs e) { #region 申请者登陆 if (rbl_UserType.SelectedIndex == 0) { if (tb_Name.Text.Trim() != "" && tb_Password.Text.Trim() != "") { BLL.B_UInfo b_uinfo = new BLL.B_UInfo(); int id = b_uinfo.login(tb_Name.Text.Trim(), tb_Password.Text.Trim()); if (id == -1)//姓名不存在 { webclass.Show(this, "用户不存在"); } else if (id == 0)//密码错误 { webclass.Show(this, "密码错误"); } else//登陆成功 { //创建Session Session["UID"] = id; Session["UTypes"] = 3; //跳转页面 Response.Redirect("./Pages/MainFrame.aspx"); } } } #endregion #region 管理员登陆 else { //管理员登陆 if (tb_Name.Text.Trim() != "" && tb_Password.Text.Trim() != "") { BLL.B_AdminInfo b_admin = new BLL.B_AdminInfo(); try { int[] idAndTypes = b_admin.login(tb_Name.Text, tb_Password.Text); if (idAndTypes[0] == -1)//姓名不存在 { webclass.Show(this, "用户不存在"); } else if (idAndTypes[0] == 0)//密码错误 { webclass.Show(this, "密码错误"); } else//登陆成功 { //创建Session Session["UID"] = idAndTypes[0]; Session["UTypes"] = idAndTypes[1]; Session["CommunityID"] = b_admin.GetAdminInfo(idAndTypes[0]).CommunityID;//创建所属社区ID的Session //跳转页面 Response.Redirect("./Pages/MainFrame.aspx"); //if (idAndTypes[1] == 0)//社区管理员 //{ // Response.Redirect("http://www.qq.com"); //} //else if (idAndTypes[1] == 1)//街道管理员 //{ //} //else//总管理员 //{ //} } } catch (Exception err) { webclass.Show(this, err.Message); } } } #endregion }