示例#1
0
        /// <summary>
        /// 免费的员工数 (业务员数)
        /// </summary>
        /// <returns></returns>
        private static int GetFreeSalses()
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                CancelEnterpriseKey = true,
                DefaultDb           = 0,
                ReadWriteHosts      = SAASInfo.GetSystemValue("RedisCacheReadWriteHosts"),
                ReadOnlyHosts       = SAASInfo.GetSystemValue("RedisCacheReadOnlyHosts"),
            });
            string CacheKey = "SAAS_FreeEnterpriseSales";
            object objModel = coreBll.GetCache(CacheKey);

            if (objModel == null)
            {
                try
                {
                    objModel = GetSysValue(CacheKey);
                    if (objModel != null)
                    {
                        coreBll.SetCache(CacheKey, objModel, DateTime.MaxValue, TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return(Common.Globals.SafeInt(objModel, 5));
        }
示例#2
0
        /// <summary>
        /// 获取企业客户数 (Redis 缓存)
        /// </summary>
        /// <returns></returns>
        public static int GetCacheCusts(long enterpriseId)
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                CancelEnterpriseKey = true,
                DefaultDb           = 0,
                ReadWriteHosts      = SAASInfo.GetSystemValue("RedisCacheReadWriteHosts"),
                ReadOnlyHosts       = SAASInfo.GetSystemValue("RedisCacheReadOnlyHosts"),
            });
            string CacheKey = "SAAS_EnterpriseCusts_" + enterpriseId;
            object objModel = coreBll.GetCache(CacheKey);

            if (objModel == null)
            {
                try
                {
                    objModel = GetUserCounts(1, enterpriseId);
                    if (objModel != null)
                    {
                        coreBll.SetCache(CacheKey, objModel, DateTime.MaxValue, TimeSpan.Zero);
                    }
                }
                catch
                {
                }
            }
            return(Common.Globals.SafeInt(objModel, 0));
        }
示例#3
0
        /// <summary>
        /// 设置企业数据流向
        /// </summary>
        /// <param name="enterpriseId"></param>
        /// <returns></returns>
        public static string GetDataConn(int enterpriseId)
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                CancelEnterpriseKey = true,
                DefaultDb           = 0,
            });
            string BaseKey  = "OMS_ConnectionData";
            string CacheKey = BaseKey + "_" + enterpriseId;
            object objModel = coreBll.GetCache(CacheKey);

            if (objModel == null)
            {
                try
                {
                    Common.CallContextHelper.SetAutoTag(enterpriseId);
                    objModel = GetSysValue(BaseKey);
                    if (objModel != null)
                    {
                        coreBll.SetCache(CacheKey, objModel, DateTime.MaxValue, TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return(Common.Globals.SafeString(objModel, "ERP"));
        }
示例#4
0
        /// <summary>
        /// 设置购买状态缓存
        /// </summary>
        /// <param name="applicationId"></param>
        /// <param name="enterpriseId"></param>
        /// <returns></returns>
        public static bool SetBuyCache(int applicationId, long enterpriseId)
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                CancelEnterpriseKey = true,
                DefaultDb           = 0,
                ReadWriteHosts      = SAASInfo.GetSystemValue("RedisCacheReadWriteHosts"),
                ReadOnlyHosts       = SAASInfo.GetSystemValue("RedisCacheReadOnlyHosts"),
            });
            string CacheKey = "SAAS_AppIsBuy_" + applicationId + "_" + enterpriseId;

            return(coreBll.SetCache(CacheKey, true));
        }
示例#5
0
        /// <summary>
        /// 清除员工缓存数
        /// </summary>
        /// <param name="enterpriseId"></param>
        /// <returns></returns>
        public static bool ClearCacheSales(long enterpriseId)
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                CancelEnterpriseKey = true,
                DefaultDb           = 0,
                ReadWriteHosts      = SAASInfo.GetSystemValue("RedisCacheReadWriteHosts"),
                ReadOnlyHosts       = SAASInfo.GetSystemValue("RedisCacheReadOnlyHosts"),
            });
            string CacheKey = "SAAS_EnterpriseSales_" + enterpriseId;

            return(coreBll.DeleteCache(CacheKey));
        }
示例#6
0
        private static DateTime GetEndTime(int applicationId, long enterpriseId)
        {
            YSWL.Common.DataCacheCore coreBll = new DataCacheCore(new CacheOption
            {
                CacheType           = CacheType.Redis,
                CancelProductKey    = true,
                DefaultDb           = 0,
                CancelEnterpriseKey = true,
                ReadWriteHosts      = SAASInfo.GetSystemValue("RedisCacheReadWriteHosts"),
                ReadOnlyHosts       = SAASInfo.GetSystemValue("RedisCacheReadOnlyHosts"),
            });
            string CacheKey = "SAAS_AppEndTime_" + applicationId + "_" + enterpriseId;
            object objModel = coreBll.GetCache(CacheKey);

            if (objModel == null)
            {
                try
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append("select EndTime  from SA_EnterpriseBuyJurisdiction");
                    strSql.Append(" where EnterpriseId=@EnterpriseId and ApplicationId=@ApplicationId  and IsTrial=0");
                    SqlParameter[] parameters =
                    {
                        new SqlParameter("@EnterpriseId",  SqlDbType.Int, 4),
                        new SqlParameter("@ApplicationId", SqlDbType.Int, 4)
                    };
                    parameters[0].Value = enterpriseId;
                    parameters[1].Value = applicationId;

                    objModel = YSWL.DBUtility.ConnectionStrManage.GetSingle(strSql.ToString(), parameters);

                    if (objModel != null)
                    {
                        coreBll.SetCache(CacheKey, objModel, DateTime.MaxValue, TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return(Common.Globals.SafeDateTime(objModel, DateTime.Now));
        }