Exemplo n.º 1
0
        public static bool CheckDistributorIsCanAuthorization(int number, out int leftNumber)
        {
            leftNumber = 0;
            SystemAuthorizationInfo systemAuthorization = SystemAuthorizationHelper.GetSystemAuthorization(false);
            bool result;

            if (systemAuthorization.DistributorCount > 0)
            {
                int systemDistributorsCount = MemberHelper.GetSystemDistributorsCount();
                leftNumber = systemAuthorization.DistributorCount - systemDistributorsCount;
                result     = (systemAuthorization.DistributorCount >= systemDistributorsCount + number);
            }
            else
            {
                result = true;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static bool CheckDistributorIsCanAuthorization(int number, out int leftNumber)
        {
            bool distributorCount;

            leftNumber = 0;
            SystemAuthorizationInfo systemAuthorization = SystemAuthorizationHelper.GetSystemAuthorization(false);

            if (systemAuthorization.DistributorCount <= 0)
            {
                distributorCount = true;
            }
            else
            {
                int systemDistributorsCount = MemberHelper.GetSystemDistributorsCount();
                leftNumber       = systemAuthorization.DistributorCount - systemDistributorsCount;
                distributorCount = systemAuthorization.DistributorCount >= systemDistributorsCount + number;
            }
            return(distributorCount);
        }
Exemplo n.º 3
0
        public static SystemAuthorizationInfo GetSystemAuthorization(bool iscreate)
        {
            string key = "DataCache-SystemAuthorizationInfo";
            SystemAuthorizationInfo systemAuthorizationInfo = HiCache.Get(key) as SystemAuthorizationInfo;

            if (systemAuthorizationInfo == null || iscreate)
            {
                string value = SystemAuthorizationHelper.PostData(SystemAuthorizationHelper.authorizationUrl, "host=" + Globals.DomainName);
                if (!string.IsNullOrEmpty(value))
                {
                    TempAuthorizationInfo tempAuthorizationInfo = JsonConvert.DeserializeObject <TempAuthorizationInfo>(value);
                    systemAuthorizationInfo = new SystemAuthorizationInfo
                    {
                        state            = (SystemAuthorizationState)tempAuthorizationInfo.state,
                        DistributorCount = tempAuthorizationInfo.count,
                        type             = tempAuthorizationInfo.type,
                        IsShowJixuZhiChi = tempAuthorizationInfo.isshowjszc == "1"
                    };
                    HiCache.Insert(key, systemAuthorizationInfo, 360, CacheItemPriority.Normal);
                }
            }
            return(systemAuthorizationInfo);
        }
Exemplo n.º 4
0
        public static bool CheckDistributorIsCanAuthorization()
        {
            int num = 0;

            return(SystemAuthorizationHelper.CheckDistributorIsCanAuthorization(1, out num));
        }