コード例 #1
0
 /// <summary>
 /// Gets a Product.
 /// </summary>
 /// <param name="productId">The ProductId.</param>
 /// <returns></returns>
 public static Product GetProductByProductID(int productId)
 {
     return(CacheHelper.CacheObject <Product>(delegate {
         Product cacheData = new Product(productId);
         return !cacheData.IsNew ? cacheData : null;
     }, string.Format(CACHE_PRODUCT, productId), CacheLength.GetDefaultCacheTime, CacheItemPriority.Default));
 }
コード例 #2
0
ファイル: PageCache.cs プロジェクト: zahedbri/dashcommerce-3
 /// <summary>
 /// Gets the page by ID.
 /// </summary>
 /// <param name="pageId">The page ID.</param>
 /// <returns></returns>
 public static Page GetPageByID(int pageId)
 {
     return(CacheHelper.CacheObject <Page>(delegate {
         Page pageItem = new Page(pageId);
         return !pageItem.IsNew ? pageItem : null;
     }, MakePageItemKey(pageId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #3
0
 public static EmailTemplate GetItem(Int64 EmailTemplateId)
 {
     return(CacheHelper.CacheObject <EmailTemplate>(
                delegate
     {
         return EmailTemplate.FetchByID(EmailTemplateId);
     },
                string.Format(CACHE_KEY_BY_ID, EmailTemplateId), CacheHelper.DefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #4
0
ファイル: AppUsers.cs プロジェクト: yohairosen/snoopi-backend
 public static string AppUserLangCode(Int64 AppUserId)
 {
     return(CacheHelper.CacheObject <string>(() =>
     {
         object ret = Query.New <AppUser>().Select(AppUser.Columns.LangCode).Where(AppUser.Columns.AppUserId, AppUserId).ExecuteScalar();
         if (ret != null)
         {
             return (string)ret;
         }
         return @"";
     }, @"AULangCode_" + AppUserId, 120));
 }
コード例 #5
0
 /// <summary>
 /// Gets the site settings.
 /// </summary>
 /// <returns></returns>
 public static SiteSettings GetSiteSettings()
 {
     //There should be some caching here even if the site has disabled caching. (there are to many calls to SiteSettings)
     return(CacheHelper.CacheObject <SiteSettings>(delegate {
         SiteSettings siteSettings = SiteSettings.Load();
         if (siteSettings == null)
         {
             siteSettings = new SiteSettings();
         }
         return siteSettings;
     }
                                                   , CACHE_DC_SITE_SETTINGS, CacheLength.GetLongCacheTime, CacheItemPriority.AboveNormal));
 }
コード例 #6
0
ファイル: PageCache.cs プロジェクト: zahedbri/dashcommerce-3
 /// <summary>
 /// Gets the page by ID.
 /// </summary>
 /// <returns></returns>
 public static Page GetDefaultPage()
 {
     return(CacheHelper.CacheObject <Page>(delegate {
         Page pageItem = new PageController().FetchDefaultPage();
         if (pageItem != null)
         {
             return !pageItem.IsNew ? pageItem : null;
         }
         else
         {
             return null;
         }
     }, string.Format(CACHE_PAGE_ITEM, "Default"), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #7
0
        public int pay_id           = 0;//支付渠道id
        #endregion

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="interfaceId">通道ID</param>
        public ConfigMonitor(int interfaceId)
        {
            #region 获取支付宝接口信息
            var zfbjkhc = "ZFBjkhc_monitor_" + interfaceId;//组装缓存key值
            try
            {
                if (CacheHelper.IsCache(zfbjkhc))
                {
                    var zfbpz = CacheHelper.GetCaChe(zfbjkhc).ToString();
                    if (!string.IsNullOrEmpty(zfbpz))
                    {
                        var payzf = zfbpz.Split(',');
                        private_key = payzf[1].Replace("\r", "").Replace("\n", "").Trim(); //获取缓存数据中的支付宝私钥
                        partner     = payzf[0].Replace("\r", "").Replace("\n", "").Trim(); //获取缓存数据中的支付宝账号
                    }
                }
                else
                {
                    var zf  = new JMP.BLL.jmp_interface();
                    var str = zf.strzf_monitor(interfaceId);
                    if (!string.IsNullOrEmpty(str))
                    {
                        var payzf = str.Split(',');
                        partner     = payzf[0].Replace("\r", "").Replace("\n", "").Trim(); //获取支付宝账号
                        private_key = payzf[1].Replace("\r", "").Replace("\n", "").Trim(); //获取支付宝私钥
                        CacheHelper.CacheObject(zfbjkhc, str, 1);                          //存入缓存
                    }
                }
            }
            catch (Exception e)
            {
                var bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString();//报错信息
                //AddLocLog.AddLog(1, 4, "", "支付宝支付接口错误通道ID:" + interfaceId, bcxx);//写入报错日志
                PayApiGlobalErrorLogger.Log(bcxx, summary: "支付宝支付接口错误通道ID:" + interfaceId);
                throw;
            }

            #endregion

            seller_id = partner;
            //public_key = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";

            public_key = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB";

            input_charset = "utf-8";
            sign_type     = "RSA";
        }
コード例 #8
0
ファイル: AppUsers.cs プロジェクト: yohairosen/snoopi-backend
 public static string AppUserNameForNotification(Int64 AppUserId)
 {
     return(CacheHelper.CacheObject <string>(() =>
     {
         Query qry = Query.New <AppUser>()
                     .Select(AppUser.Columns.FirstName)
                     .AddSelect(AppUser.Columns.Email)
                     .Where(AppUser.Columns.AppUserId, AppUserId);
         using (DataReaderBase reader = qry.ExecuteReader())
         {
             if (reader.Read())
             {
                 string name = reader.GetStringOrEmpty(0);
                 if (name.Length > 0)
                 {
                     return name;
                 }
                 return reader.GetStringOrEmpty(1);
             }
         }
         return @"";
     }, @"AUName_" + AppUserId, 120));
 }
コード例 #9
0
 /// <summary>
 /// Gets the categories for that product id.
 /// </summary>
 /// <param name="productID">The product ID.</param>
 /// <returns></returns>
 public static CategoryCollection FetchAssociatedCategoriesByProductId(int productID)
 {
     return(CacheHelper.CacheObject <CategoryCollection>(delegate { return new ProductController().FetchAssociatedCategoriesByProductId(productID); },
                                                         string.Format(CACHE_CATEGORY_PRODUCT_CRUMBS, productID), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #10
0
 /// <summary>
 /// Gets the category bedcrumbs.
 /// </summary>
 /// <param name="categoryID">The category ID.</param>
 /// <returns></returns>
 public static DataSet FetchCategoryBreadCrumbs(int categoryID)
 {
     return(CacheHelper.CacheObject <DataSet>(delegate { return new CategoryController().FetchCategoryBreadCrumbs(categoryID); },
                                              string.Format(CACHE_CATEGORY_CRUMBS, categoryID), CacheLength.GetDefaultCacheTime, CacheItemPriority.Normal));
 }
コード例 #11
0
 /// <summary>
 /// Gets the category info.
 /// </summary>
 /// <param name="categoryID">The category ID.</param>
 /// <returns></returns>
 public static Category GetCategoryInfo(int categoryID)
 {
     return(CacheHelper.CacheObject <Category>(delegate { return new Category(categoryID); },
                                               string.Format(CACHE_CATEGORY_BYID, categoryID), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #12
0
 /// <summary>
 /// Gets a MostPopularProducts.
 /// </summary>
 /// <returns></returns>
 public static MailSettings GetMailSettings()
 {
     return(CacheHelper.CacheObject <MailSettings>(delegate { return MailSettings.Load(); }, CACHE_MAILSETTINGS, CacheLength.GetDefaultCacheTime, CacheItemPriority.Default));
 }
コード例 #13
0
 /// <summary>
 /// Gets a CrossSell ProductCollection for the specified product.
 /// </summary>
 /// <param name="productId">The product Id.</param>
 /// <returns></returns>
 public static ProductCollection GetCrossSellCollectionByProduct(int productId)
 {
     return(CacheHelper.CacheObject <ProductCollection>(delegate { return new ProductController().FetchProductCrossSells(productId); },
                                                        string.Format(CACHE_CROSSSELLCOLLECTION, productId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #14
0
 /// <summary>
 /// Gets the products by category id manufacture.
 /// </summary>
 /// <param name="categoryId">The category id.</param>
 /// <param name="manufacturerId">The manufacturer id.</param>
 /// <returns></returns>
 public static ProductCollection GetProductsByCategoryIdManufacture(int categoryId, int manufacturerId)
 {
     return(CacheHelper.CacheObject <ProductCollection>(delegate { return new ProductController().FetchProductsByCategoryIdAndManufacturerId(categoryId, manufacturerId); },
                                                        string.Format(CACHE_PRODUCTCOLLECTION_CAT_MAN, categoryId, manufacturerId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #15
0
 /// <summary>
 /// Gets a MostPopularProducts.
 /// </summary>
 /// <returns></returns>
 public static ProductCollection GetMostPopularProducts()
 {
     return(CacheHelper.CacheObject <ProductCollection>(delegate { return new ProductController().FetchMostPopularProducts(); },
                                                        CACHE_MOST_POPULAR_PRODUCTS, CacheLength.GetDefaultCacheTime, CacheItemPriority.Default));
 }
コード例 #16
0
 /// <summary>
 /// Gets a SKU specified.
 /// </summary>
 /// <returns></returns>
 public static Sku GetSKU(string sku)
 {
     return(CacheHelper.CacheObject <Sku>(delegate { return new Sku(Sku.Columns.SkuX, sku); },
                                          string.Format(CACHE_SKU, sku), CacheLength.GetShortCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #17
0
 /// <summary>
 /// Gets a AssociatedAttributeCollection for the specified product.
 /// </summary>
 /// <param name="productId">The Product.</param>
 /// <returns></returns>
 public static AssociatedAttributeCollection GetAssociatedAttributeCollectionByProduct(int productId)
 {
     return(CacheHelper.CacheObject <AssociatedAttributeCollection>(delegate { return new ProductController().FetchAssociatedAttributesByProductId(productId); },
                                                                    string.Format(CACHE_ASSOCIATED_ATTRIBUTECOLLECTION, productId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #18
0
 /// <summary>
 /// Gets a ImageCollection for the specified product.
 /// </summary>
 /// <param name="product">The Product.</param>
 /// <returns></returns>
 public static ImageCollection GetImageCollectionByProduct(Product product)
 {
     return(CacheHelper.CacheObject <ImageCollection>(delegate { return product.ImageRecords(); },
                                                      string.Format(CACHE_IMAGECOLLECTION, product.ProductId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #19
0
 /// <summary>
 /// Gets all the site categores
 /// </summary>
 public static CategoryCollection AllCategories()
 {
     return(CacheHelper.CacheObject <CategoryCollection>(delegate { return new CategoryController().FetchAll(); }, CACHE_CATEGORYCOLLECTION, CacheLength.GetDefaultCacheTime, CacheItemPriority.Normal));
 }
コード例 #20
0
 /// <summary>
 /// Gets the page menu.
 /// </summary>
 /// <returns></returns>
 public static string GetCategoryMenu()
 {
     return(CacheHelper.CacheObject <string>(delegate { return new CategoryController().FetchCategoryList().GetXml(); },
                                             CACHE_CATEGORY, CacheLength.GetLongCacheTime, CacheItemPriority.High));
 }
コード例 #21
0
 /// <summary>
 /// Gets a ReviewCollection for the specified product.
 /// </summary>
 /// <param name="productId">The productId.</param>
 /// <returns></returns>
 public static ReviewCollection GetReviewCollectionByProductID(int productId)
 {
     return(CacheHelper.CacheObject <ReviewCollection>(delegate { return new ReviewController().FetchByProductIdAndIsApproved(productId); },
                                                       string.Format(CACHE_REVIEWCOLLECTION, productId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #22
0
 /// <summary>
 /// Gets the products by category id price range.
 /// </summary>
 /// <param name="categoryId">The category id.</param>
 /// <param name="priceStart">The price start.</param>
 /// <param name="priceEnd">The price end.</param>
 /// <returns></returns>
 public static ProductCollection GetProductsByCategoryIdPriceRange(int categoryId, Decimal priceStart, Decimal priceEnd)
 {
     return(CacheHelper.CacheObject <ProductCollection>(delegate { return new ProductController().FetchProductsByCategoryIdAndPriceRange(categoryId, priceStart, priceEnd); },
                                                        string.Format(CACHE_PRODUCTCOLLECTION_CAT_PRANGE, categoryId, priceStart, priceEnd), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #23
0
 /// <summary>
 /// Gets a DescriptorCollection for the specified product.
 /// </summary>
 /// <param name="product">The product.</param>
 /// <returns></returns>
 public static DescriptorCollection GetDescriptorCollectionByProduct(Product product)
 {
     return(CacheHelper.CacheObject <DescriptorCollection>(delegate { return product.DescriptorRecords(); },
                                                           string.Format(CACHE_DISCRIPTORCOLLECTION, product.ProductId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal));
 }
コード例 #24
0
ファイル: Lookups.cs プロジェクト: jafferyjee/ProjectX
 public static SelectList SubInventoryLookup()
 {
     return(CacheHelper.CacheObject <SelectList>(delegate { return new SelectList(GetSubInventory(), "SubInvCode", "SubInvName"); },
                                                 CACHE_SUBINV, CacheLength.GetLongCacheTime, System.Web.Caching.CacheItemPriority.Normal));
 }
コード例 #25
0
 /// <summary>
 /// Gets the page menu.
 /// </summary>
 /// <returns></returns>
 public static string GetPageMenu()
 {
     return(CacheHelper.CacheObject <string>(delegate {
         return new PageController().FetchPageList().GetXml();
     }, CACHE_PAGEMENU, CacheLength.GetLongCacheTime, CacheItemPriority.AboveNormal));
 }