/// <summary> /// 提交用户登陆信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Submit_ServerClick(object sender, EventArgs e) { string verfiy = Request.Form["verify"]; //string username = Request.Form["username"].Trim(); //string password = Request.Form["password"].Trim(); string username = "******"; string password = "******"; // 判断验证码是否正确 if (Session["CheckCode"] != null) { //if (Session["CheckCode"].ToString() != verfiy) if (false) { this.Response.Write(BaseSystem.ShowWindow("对不起,你输入的验证码不正确!!", "Login.aspx?hr=" + hospitialRegion + "&&hn=" + this.Hospitial.Text)); } else { // 判断用户名或密码是否正确 if (!SiteManagement.IsLogon(username, password, this.Hospitial.Text)) { this.Response.Write(BaseSystem.ShowWindow("对不起,你输入的用户名或密码不正确!!", "Login.aspx?hr=" + hospitialRegion + "&&hn=" + this.Hospitial.Text)); } else { string message = string.Empty; SiteUser siteUser = SiteManagement.GetUser(username, ref message); if (siteUser.Role.RoleID == 3) { Session["user"] = siteUser; this.Response.Redirect("default3.aspx?hr=" + hospitialRegion); } else if (siteUser.Role.RoleID == 2) { Session["admin"] = siteUser; this.Response.Redirect(@"Admin\Admin.aspx"); } else if (siteUser.Role.RoleID == 1) { Session["sa"] = siteUser; this.Response.Redirect(@"Admin\SuperAdmin.aspx"); } else { this.Response.Write(BaseSystem.ShowWindow("对不起,您不是管理员,您不能登录此系统!!")); } } } } else { this.Response.Write(BaseSystem.ShowWindow("对不起,验证码已超时失效,为了保障您的网站后台的安全,请重新登录!!", "login.aspx")); this.Response.Redirect("Login.aspx"); } }
/// <summary> /// 显示用户名 /// </summary> /// <param name="userID">用户ID</param> /// <returns>用户名</returns> public string ShowUserName(string userID) { string message = null; if (SiteManagement.GetUser(int.Parse(userID), ref message) != null) { return(SiteManagement.GetUser(int.Parse(userID), ref message).UserName); } else { return(null); } }
/// <summary> /// 页面加载 /// </summary> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string id = this.Request.QueryString["ID"]; int userID = 0; if (!string.IsNullOrEmpty(id)) { bool isSucess = int.TryParse(id, out userID); } string message = string.Empty; userNormal = SiteManagement.GetUser(userID, ref message); if (userNormal != null) { userName = userNormal.UserName; } } }
protected void Submit1_ServerClick(object sender, EventArgs e) { string verfiy = Request.Form["verify"]; string username = Request.Form["username"].Trim(); string password = Request.Form["password"].Trim(); //string username = "******"; //string password = "******"; // 判断验证码是否正确 if (Session["CheckCode"] != null) { if (!SiteManagement.IsLogon(username, password)) { this.Response.Write(BaseSystem.ShowWindow("对不起,你输入的用户名或密码不正确!!", "login.aspx")); } else { string message = string.Empty; SiteUser siteUser = SiteManagement.GetUser(username, ref message); if (siteUser.Role.RoleID == 2) { Session["admin"] = siteUser; this.Response.Redirect("Default.aspx"); } else if (siteUser.Role.RoleID == 1) { Session["sa"] = siteUser; this.Response.Redirect("SuperAdmin.aspx"); } else { this.Response.Write(BaseSystem.ShowWindow("对不起,您不是管理员,您不能登录此系统!!")); } } } else { this.Response.Write(BaseSystem.ShowWindow("对不起,验证码已超时失效,为了保障您的网站后台的安全,请重新登录!!", "login.aspx")); this.Response.Redirect("Login.aspx"); } }