public static bool AddSubjectProduct(int tagId, int productId)
        {
            IList <int> list = new List <int>();

            list.Add(productId);
            return(SubsiteProductProvider.Instance().AddSubjectProducts(tagId, list));
        }
 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);
 }
        public static bool AddSubjectProduct(SubjectType subjectType, int productId)
        {
            IList <int> productIds = new List <int>();

            productIds.Add(productId);
            return(SubsiteProductProvider.Instance().AddSubjectProducts(subjectType, productIds));
        }
Example #4
0
 public static bool UpdateProductCategory(int productId, int newCategoryId)
 {
     if (newCategoryId != 0)
     {
         return(SubsiteProductProvider.Instance().UpdateProductCategory(productId, newCategoryId, SubsiteCatalogHelper.GetCategory(newCategoryId).Path + "|"));
     }
     return(SubsiteProductProvider.Instance().UpdateProductCategory(productId, newCategoryId, null));
 }
Example #5
0
 public static bool UpdateSkuUnderlingPrices(DataSet ds, string skuIds)
 {
     if ((ds == null) || string.IsNullOrEmpty(skuIds))
     {
         return(false);
     }
     return(SubsiteProductProvider.Instance().UpdateSkuUnderlingPrices(ds, skuIds));
 }
 public static bool AddTaobaoReturnProductIds(Dictionary <int, long> taobaoReturnProductIds, int Updatestatus)
 {
     if ((taobaoReturnProductIds == null) && (taobaoReturnProductIds.Count <= 0))
     {
         return(false);
     }
     return(SubsiteProductProvider.Instance().AddTaobaoReturnProductIds(taobaoReturnProductIds, Updatestatus));
 }
 public static bool SetCategoryThemes(int categoryId, string themeName)
 {
     if (SubsiteProductProvider.Instance().SetCategoryThemes(categoryId, themeName))
     {
         HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
     }
     return(false);
 }
 public static void SwapCategorySequence(int categoryId, int displaysequence)
 {
     if (categoryId > 0)
     {
         SubsiteProductProvider.Instance().SwapCategorySequence(categoryId, displaysequence);
         HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
     }
 }
Example #9
0
 public static bool UpdateShowSaleCounts(DataTable dt)
 {
     if ((dt == null) || (dt.Rows.Count <= 0))
     {
         return(false);
     }
     return(SubsiteProductProvider.Instance().UpdateShowSaleCounts(dt));
 }
        public static int DownloadCategory()
        {
            int num = SubsiteProductProvider.Instance().DownloadCategory();

            if (num > 0)
            {
                HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
            }
            return(num);
        }
        public static bool DeleteCategory(int categoryId)
        {
            bool flag = SubsiteProductProvider.Instance().DeleteCategory(categoryId);

            if (flag)
            {
                HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
            }
            return(flag);
        }
Example #12
0
        public static CategoryActionStatus DeleteCategory(int categoryId)
        {
            CategoryActionStatus unknowError = CategoryActionStatus.UnknowError;

            unknowError = SubsiteProductProvider.Instance().DeleteCategory(categoryId);
            if (unknowError == CategoryActionStatus.Success)
            {
                HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
            }
            return(unknowError);
        }
Example #13
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);
        }
Example #14
0
        public static bool UpdateProduct(ProductInfo product, Dictionary <string, decimal> skuSalePrice, IList <int> tagIdList)
        {
            bool flag;

            if (null == product)
            {
                return(false);
            }
            Globals.EntityCoding(product, true);
            int decimalLength = HiContext.Current.SiteSettings.DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    if (!SubsiteProductProvider.Instance().UpdateProduct(product, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!SubsiteProductProvider.Instance().AddSkuSalePrice(product.ProductId, skuSalePrice, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!DeleteProductTags(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (((tagIdList != null) && (tagIdList.Count > 0)) && !AddProductTags(product.ProductId, tagIdList, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    dbTran.Commit();
                    flag = true;
                }
                catch
                {
                    dbTran.Rollback();
                    flag = false;
                }
            }
            return(flag);
        }
 public static CategoryActionStatus AddCategory(CategoryInfo category)
 {
     if (null == category)
     {
         return(CategoryActionStatus.UnknowError);
     }
     Globals.EntityCoding(category, true);
     if (SubsiteProductProvider.Instance().CreateCategory(category) > 0)
     {
         HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
     }
     return(CategoryActionStatus.Success);
 }
Example #16
0
        public static DataSet GetExportProducts(AdvancedProductQuery query, bool includeCostPrice, bool includeStock, string removeProductIds)
        {
            DataSet set = SubsiteProductProvider.Instance().GetExportProducts(query, includeCostPrice, includeStock, removeProductIds);

            set.Tables[0].TableName = "types";
            set.Tables[1].TableName = "attributes";
            set.Tables[2].TableName = "values";
            set.Tables[3].TableName = "products";
            set.Tables[4].TableName = "skus";
            set.Tables[5].TableName = "skuItems";
            set.Tables[6].TableName = "productAttributes";
            return(set);
        }
 public static System.Data.DataSet GetExportProducts(AdvancedProductQuery query, bool includeCostPrice, bool includeStock, string removeProductIds)
 {
     System.Data.DataSet exportProducts = SubsiteProductProvider.Instance().GetExportProducts(query, includeCostPrice, includeStock, removeProductIds);
     exportProducts.Tables[0].TableName = "types";
     exportProducts.Tables[1].TableName = "attributes";
     exportProducts.Tables[2].TableName = "values";
     exportProducts.Tables[3].TableName = "products";
     exportProducts.Tables[4].TableName = "skus";
     exportProducts.Tables[5].TableName = "skuItems";
     exportProducts.Tables[6].TableName = "productAttributes";
     exportProducts.Tables[7].TableName = "taobaosku";
     return(exportProducts);
 }
        public static CategoryActionStatus UpdateCategory(CategoryInfo category)
        {
            CategoryActionStatus result;

            if (null == category)
            {
                result = CategoryActionStatus.UnknowError;
            }
            else
            {
                Globals.EntityCoding(category, true);
                CategoryActionStatus categoryActionStatus = SubsiteProductProvider.Instance().UpdateCategory(category);
                if (categoryActionStatus == CategoryActionStatus.Success)
                {
                    HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
                }
                result = categoryActionStatus;
            }
            return(result);
        }
        private static DataTable GetCategories()
        {
            DataTable categories = new DataTable();

            if (HiContext.Current.User.UserRole != UserRole.Anonymous)
            {
                categories = HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId)) as DataTable;
            }
            else
            {
                categories = HiCache.Get(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value)) as DataTable;
            }
            if (categories == null)
            {
                categories = SubsiteProductProvider.Instance().GetCategories();
                if (HiContext.Current.User.UserRole != UserRole.Anonymous)
                {
                    HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId), categories, 360, CacheItemPriority.Normal);
                    return(categories);
                }
                HiCache.Insert(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.SiteSettings.UserId.Value), categories, 360, CacheItemPriority.Normal);
            }
            return(categories);
        }
 public static bool SetProductExtendCategory(int productId, string extendCategoryPath)
 {
     return(SubsiteProductProvider.Instance().SetProductExtendCategory(productId, extendCategoryPath));
 }
        public static bool UpdateProduct(ProductInfo product, Dictionary <string, decimal> skuSalePrice, IList <int> tagIdList)
        {
            bool result;

            if (null == product)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(product, true);
                int decimalLength = HiContext.Current.SiteSettings.DecimalLength;
                if (product.MarketPrice.HasValue)
                {
                    product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
                }
                using (System.Data.Common.DbConnection dbConnection = DatabaseFactory.CreateDatabase().CreateConnection())
                {
                    dbConnection.Open();
                    System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                    try
                    {
                        if (!SubsiteProductProvider.Instance().UpdateProduct(product, dbTransaction))
                        {
                            dbTransaction.Rollback();
                            result = false;
                        }
                        else
                        {
                            if (!SubsiteProductProvider.Instance().AddSkuSalePrice(product.ProductId, skuSalePrice, dbTransaction))
                            {
                                dbTransaction.Rollback();
                                result = false;
                            }
                            else
                            {
                                if (!SubSiteProducthelper.DeleteProductTags(product.ProductId, dbTransaction))
                                {
                                    dbTransaction.Rollback();
                                    result = false;
                                }
                                else
                                {
                                    if (tagIdList != null && tagIdList.Count > 0 && !SubSiteProducthelper.AddProductTags(product.ProductId, tagIdList, dbTransaction))
                                    {
                                        dbTransaction.Rollback();
                                        result = false;
                                    }
                                    else
                                    {
                                        dbTransaction.Commit();
                                        result = true;
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                        dbTransaction.Rollback();
                        result = false;
                    }
                }
            }
            return(result);
        }
 public static int UpdateProductSaleStatus(string productIds, ProductSaleStatus saleStatus)
 {
     return(SubsiteProductProvider.Instance().UpdateProductSaleStatus(productIds, saleStatus));
 }
 public static bool IsOnSale(string productIds)
 {
     return(SubsiteProductProvider.Instance().IsOnSale(productIds));
 }
 public static DbQueryResult GetSubjectProducts(int tagId, Pagination page)
 {
     return(SubsiteProductProvider.Instance().GetSubjectProducts(tagId, page));
 }
 public static DbQueryResult GetProducts(ProductQuery query)
 {
     return(SubsiteProductProvider.Instance().GetProducts(query));
 }
 public static int DisplaceCategory(int oldCategoryId, int newCategory)
 {
     return(SubsiteProductProvider.Instance().DisplaceCategory(oldCategoryId, newCategory));
 }
 public static System.Data.DataTable GetGroupBuyProducts(ProductQuery query)
 {
     return(SubsiteProductProvider.Instance().GetGroupBuyProducts(query));
 }
 public static int DeleteProducts(string productIds)
 {
     return(SubsiteProductProvider.Instance().DeleteProducts(productIds));
 }
 public static CategoryInfo GetCategory(int categoryId)
 {
     return(SubsiteProductProvider.Instance().GetCategory(categoryId));
 }
 public static IList <ProductInfo> GetProducts(IList <int> productIds)
 {
     return(SubsiteProductProvider.Instance().GetProducts(productIds));
 }