protected void Page_Load(object sender, EventArgs e)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            //如果当前用户未登陆,先获取授权
            if (user == null)
            {
                WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
                if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
                {//授权成功
                    WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                    if (wuser == null || string.IsNullOrEmpty(wuser.GwyUserName))
                    {//账号未关联,跳转至登录界面
                        System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=MyDeclareList");
                    }
                    else if (wuser.IsCustomer != 1 && wuser.IsCompany != 1)
                    {//不是企业或委托单位,无此权限
                        System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
                    }
                    else
                    {//不需登录,保存当前用户
                        HttpContext.Current.Session["user"] = wuser;
                    }
                }
                else
                {//获取授权失败,也跳转至登录页面
                    System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=MyDeclareList");
                }
            }
            else if (user.IsCustomer != 1 && user.IsCompany != 1)
            {//不是企业或委托单位,无此权限
                System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            //如果当前用户未登陆,先获取授权
            if (user == null)
            {
                WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
                if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
                {//授权成功
                    LogHelper.Write("第9步:" + userInfo.OpenID);
                    WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                    if (wuser == null || string.IsNullOrEmpty(wuser.GwyUserName))
                    {//账号未关联,跳转至登录界面
                        LogHelper.Write("第10步:" + userInfo.OpenID);
                        System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=SiteInspectionList");
                    }
                    else if (wuser.IsReceiver != 1)
                    {//不是接单单位,无此权限
                        LogHelper.Write("第11步:" + userInfo.OpenID);
                        System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
                    }
                    else
                    {//不需登录,保存当前用户
                        HttpContext.Current.Session["user"] = wuser;
                    }
                    LogHelper.Write("第12步:" + wuser.WCOpenID);
                }
                else
                {//获取授权失败,也跳转至登录页面
                    System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=SiteDeclareList");
                }
            }
            else if (user.IsReceiver != 1)
            {//不是接单单位,无此权限
                System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];
         //如果当前用户未登陆,先获取授权
         if (user == null)
         {
             WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
             if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
             {//授权成功
                 WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                 if (wuser != null || string.IsNullOrEmpty(wuser.GwyUserName))
                 {
                     HttpContext.Current.Session["user"] = wuser;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Write("SignOut解除绑定异常:" + ex.Message);
     }
 }