Example #1
0
 /// <summary>
 /// delete product by productId
 /// </summary>
 /// <param name="productId"></param>
 /// <param name="sentToLuceneIndex"></param>
 /// <returns></returns>
 public static bool DeleteProduct(int productId, bool sentToLuceneIndex)
 {
     PhotoService.DeletePhotos(productId, PhotoType.Product);
     DeleteRelatedProducts(productId);
     SQLDataAccess.ExecuteNonQuery("[Catalog].[sp_DeleteProduct]", CommandType.StoredProcedure, new SqlParameter("@ProductID", productId));
     CategoryService.ClearCategoryCache();
     if (sentToLuceneIndex)
     {
         LuceneSearch.ClearLuceneIndexRecord(productId);
     }
     return(true);
 }
Example #2
0
        /// <summary>
        /// delete category and photo of category
        /// </summary>
        /// <param name="categoryId"></param>
        public static void DeleteCategoryAndPhotos(int categoryId)
        {
            foreach (var id in DeleteCategory(categoryId, true))
            {
                PhotoService.DeletePhotos(id, PhotoType.CategoryBig);
                PhotoService.DeletePhotos(id, PhotoType.CategorySmall);
            }

            var cacheName = CacheNames.GetBottomMenuCacheObjectName();

            if (CacheManager.Contains(cacheName))
            {
                CacheManager.Remove(cacheName);
            }
        }
Example #3
0
        public static void AddProductPhotoByProductId(int productId, string fullfilename, string description, bool isMain)
        {
            if (string.IsNullOrWhiteSpace(fullfilename) || (!IsExists(productId)))
            {
                return;
            }

            var tempName = PhotoService.AddPhoto(new Photo(0, productId, PhotoType.Product)
            {
                Description    = description,
                OriginName     = Path.GetFileName(fullfilename),
                PhotoSortOrder = 0
            });

            if (string.IsNullOrWhiteSpace(tempName))
            {
                return;
            }
            using (var image = Image.FromFile(fullfilename))
            {
                FileHelpers.SaveProductImageUseCompress(tempName, image);
            }
        }
Example #4
0
 public static void DeleteBrandLogo(int brandId)
 {
     PhotoService.DeletePhotos(brandId, PhotoType.Brand);
 }