private void BindData(string username) { MembershipUser user = Membership.GetUser(username, false); if (user != null) { lb_Username.Text = user.UserName; Org_Staff staff = UserBLL.GetStaffByUsername(user.UserName); if (staff != null) { select_Staff.SelectText = staff.RealName; select_Staff.SelectValue = staff.ID.ToString(); } else { CM_Client client = new CM_ClientBLL(UserBLL.GetClientIDByUsername(user.UserName)).Model; if (client != null) { //商业客户 select_Client.SelectValue = client.ID.ToString(); select_Client.SelectText = client.FullName; } else { //导购 MCSFramework.Model.Promotor.PM_Promotor p = new MCSFramework.BLL.Promotor.PM_PromotorBLL(UserBLL.GetPromotorIDByUsername(user.UserName)).Model; if (p != null) { select_Promotor.SelectValue = p.ID.ToString(); select_Promotor.SelectText = p.Name; } } } tbx_Email.Text = user.Email; bt_Unlock.Visible = user.IsLockedOut; bt_UnApprove.Visible = user.IsApproved; bt_Approve.Visible = !user.IsApproved; BindUserInRole(); BindGrid(); } else { MessageBox.ShowAndRedirect(this, "用户名不存在!", "UserList.aspx"); } }
protected void Login1_LoggedIn(object sender, EventArgs e) { int staffid = UserBLL.LoginSuccess(Login1.UserName, Session.SessionID, Request.UserHostAddress, ViewState["MacAddr"].ToString()); if (staffid > 0) { //Ա����¼ Org_Staff staff = new Org_StaffBLL(staffid).Model; if (staff != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = staffid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = staff.RealName; Session["ActiveModule"] = 0; Session["AccountType"] = 1; //�˻����� 1��Ա����2����ҵ�ͻ� 3:���� Session["ClientType"] = 0; Session["OrganizeCity"] = staff.OrganizeCity; } else Response.Redirect("index.aspx"); } else { int clientid = UserBLL.GetClientIDByUsername(Login1.UserName); if (clientid > 0) { //��ҵ�ͻ���¼ MCSFramework.BLL.CM.CM_ClientBLL _c = new MCSFramework.BLL.CM.CM_ClientBLL(clientid); if (_c.Model != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = clientid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = _c.Model.FullName; Session["ActiveModule"] = 0; Session["AccountType"] = 2; //�˻����� 1��Ա����2����ҵ�ͻ� 3:���� Session["ClientType"] = _c.Model != null ? _c.Model.ClientType : 0; //��ҵ�ͻ���� Session["OrganizeCity"] = _c.Model.OrganizeCity; } else Response.Redirect("index.aspx"); } else { int promotorid = UserBLL.GetPromotorIDByUsername(Login1.UserName); if (promotorid > 0) { //������¼ MCSFramework.BLL.Promotor.PM_PromotorBLL _p = new MCSFramework.BLL.Promotor.PM_PromotorBLL(promotorid); if (_p.Model != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = clientid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = _p.Model.Name; Session["ActiveModule"] = 0; Session["AccountType"] = 3; //�˻����� 1��Ա����2����ҵ�ͻ� 3:���� Session["OrganizeCity"] = _p.Model.OrganizeCity; } else Response.Redirect("index.aspx"); } } } Response.Cookies["User"].Value = Server.UrlEncode(Login1.UserName); Response.Cookies["User"].Expires = new DateTime(2101, 1, 1); //ȥ���û�Ȩ���� string CacheKey = "Right-AssignedRightList-" + Login1.UserName; DataCache.RemoveCache(CacheKey); }
protected void Login1_LoggedIn(object sender, EventArgs e) { int staffid = UserBLL.LoginSuccess(Login1.UserName, Session.SessionID, Request.UserHostAddress, ViewState["MacAddr"].ToString()); if (staffid > 0) { //员工登录 Org_Staff staff = new Org_StaffBLL(staffid).Model; if (staff != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = staffid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = staff.RealName; Session["ActiveModule"] = 0; Session["AccountType"] = 1; //账户类型 1:员工,2:商业客户 3:导购 Session["ClientType"] = 0; Session["OrganizeCity"] = staff.OrganizeCity; } else { Response.Redirect("index.aspx"); } } else { int clientid = UserBLL.GetClientIDByUsername(Login1.UserName); if (clientid > 0) { //商业客户登录 MCSFramework.BLL.CM.CM_ClientBLL _c = new MCSFramework.BLL.CM.CM_ClientBLL(clientid); if (_c.Model != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = clientid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = _c.Model.FullName; Session["ActiveModule"] = 0; Session["AccountType"] = 2; //账户类型 1:员工,2:商业客户 3:导购 Session["ClientType"] = _c.Model != null ? _c.Model.ClientType : 0; //商业客户类别 Session["OrganizeCity"] = _c.Model.OrganizeCity; } else { Response.Redirect("index.aspx"); } } else { int promotorid = UserBLL.GetPromotorIDByUsername(Login1.UserName); if (promotorid > 0) { //导购登录 MCSFramework.BLL.Promotor.PM_PromotorBLL _p = new MCSFramework.BLL.Promotor.PM_PromotorBLL(promotorid); if (_p.Model != null) { Session["aspnetUserId"] = new Guid(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString()); Session["UserID"] = clientid; Session["UserName"] = Login1.UserName; Session["UserRealName"] = _p.Model.Name; Session["ActiveModule"] = 0; Session["AccountType"] = 3; //账户类型 1:员工,2:商业客户 3:导购 Session["OrganizeCity"] = _p.Model.OrganizeCity; } else { Response.Redirect("index.aspx"); } } } } Response.Cookies["User"].Value = Server.UrlEncode(Login1.UserName); Response.Cookies["User"].Expires = new DateTime(2101, 1, 1); //去除用户权限缓存 string CacheKey = "Right-AssignedRightList-" + Login1.UserName; DataCache.RemoveCache(CacheKey); }