示例#1
0
        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);
        }
示例#2
0
        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);
        }