Beispiel #1
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }
            XmlDocument  xmlDocument = HiCache.Get("FileCache-MasterSettings") as XmlDocument;
            SiteSettings result;

            if (xmlDocument == null)
            {
                string masterSettingsFilename = SettingsManager.GetMasterSettingsFilename();
                if (!System.IO.File.Exists(masterSettingsFilename))
                {
                    result = null;
                    return(result);
                }
                xmlDocument = new XmlDocument();
                xmlDocument.Load(masterSettingsFilename);
                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", xmlDocument, new CacheDependency(masterSettingsFilename));
                }
            }
            result = SiteSettings.FromXml(xmlDocument);
            return(result);
        }
Beispiel #2
0
 public void Execute(XmlNode node)
 {
     try
     {
         DateTime now = DateTime.Now;
         List <WXMenuClickInfo> list = (List <WXMenuClickInfo>)HiCache.Get("DataCache-WXMenuClickRecords");
         if (list != null && list.Count > 0)
         {
             HiCache.Remove("DataCache-WXMenuClickRecords");
             Database      database      = DatabaseFactory.CreateDatabase();
             StringBuilder stringBuilder = new StringBuilder();
             foreach (WXMenuClickInfo item in list)
             {
                 stringBuilder.AppendFormat("INSERT INTO [Hishop_MenuClickRecords] (MenuId,WXOpenId,ClickDate) VALUES({0},'{1}','{2}');", item.MenuId, item.WXOpenId, item.ClickDate.ToString("yyyy-MM-dd"));
             }
             if (!string.IsNullOrEmpty(stringBuilder.ToString()))
             {
                 database.ExecuteNonQuery(CommandType.Text, stringBuilder.ToString());
             }
         }
         WXFansJob.SynchroWXFansData(now);
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog(ex, null, "WXFansJob");
     }
 }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            string str;

            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (siteSettings.IsDistributorSettings)
            {
                str = string.Format("Message-{0}-{1}", siteSettings.UserId.Value.ToString(CultureInfo.InvariantCulture), messageType);
            }
            else
            {
                str = string.Format("Message-{0}", messageType);
            }
            MessageTemplate template = HiCache.Get(str) as MessageTemplate;

            if (template == null)
            {
                template = siteSettings.IsDistributorSettings ? GetDistributorMessageTemplate(messageType, siteSettings.UserId.Value) : GetMessageTemplate(messageType);
                if (template != null)
                {
                    HiCache.Max(str, template);
                }
            }
            return(template);
        }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;
            string       string_;

            if (siteSettings.IsDistributorSettings)
            {
                string_ = string.Format("Message-{0}-{1}", siteSettings.UserId.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), messageType);
            }
            else
            {
                string_ = string.Format("Message-{0}", messageType);
            }
            MessageTemplate messageTemplate = HiCache.Get(string_) as MessageTemplate;

            if (messageTemplate == null)
            {
                messageTemplate = (siteSettings.IsDistributorSettings ? MessageTemplateHelper.GetDistributorMessageTemplate(messageType, siteSettings.UserId.Value) : MessageTemplateHelper.GetMessageTemplate(messageType));
                if (messageTemplate != null)
                {
                    HiCache.Max(string_, messageTemplate);
                }
            }
            return(messageTemplate);
        }
Beispiel #5
0
        private string GetJSApiScript()
        {
            string jspai = HiCache.Get("StringCache-Ticket") as string;

            if (jspai == null)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                string       weixinAppId    = masterSettings.WeixinAppId;

                TimeSpan      ts            = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                string        timestamp     = Convert.ToInt64(ts.TotalSeconds).ToString();
                StringBuilder stringBuilder = new StringBuilder();
                string        nonceStr      = DateTime.Now.ToString("fffffff");
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"debug\":{0},", "false");
                stringBuilder.AppendFormat("\"appId\":\"{0}\",", weixinAppId);
                stringBuilder.AppendFormat("\"timestamp\":\"{0}\",", timestamp);
                stringBuilder.AppendFormat("\"nonceStr\":\"{0}\",", nonceStr);
                stringBuilder.AppendFormat("\"signature\":\"{0}\",", TicketApi.GetTicketSignature(nonceStr, timestamp, "http://" + masterSettings.SiteUrl + "/Vshop/", weixinAppId, masterSettings.WeixinAppSecret));
                stringBuilder.Append("\"jsApiList\": [\"scanQRCode\",\"onMenuShareAppMessage\",\"onMenuShareTimeline\",\"onMenuShareQQ\",\"onMenuShareWeibo\"]");
                stringBuilder.Append("}");
                jspai = stringBuilder.ToString();
                HiCache.Insert("StringCache-Ticket", stringBuilder.ToString(), 9000);
            }
            return(jspai);
        }
Beispiel #6
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            bool   flag;
            string str = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> rolePermissionInfos = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(str))
            {
                rolePermissionInfos = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(HiCryptographer.Decrypt(str));
            }
            if ((rolePermissionInfos == null ? true : rolePermissionInfos.Count == 0))
            {
                rolePermissionInfos = (new RolePermissionDao()).GetPermissionsByRoleId(model.RoleId);
                string str1 = HiCryptographer.Encrypt(JsonConvert.SerializeObject(rolePermissionInfos));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), str1, 360, CacheItemPriority.Normal);
            }
            if ((rolePermissionInfos == null ? false : rolePermissionInfos.Count != 0))
            {
                RolePermissionInfo rolePermissionInfo = rolePermissionInfos.FirstOrDefault <RolePermissionInfo>((RolePermissionInfo p) => p.PermissionId == model.PermissionId);
                flag = rolePermissionInfo != null;
            }
            else
            {
                flag = false;
            }
            return(flag);
        }
Beispiel #7
0
        public static IList <StoreLocationInfo> GetStoreLocationInfoByOpenId(string openId, string longitude, string Latitude)
        {
            IList <StoreLocationInfo> list = (IList <StoreLocationInfo>)HiCache.Get($"DataCache-UserStoreInfo_{openId}");

            if (list == null)
            {
                IList <double>            list2                = new List <double>();
                string                    fromLatLng           = Latitude + "," + longitude;
                IList <string>            list3                = new List <string>();
                IList <StoreLocationInfo> allStoreLocationInfo = DepotHelper.GetAllStoreLocationInfo();
                if (allStoreLocationInfo != null && allStoreLocationInfo.Count > 0)
                {
                    list3 = (from s1 in allStoreLocationInfo
                             select s1.LatLng).ToList();
                    MapHelper.GetLatLngDistancesFromAPI(fromLatLng, list3, ref list2);
                    for (int i = 0; i < allStoreLocationInfo.Count; i++)
                    {
                        allStoreLocationInfo[i].Distances = list2[i];
                    }
                    list = (from s in allStoreLocationInfo
                            orderby s.Distances
                            select s).ToList();
                    HiCache.Insert($"DataCache-UserStoreInfo_{openId}", list, 180);
                }
            }
            return(list);
        }
Beispiel #8
0
        private static XmlDocument GetMenuDocument()
        {
            XmlDocument  document;
            HttpContext  context      = HiContext.Current.Context;
            SiteSettings siteSettings = SettingsManager.GetSiteSettings(HiContext.Current.User.UserId);

            if (siteSettings == null)
            {
                document = HiCache.Get("FileCache-ShopadminMenu-NoSite") as XmlDocument;
            }
            else
            {
                document = HiCache.Get("FileCache-ShopadminMenu") as XmlDocument;
            }
            if (document == null)
            {
                string str;
                if (siteSettings == null)
                {
                    str      = context.Request.MapPath("~/Shopadmin/Menu_NoSite.config");
                    document = new XmlDocument();
                    document.Load(str);
                    HiCache.Max("FileCache-ShopadminMenu-NoSite", document, new CacheDependency(str));
                    return(document);
                }
                str      = context.Request.MapPath("~/Shopadmin/Menu.config");
                document = new XmlDocument();
                document.Load(str);
                HiCache.Max("FileCache-ShopadminMenu", document, new CacheDependency(str));
            }
            return(document);
        }
Beispiel #9
0
        public static string GetTicketSignature(string noncestr, string timestamp, string url, string appid, string appsecret)
        {
            if (string.IsNullOrEmpty(noncestr) || string.IsNullOrEmpty(timestamp) || string.IsNullOrEmpty(url))
            {
                return("");
            }
            StringBuilder sb     = new StringBuilder();
            string        ticket = HiCache.Get("ticket") as string;

            if (ticket == null)
            {
                ticket = GetJsapiTicket_Message(appid, appsecret);
                HiCache.Insert("ticket", ticket, 1000);
            }

            sb.AppendFormat("jsapi_ticket={0}", ticket);
            sb.AppendFormat("&noncestr={0}", noncestr);
            sb.AppendFormat("&timestamp={0}", timestamp);
            sb.AppendFormat("&url={0}", url);

            //ErrorLog.Write("获取ticket:" + ticket);
            string signature = FormsAuthentication.HashPasswordForStoringInConfigFile(sb.ToString(), FormsAuthPasswordFormat.SHA1.ToString());

            return(signature);
        }
Beispiel #10
0
 public void Execute(XmlNode node)
 {
     try
     {
         DateTime now      = DateTime.Now;
         Database database = DatabaseFactory.CreateDatabase();
         this.ClearIpData(now, database);
         List <AccessRecordModel> list = (List <AccessRecordModel>)HiCache.Get("DataCache-AccessRecords");
         if (list != null && list.Count != 0)
         {
             HiCache.Remove("DataCache-AccessRecords");
             IList <SourceIpRecordsInfo> list2 = this.GetTodayAllIpList(database, now);
             if (list2 == null)
             {
                 list2 = new List <SourceIpRecordsInfo>();
             }
             IList <DailyAccessStatisticsInfo> list3 = this.GetTodayDailyAccessStatistics(database, now);
             if (list3 == null)
             {
                 list3 = new List <DailyAccessStatisticsInfo>();
             }
             List <SourceIpRecordsInfo> newIpLst = new List <SourceIpRecordsInfo>();
             List <ProductDailyAccessStatisticsInfo> productStatisticlst = new List <ProductDailyAccessStatisticsInfo>();
             foreach (AccessRecordModel item in list)
             {
                 TrafficJob.ManageDailyAcesssRecords(now, list2, list3, newIpLst, item, productStatisticlst);
             }
             this.ManageTrafficData(newIpLst, list3, productStatisticlst, database);
         }
     }
     catch (Exception ex)
     {
         Globals.AppendLog("Execute: " + ex.Message, "", "", "trafficLog");
     }
 }
Beispiel #11
0
        public static HiConfiguration GetConfig()
        {
            HiConfiguration configuration = HiCache.Get("FileCache-Configuragion") as HiConfiguration;

            if (configuration == null)
            {
                HttpContext current  = HttpContext.Current;
                string      filename = null;
                if (current != null)
                {
                    try
                    {
                        filename = current.Request.MapPath("~/config/Hishop.config");
                    }
                    catch
                    {
                        filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\Hishop.config");
                    }
                }
                else
                {
                    filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\Hishop.config");
                }
                XmlDocument doc = new XmlDocument();
                doc.Load(filename);
                configuration = new HiConfiguration(doc);
                HiCache.Max("FileCache-Configuragion", configuration, new CacheDependency(filename));
            }
            return(configuration);
        }
Beispiel #12
0
 private static System.Xml.XmlDocument GetMenuDocument()
 {
     System.Web.HttpContext context = Hidistro.Membership.Context.HiContext.Current.Context;
     Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.SettingsManager.GetSiteSettings(Hidistro.Membership.Context.HiContext.Current.User.UserId);
     System.Xml.XmlDocument xmlDocument;
     if (siteSettings == null)
     {
         xmlDocument = (HiCache.Get("FileCache-ShopadminMenu-NoSite") as System.Xml.XmlDocument);
     }
     else
     {
         xmlDocument = (HiCache.Get("FileCache-ShopadminMenu") as System.Xml.XmlDocument);
     }
     if (xmlDocument == null)
     {
         if (siteSettings == null)
         {
             string filename = context.Request.MapPath("~/Shopadmin/Menu_NoSite.config");
             xmlDocument = new System.Xml.XmlDocument();
             xmlDocument.Load(filename);
             HiCache.Max("FileCache-ShopadminMenu-NoSite", xmlDocument, new System.Web.Caching.CacheDependency(filename));
         }
         else
         {
             string filename = context.Request.MapPath("~/Shopadmin/Menu.config");
             xmlDocument = new System.Xml.XmlDocument();
             xmlDocument.Load(filename);
             HiCache.Max("FileCache-ShopadminMenu", xmlDocument, new System.Web.Caching.CacheDependency(filename));
         }
     }
     return(xmlDocument);
 }
Beispiel #13
0
        public virtual bool Delete <T>(long keyField)
        {
            Type typeFromHandle = typeof(T);
            TableNameAttribute tableNameAttribute = (TableNameAttribute)Attribute.GetCustomAttribute(typeFromHandle, typeof(TableNameAttribute));

            PropertyInfo[] array = HiCache.Get <PropertyInfo[]>($"Table-PropertyInfo-{tableNameAttribute.TableName}");
            if (array == null)
            {
                array = typeFromHandle.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                HiCache.Insert($"Table-PropertyInfo-{tableNameAttribute.TableName}", array);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" ");
            string    text             = "";

            PropertyInfo[] array2 = array;
            foreach (PropertyInfo propertyInfo in array2)
            {
                object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(FieldTypeAttribute), true);
                if (customAttributes.Length != 0 && this.IsKeyField(customAttributes))
                {
                    text = text + propertyInfo.Name + "=@" + propertyInfo.Name;
                    this.database.AddInParameter(sqlStringCommand, propertyInfo.Name, this.GetDbType(propertyInfo.PropertyType), keyField);
                    break;
                }
            }
            sqlStringCommand.CommandText = "DELETE FROM " + tableNameAttribute.TableName + " WHERE " + text;
            return(this.database.ExecuteNonQuery(sqlStringCommand) >= 1);
        }
Beispiel #14
0
        public static MemberInfo GetUser(int userId)
        {
            string     key        = $"DataCache-MemberCacheKey-{userId}";
            MemberInfo memberInfo = HiCache.Get <MemberInfo>(key);

            if (memberInfo == null)
            {
                memberInfo = new MemberDao().Get <MemberInfo>(userId);
                if (memberInfo == null)
                {
                    return(null);
                }
                memberInfo.Referral      = new ReferralDao().GetReferralInfo(userId);
                memberInfo.MemberOpenIds = new MemberOpenIdDao().GetMemberByOpenIds(userId);
                HiCache.Insert(key, memberInfo, 1800);
            }
            else
            {
                if (memberInfo.Referral == null)
                {
                    memberInfo.Referral = new ReferralDao().GetReferralInfo(userId);
                }
                if (memberInfo.MemberOpenIds == null)
                {
                    memberInfo.MemberOpenIds = new MemberOpenIdDao().GetMemberByOpenIds(userId);
                }
                HiCache.Insert(key, memberInfo, 1800);
            }
            return(memberInfo);
        }
Beispiel #15
0
        public static Navigation GetNavigation()
        {
            Navigation navigation = HiCache.Get("FileCache-AdminNavigation") as Navigation;

            if (navigation == null)
            {
                string      str;
                HttpContext current = HttpContext.Current;
                if (current != null)
                {
                    try
                    {
                        str = current.Request.MapPath("~/Admin/MenuNew.xml");
                    }
                    catch
                    {
                        str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
                    }
                }
                else
                {
                    str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
                }
                XmlDocument doc = new XmlDocument();
                doc.Load(str);
                navigation = new Navigation(doc);
                HiCache.Max("FileCache-AdminNavigation", navigation, new CacheDependency(str));
            }
            return(navigation);
        }
Beispiel #16
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            string text = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> list = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                string value = HiCryptographer.Decrypt(text);
                list = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(value);
            }
            if (list == null || list.Count == 0)
            {
                list = new RolePermissionDao().GetPermissionsByRoleId(model.RoleId);
                string obj = HiCryptographer.Encrypt(JsonConvert.SerializeObject(list));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), obj, 360, CacheItemPriority.Normal);
            }
            bool result;

            if (list == null || list.Count == 0)
            {
                result = false;
            }
            else
            {
                RolePermissionInfo rolePermissionInfo = list.FirstOrDefault((RolePermissionInfo p) => p.PermissionId == model.PermissionId);
                result = (rolePermissionInfo != null);
            }
            return(result);
        }
Beispiel #17
0
        public static DataTable GetCategories()
        {
            DataTable dataTable;

            if (HiContext.Current.SiteSettings.IsDistributorSettings)
            {
                dataTable = (HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value)) as DataTable);
            }
            else
            {
                dataTable = (HiCache.Get("DataCache-Categories") as DataTable);
            }
            if (dataTable == null)
            {
                dataTable = CategoryProvider.Instance().GetCategories();
                if (HiContext.Current.SiteSettings.IsDistributorSettings)
                {
                    HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value), dataTable, 360, CacheItemPriority.Normal);
                }
                else
                {
                    HiCache.Insert("DataCache-Categories", dataTable, 360, CacheItemPriority.Normal);
                }
            }
            return(dataTable);
        }
 private static System.Data.DataTable GetCategories()
 {
     System.Data.DataTable dataTable = new System.Data.DataTable();
     if (HiContext.Current.User.UserRole != UserRole.Anonymous)
     {
         dataTable = (HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId)) as System.Data.DataTable);
     }
     else
     {
         dataTable = (HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value)) as System.Data.DataTable);
     }
     if (dataTable == null)
     {
         dataTable = SubsiteProductProvider.Instance().GetCategories();
         if (HiContext.Current.User.UserRole != UserRole.Anonymous)
         {
             HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId), dataTable, 360, CacheItemPriority.Normal);
         }
         else
         {
             HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value), dataTable, 360, CacheItemPriority.Normal);
         }
     }
     return(dataTable);
 }
Beispiel #19
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }

            XmlDocument document = HiCache.Get("FileCache-MasterSettings") as XmlDocument;

            if (document == null)
            {
                string masterSettingsFilename = GetMasterSettingsFilename();

                if (!File.Exists(masterSettingsFilename))
                {
                    return(null);
                }

                document = new XmlDocument();

                document.Load(masterSettingsFilename);

                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", document, new CacheDependency(masterSettingsFilename));
                }
            }

            return(SiteSettings.FromXml(document));
        }
Beispiel #20
0
 public static System.Data.DataTable GetCategories()
 {
     System.Data.DataTable dataTable = HiCache.Get("DataCache-Categories") as System.Data.DataTable;
     if (null == dataTable)
     {
         dataTable = new CategoryDao().GetCategories();
         HiCache.Insert("DataCache-Categories", dataTable, 360, CacheItemPriority.Normal);
     }
     return(dataTable);
 }
Beispiel #21
0
 private static System.Collections.Hashtable smethod_0()
 {
     System.Collections.Hashtable hashtable = HiCache.Get("DataCache-UserLookuptable") as System.Collections.Hashtable;
     if (hashtable == null)
     {
         hashtable = new System.Collections.Hashtable();
         HiCache.Insert("DataCache-UserLookuptable", hashtable, 120);
     }
     return(hashtable);
 }
Beispiel #22
0
 public static System.Data.DataSet GetCategoryList()
 {
     System.Data.DataSet dataSet = HiCache.Get("DataCache-CategoryList") as System.Data.DataSet;
     if (dataSet == null)
     {
         dataSet = new CategoryDao().GetCategoryList();
         HiCache.Insert("DataCache-CategoryList", dataSet, 360, CacheItemPriority.Normal);
     }
     return(dataSet);
 }
Beispiel #23
0
        public static IList <StoreLocationInfo> GetAllStoreLocationInfo()
        {
            IList <StoreLocationInfo> list = (IList <StoreLocationInfo>)HiCache.Get("DataCache-StoreInfoDataKey");

            if (list == null)
            {
                list = new StoresDao().GetAllStoreLocationInfo();
            }
            return(list);
        }
Beispiel #24
0
 public static System.Collections.Hashtable UserCache()
 {
     System.Collections.Hashtable hashtable = HiCache.Get("DataCache-UserLookuptable") as System.Collections.Hashtable;
     if (hashtable == null)
     {
         hashtable = new System.Collections.Hashtable();
         HiCache.Insert("DataCache-UserLookuptable", hashtable, 300);
     }
     return(hashtable);
 }
Beispiel #25
0
 private static System.Data.DataTable GetCategories()
 {
     System.Data.DataTable dataTable = HiCache.Get("DataCache-Categories") as System.Data.DataTable;
     if (null == dataTable)
     {
         dataTable = ProductProvider.Instance().GetCategories();
         HiCache.Insert("DataCache-Categories", dataTable, 360, CacheItemPriority.Normal);
     }
     return(dataTable);
 }
Beispiel #26
0
        private static Hashtable UserCache()
        {
            Hashtable hashtable = HiCache.Get("DataCache-UserLookuptable") as Hashtable;

            if (hashtable == null)
            {
                hashtable = new Hashtable();
                HiCache.Insert("DataCache-UserLookuptable", hashtable, 120);
            }
            return(hashtable);
        }
        public static DataSet GetCategoryList()
        {
            DataSet categoryList = HiCache.Get("DataCache-CategoryList") as DataSet;

            if (categoryList == null)
            {
                categoryList = new CategoryDao().GetCategoryList();
                HiCache.Insert("DataCache-CategoryList", categoryList, 360, CacheItemPriority.Normal);
            }
            return(categoryList);
        }
Beispiel #28
0
        public static DistributorsInfo GetCurrentDistributors(int userId)
        {
            DistributorsInfo distributorInfo = HiCache.Get(string.Format("DataCache-Distributor-{0}", userId)) as DistributorsInfo;

            if ((distributorInfo == null) || (distributorInfo.UserId == 0))
            {
                distributorInfo = new DistributorsDao().GetDistributorInfo(userId);
                HiCache.Insert(string.Format("DataCache-Distributor-{0}", userId), distributorInfo, 360, CacheItemPriority.Normal);
            }
            return(distributorInfo);
        }
        public static DataTable GetCategories()
        {
            DataTable categories = HiCache.Get("DataCache-Categories") as DataTable;

            if (categories == null)
            {
                categories = new CategoryDao().GetCategories();
                HiCache.Insert("DataCache-Categories", categories, 360, CacheItemPriority.Normal);
            }
            return(categories);
        }
Beispiel #30
0
        public static DataTable GetSites()
        {
            DataTable dtSites = HiCache.Get("DataCache-Sites") as DataTable;

            if (dtSites == null)
            {
                dtSites = new SitesManagementDao().GetSites();
                HiCache.Insert("DataCache-Sites", dtSites);
            }
            return(dtSites);
        }