Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public static DataTable GetCategories()
        {
            DataTable categories = HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId)) as DataTable;

            if (null == categories)
            {
                categories = SubsiteProductProvider.Instance().GetCategories();
                HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId), categories, 360, CacheItemPriority.Normal);
            }
            return(categories);
        }
Exemplo n.º 3
0
        public static DataSet GetCategoryList(string wid)
        {
            DataSet categoryList = HiCache.Get("DataCache-CategoryList") as DataSet;

            if (categoryList == null)
            {
                categoryList = new CategoryDao().GetCategoryList(wid);
                HiCache.Insert("DataCache-CategoryList", categoryList, 360, CacheItemPriority.Normal);
            }
            return(categoryList);
        }
Exemplo n.º 4
0
        public static MemberInfo GetMember(int userId)
        {
            MemberInfo member = HiCache.Get(string.Format("DataCache-Member-{0}", userId)) as MemberInfo;

            if (member == null)
            {
                member = new MemberDao().GetMember(userId);
                HiCache.Insert(string.Format("DataCache-Member-{0}", userId), member, 360, CacheItemPriority.Normal);
            }
            return(member);
        }
        public static DataTable GetUserbrowsehistorys()
        {
            DataTable dtBrowsehistorys = HiCache.Get("DataCache-Userbrowsehistorys") as DataTable;

            if (dtBrowsehistorys == null)
            {
                dtBrowsehistorys = new UserbrowsehistoryDao().GetUserBrowseHistorys();
                HiCache.Insert("DataCache-Userbrowsehistorys", dtBrowsehistorys);
            }
            return(dtBrowsehistorys);
        }
Exemplo n.º 6
0
        public static IList <HelpCategoryInfo> GetHelps()
        {
            IList <HelpCategoryInfo> list = HiCache.Get <IList <HelpCategoryInfo> >("DataCache-Helps");

            if (list == null)
            {
                list = new HelpDao().GetHelps(true);
                HiCache.Insert("DataCache-Helps", list, 7200);
            }
            return(list);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public static IList <FriendlyLinksInfo> GetFriendlyLinksIsVisible(int?num)
        {
            IList <FriendlyLinksInfo> list = HiCache.Get <List <FriendlyLinksInfo> >("DataCache-FriendLinks");

            if (list == null)
            {
                list = new FriendlyLinkDao().GetFriendlyLinksIsVisible(num);
                HiCache.Insert("DataCache-FriendLinks", list, 3600);
            }
            return(list);
        }
Exemplo n.º 9
0
        public static IList <ArticleInfo> GetArticleList(int categoryId, int maxNum)
        {
            IList <ArticleInfo> list = HiCache.Get <List <ArticleInfo> >($"DataCache-Articles-{categoryId}-{maxNum}");

            if (list == null)
            {
                list = new ArticleDao().GetArticleList(categoryId, maxNum);
                HiCache.Insert($"DataCache-Articles-{categoryId}-{maxNum}", list, 720);
            }
            return(list);
        }
Exemplo n.º 10
0
        public static IList <HotkeywordInfo> GetAllHotKeywords()
        {
            IList <HotkeywordInfo> list = HiCache.Get <IList <HotkeywordInfo> >("DataCache-Keywords");

            if (list == null)
            {
                list = new HotkeywordDao().Gets <HotkeywordInfo>("Frequency", SortAction.Desc, null);
                HiCache.Insert("DataCache-Keywords", list, 600);
            }
            return(list);
        }
Exemplo n.º 11
0
        public static IEnumerable <CategoryInfo> GetCategories()
        {
            IEnumerable <CategoryInfo> enumerable = HiCache.Get <IEnumerable <CategoryInfo> >("DataCache-Categories");

            if (enumerable == null)
            {
                enumerable = new CategoryDao().Gets <CategoryInfo>("DisplaySequence", SortAction.Desc, null);
                HiCache.Insert("DataCache-Categories", enumerable, 360);
            }
            return(enumerable);
        }
Exemplo n.º 12
0
        public static DataTable GetUserBrowseHistory(UserbrowsehistoryInfo browserhistory)
        {
            DataTable dtScanHistorys = HiCache.Get("DataCache-UserScanHistroys") as DataTable;

            if (dtScanHistorys == null)
            {
                dtScanHistorys = new UserbrowsehistoryDao().GetUserBrowseHistory(browserhistory);
                HiCache.Insert("DataCache-UserScanHistroys", dtScanHistorys);
            }
            return(dtScanHistorys);
        }
Exemplo n.º 13
0
        public static DataTable GetCategories(int isDisable)
        {
            DataTable dataTable = new DataTable();

            dataTable = (HiCache.Get("DataCache-DisableCategories") as DataTable);
            if (dataTable == null)
            {
                dataTable = new CategoryDao().GetCategories(isDisable);
                HiCache.Insert("DataCache-DisableCategories", dataTable, 360, CacheItemPriority.Normal);
            }
            return(dataTable);
        }
Exemplo n.º 14
0
        public static DataTable GetCategoriesByThisId(int categoryId, int c2, int c3, int c4, int c5, int c6, int c7)
        {
            DataTable dataTable = new DataTable();

            dataTable = (HiCache.Get("DataCache-Categories-thisC") as DataTable);
            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                dataTable = new CategoryDao().GetCategoriesByTopId(categoryId, c2, c3, c4, c5, c6, c7);
                HiCache.Insert("DataCache-Categories-thisC", dataTable, 86400, CacheItemPriority.Normal);
            }
            return(dataTable);
        }
Exemplo n.º 15
0
        public static IList <ShopMenuInfo> GetTopMenus(int clientType = 0)
        {
            ShopMenuDao          shopMenuDao = new ShopMenuDao();
            IList <ShopMenuInfo> list        = HiCache.Get <IList <ShopMenuInfo> >($"DataCache-ShopMenuCacheKey-{0}");

            if (list == null)
            {
                list = shopMenuDao.GetTopMenus(clientType);
                HiCache.Insert($"DataCache-ShopMenuCacheKey-{0}", list);
            }
            return(list);
        }
Exemplo n.º 16
0
        public virtual long Add(object model, DbTransaction dbTran = null)
        {
            Type type = model.GetType();
            TableNameAttribute tableNameAttribute = (TableNameAttribute)Attribute.GetCustomAttribute(type, typeof(TableNameAttribute));

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

            PropertyInfo[] array2 = array;
            foreach (PropertyInfo propertyInfo in array2)
            {
                object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(FieldTypeAttribute), true);
                if (customAttributes.Length != 0)
                {
                    if (this.IsIncrementField(customAttributes))
                    {
                        flag = true;
                    }
                    else
                    {
                        text = text + propertyInfo.Name + ",";
                        this.database.AddInParameter(sqlStringCommand, propertyInfo.Name, this.GetDbType(propertyInfo.PropertyType), propertyInfo.GetValue(model, null));
                    }
                }
            }
            text  = text.Remove(text.Length - 1);
            text2 = "@" + text.Replace(",", ",@");
            sqlStringCommand.CommandText = "INSERT INTO " + tableNameAttribute.TableName + "(" + text + ")VALUES(" + text2 + ")";
            if (flag)
            {
                DbCommand dbCommand = sqlStringCommand;
                dbCommand.CommandText += " SELECT @@IDENTITY";
                if (dbTran != null)
                {
                    return(this.database.ExecuteScalar(sqlStringCommand, dbTran).ToLong(0));
                }
                return(this.database.ExecuteScalar(sqlStringCommand).ToLong(0));
            }
            if (dbTran != null)
            {
                return(this.database.ExecuteNonQuery(sqlStringCommand, dbTran));
            }
            return(this.database.ExecuteNonQuery(sqlStringCommand));
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 关注访问店铺处理
        /// </summary>
        private void ScanVisitDistributor(EventRequest eventRequest, string strEventKey)
        {
            WriteLog("1.响应微信消息事件:" + eventRequest.Event);
            if (!string.IsNullOrEmpty(strEventKey) && strEventKey.Split('_').Length > 1)
            {
                WriteLog("2.响应微信消息内容:" + strEventKey);
                string[] arrayEventKey = strEventKey.Split('_');
                switch (arrayEventKey[arrayEventKey.Length - 2].ToLower())
                {
                case "distributor":
                    WriteLog("3.进入枚举_访问店铺处理:" + arrayEventKey[arrayEventKey.Length - 1]);
                    string VisitDistributorID = HiCache.Get(string.Format("DataCache-VisitDistributor-{0}", arrayEventKey[arrayEventKey.Length - 1])) as string;
                    if (string.IsNullOrEmpty(VisitDistributorID))
                    {
                        WriteLog("4.存储访问店铺ID:" + VisitDistributorID);
                        HiCache.Remove(string.Format("DataCache-VisitDistributor-{0}", eventRequest.FromUserName));
                        HiCache.Insert(string.Format("DataCache-VisitDistributor-{0}", eventRequest.FromUserName), arrayEventKey[arrayEventKey.Length - 1], 360
                                       , System.Web.Caching.CacheItemPriority.Normal);
                        WriteLog("5.成功存储访问店铺ID:");
                    }
                    break;

                case "frommember":
                    WriteLog("进入frommember");
                    //设置推荐人id
                    string VisitFromMemberId = HiCache.Get(string.Format("DataCache-FromMemberId-{0}", arrayEventKey[arrayEventKey.Length - 1])) as string;
                    if (string.IsNullOrEmpty(VisitFromMemberId))
                    {
                        HiCache.Remove(string.Format("DataCache-FromMemberId-{0}", eventRequest.FromUserName));
                        HiCache.Insert(string.Format("DataCache-FromMemberId-{0}", eventRequest.FromUserName), arrayEventKey[arrayEventKey.Length - 1], 360
                                       , System.Web.Caching.CacheItemPriority.Normal);
                        WriteLog("推荐人openid:" + eventRequest.FromUserName + " " + "推荐人id:" + arrayEventKey[arrayEventKey.Length - 1]);
                    }
                    break;

                case "storesenderid":
                    WriteLog("进入StoreSenderId");

                    string VisitStoreId = HiCache.Get(string.Format("DataCache-sub-StoreId-{0}", arrayEventKey[arrayEventKey.Length - 1])) as string;
                    if (string.IsNullOrEmpty(VisitStoreId))
                    {
                        HiCache.Remove(string.Format("DataCache-sub-StoreId-{0}", eventRequest.FromUserName));
                        HiCache.Insert(string.Format("DataCache-sub-StoreId-{0}", eventRequest.FromUserName), arrayEventKey[arrayEventKey.Length - 1], 360
                                       , System.Web.Caching.CacheItemPriority.Normal);
                    }

                    break;
                }
                WriteLog("9.响应微信消息结束:");
            }
        }
Exemplo n.º 19
0
        public static AnonymousUser GetAnonymousUser()
        {
            AnonymousUser anonymousUser = HiCache.Get("DataCache-AnonymousUser") as AnonymousUser;

            if (anonymousUser == null)
            {
                anonymousUser = MemberUserProvider.Instance().GetAnonymousUser();
                if (((anonymousUser != null) && (anonymousUser.Username != null)) && (anonymousUser.UserId > 0))
                {
                    HiCache.Insert("DataCache-AnonymousUser", anonymousUser, 120);
                }
            }
            return(anonymousUser);
        }
Exemplo n.º 20
0
        public static IEnumerable <BrandMode> GetBrandCategories(int categoryId, int maxNum = 1000)
        {
            IEnumerable <BrandMode> enumerable = HiCache.Get <IEnumerable <BrandMode> >($"DataCache-Brands-{categoryId}-{maxNum}");

            if (enumerable == null)
            {
                enumerable = new BrandCategoryDao().GetBrandCategories(CatalogHelper.GetCategory(categoryId), maxNum);
                if (enumerable != null)
                {
                    HiCache.Insert($"DataCache-Brands-{categoryId}-{maxNum}", enumerable, 360);
                }
            }
            return(enumerable);
        }
Exemplo n.º 21
0
        public bool AppCheckVerifyCode(string phone, string verifyCode, out string Msg)
        {
            Msg = "手机验证码输入不正确!";
            string text = HiCache.Get($"DataCache-PhoneCode-{phone}").ToNullString();
            int    num  = 0;

            if (!string.IsNullOrEmpty(text))
            {
                text = HiCryptographer.Decrypt(text);
                object obj = HiCache.Get("smsnum" + phone);
                if (obj != null)
                {
                    num = obj.ToInt(0);
                }
                num++;
                if (num > 5)
                {
                    HiCache.Remove($"DataCache-PhoneCode-{phone}");
                    Msg = "输入验证码错误次数过多请重新发送验证码!";
                    Globals.AppendLog("验证码超次数服务端过期:" + text, "", "", "");
                    return(false);
                }
                bool flag = string.Compare(text, verifyCode, true, CultureInfo.InvariantCulture) == 0;
                if (!flag)
                {
                    HiCache.Insert("smsnum" + phone, num, 600);
                }
                else
                {
                    HiCache.Remove($"DataCache-PhoneCode-{phone}");
                    if (obj != null)
                    {
                        HiCache.Remove("smsnum" + phone);
                    }
                }
                return(flag);
            }
            object obj2 = HiCache.Get("smsnum" + phone);

            if (obj2 != null)
            {
                num = obj2.ToInt(0);
            }
            if (num >= 5)
            {
                Msg = "输入验证码错误次数过多请重新发送验证码";
                return(false);
            }
            return(false);
        }
Exemplo n.º 22
0
        public static DistributorsInfo GetCurrentDistributors(int userId, [Optional, DefaultParameterValue(true)] bool readCache)
        {
            DistributorsInfo distributorInfo = null;

            if (readCache)
            {
                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);
        }
Exemplo n.º 23
0
        public static ManagerInfo GetManager(int userId)
        {
            string      key         = $"DataCache-ManagerCacheKey-{userId}";
            ManagerInfo managerInfo = HiCache.Get <ManagerInfo>(key);

            if (managerInfo == null)
            {
                managerInfo = new ManagerDao().Get <ManagerInfo>(userId);
                if (managerInfo != null)
                {
                    HiCache.Insert(key, managerInfo, 3600);
                }
            }
            return(managerInfo);
        }
Exemplo n.º 24
0
        public static DistributorsInfo GetCurrentDistributors(int userId, bool readCache = true)
        {
            DistributorsInfo distributorsInfo = null;

            if (readCache)
            {
                distributorsInfo = (HiCache.Get(string.Format("DataCache-Distributor-{0}", userId)) as DistributorsInfo);
            }
            if (distributorsInfo == null || distributorsInfo.UserId == 0)
            {
                distributorsInfo = new DistributorsDao().GetDistributorInfo(userId);
                HiCache.Insert(string.Format("DataCache-Distributor-{0}", userId), distributorsInfo, 360, CacheItemPriority.Normal);
            }
            return(distributorsInfo);
        }
Exemplo n.º 25
0
        internal static MessageTemplate GetTemplate(string messageType)
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            string          key             = $"DataCache-MessageTemplate-{messageType.ToLower()}";
            MessageTemplate messageTemplate = HiCache.Get <MessageTemplate>(key);

            if (messageTemplate == null)
            {
                messageTemplate = MessageTemplateHelper.GetMessageTemplate(messageType);
                if (messageTemplate != null)
                {
                    HiCache.Insert(key, messageTemplate, 1800);
                }
            }
            return(messageTemplate);
        }
Exemplo n.º 26
0
        public static bool Update(ManagerInfo manager)
        {
            bool flag;

            HiCache.Remove(string.Format("DataCache-Manager-{0}", manager.UserId));
            if (!(new MessageDao()).Update(manager))
            {
                flag = false;
            }
            else
            {
                HiCache.Insert(string.Format("DataCache-Manager-{0}", manager.UserId), manager, 360, CacheItemPriority.Normal);
                flag = true;
            }
            return(flag);
        }
Exemplo n.º 27
0
        public static MemberInfo GetMember(int userId, [Optional, DefaultParameterValue(true)] bool isUserCache)
        {
            MemberInfo member = null;

            if (isUserCache)
            {
                member = HiCache.Get(string.Format("DataCache-Member-{0}", userId)) as MemberInfo;
                if (member == null)
                {
                    member = new MemberDao().GetMember(userId);
                    HiCache.Insert(string.Format("DataCache-Member-{0}", userId), member, 360, CacheItemPriority.Normal);
                }
                return(member);
            }
            return(new MemberDao().GetMember(userId));
        }
Exemplo n.º 28
0
        public static bool Update(ManagerInfo manager)
        {
            HiCache.Remove(string.Format("DataCache-Manager-{0}", manager.UserId));
            bool result;

            if (new MessageDao().Update(manager))
            {
                HiCache.Insert(string.Format("DataCache-Manager-{0}", manager.UserId), manager, 360, CacheItemPriority.Normal);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 29
0
        public static bool UpdateClickStatistical(string fromUserName, int menuId)
        {
            List <WXMenuClickInfo> list            = (List <WXMenuClickInfo>)HiCache.Get("DataCache-WXMenuClickRecords");
            WXMenuClickInfo        wXMenuClickInfo = new WXMenuClickInfo();

            if (list == null)
            {
                list = new List <WXMenuClickInfo>();
            }
            wXMenuClickInfo.WXOpenId  = fromUserName;
            wXMenuClickInfo.ClickDate = DateTime.Now;
            wXMenuClickInfo.MenuId    = menuId;
            list.Add(wXMenuClickInfo);
            HiCache.Remove("DataCache-WXMenuClickRecords");
            HiCache.Insert("DataCache-WXMenuClickRecords", list);
            return(true);
        }
Exemplo n.º 30
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            string str = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> permissionsByRoleId = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(str))
            {
                permissionsByRoleId = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(HiCryptographer.Decrypt(str));
            }
            if ((permissionsByRoleId == null) || (permissionsByRoleId.Count == 0))
            {
                permissionsByRoleId = new RolePermissionDao().GetPermissionsByRoleId(model.RoleId);
                string str3 = HiCryptographer.Encrypt(JsonConvert.SerializeObject(permissionsByRoleId));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), str3, 360, CacheItemPriority.Normal);
            }
            return(((permissionsByRoleId != null) && (permissionsByRoleId.Count != 0)) && (permissionsByRoleId.FirstOrDefault <RolePermissionInfo>(p => (p.PermissionId == model.PermissionId)) != null));
        }