Example #1
0
File: Client.cs Project: uvbs/mmp
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="websiteOwner">站点所有者</param>
        public Client(string websiteOwner)
        {
            ZentCloud.BLLJIMP.BLL bll         = new ZentCloud.BLLJIMP.BLL();
            WebsiteInfo           websiteInfo = bll.Get <WebsiteInfo>(string.Format("WebsiteOwner='{0}'", websiteOwner));

            WebsiteOwner = websiteOwner;
            APIBaseUrl   = "http://" + ZentCloud.Common.ConfigHelper.GetConfigString("HongWareApiDomain");
            //Nick = websiteInfo.ApiNick;
            //Name = websiteInfo.ApiName;
            AppId    = websiteInfo.AuthorizerAppId;
            ShopName = websiteInfo.ShopName;
            OrgCode  = websiteInfo.OrgCode;
            if (websiteInfo.IsUnionHongware == 1)
            {
                if (string.IsNullOrEmpty(OrgCode))
                {
                    var orgModel = GetOrgCode();
                    if (orgModel != null)
                    {
                        if (orgModel.orgCode != null)
                        {
                            OrgCode = orgModel.orgCode.orgCode;
                            if (!string.IsNullOrEmpty(OrgCode))
                            {
                                websiteInfo.OrgCode = OrgCode;
                                bll.Update(websiteInfo);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        //#if DEBUG
        //        const string WEBSITEOWNER = "hf";
        //#endif
        /// <summary>
        /// 获取当前用户实体
        /// </summary>
        /// <returns></returns>
        public static ZentCloud.BLLJIMP.Model.UserInfo GetCurrUserModel()
        {
            //#if DEBUG

            //            return new BLLJIMP.Model.UserInfo()
            //            {
            //                AutoID = 262056,
            //                UserID = "jubit",
            //                UserType =1,
            //                TrueName = "杜鸿飞",
            //                Phone = "13636394008",
            //                WXAccessToken = "OezXcEiiBSKSxW0eoylIeK085OFFE57B9aMQr8tVwry3YSWHYeMCytIs8mSbQisb4VyqRhgRh1roLSk2xr7MCXUUaCqfamCQf4r5Sx3Nh9M-vX9FrJEApAJ74K3OEOxMnyLP2G6x0Ft7ddVsINurGQ",
            //                WXHeadimgurl = "http://wx.qlogo.cn/mmopen/0wRpPfN90ibChLwbS1tNZj6ib6EnTFEPA9X3b2GJ2iaIpcqNgJOzQW7m1Rb1zLP828aW2t64nVRxcYK6tCv577U3w/0",
            //                WXOpenId = "oTtgeuBURDQ3wr_1a4a7qTUj6ioc",
            //                WebsiteOwner = "hf",
            //                TotalScore=1000000


            //            };
            //#endif


            try
            {
                if (HttpContext.Current.Session[SessionKey.UserID] == null)
                {
                    HttpContext.Current.Response.Redirect(Common.ConfigHelper.GetConfigString("logoutUrl"));
                }

                ZentCloud.BLLJIMP.BLL            bll      = new ZentCloud.BLLJIMP.BLL("");
                ZentCloud.BLLJIMP.Model.UserInfo userInfo = bll.GetCurrentUserInfo();
                return(userInfo);
                //return bll.Get<ZentCloud.BLLJIMP.Model.UserInfo>(string.Format("UserID = '{0}'", HttpContext.Current.Session[SessionKey.UserID]));
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.Message);
                throw new FormatException(ex.Message, ex);
            }
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.Message);
            //    throw new Exception(ex.Message, ex);
            //}
        }