public bool UpdateProductCountInCategories(List <int> CateLV1, List <int> CateLV2, List <int> CateLV3)
        {
            var svCategory = new Category.CategoryService();

            var lstCateLV1 = CateLV1.Distinct();
            var lstCateLV2 = CateLV2.Distinct();
            var lstCateLV3 = CateLV3.Distinct();

            foreach (var it in lstCateLV3)
            {
                IsResult = svCategory.UpdateProductCount(3, it);
            }

            foreach (var it in lstCateLV2)
            {
                IsResult = svCategory.UpdateProductCount(2, it);
            }

            foreach (var it in lstCateLV1)
            {
                IsResult = svCategory.UpdateProductCount(1, it);
            }

            return(IsResult);
        }
        public bool MoveProductInCateLV(int oldcatelv1, int oldcatelv2, int oldcatelv3, int newcatelv1, int newcatelv2, int newcatelv3)
        {
            var svCategory = new Category.CategoryService();

            using (var trans = new TransactionScope())
            {
                MoveProductInCate(3, oldcatelv3, newcatelv3, oldcatelv3);
                MoveProductInCate(2, oldcatelv2, newcatelv2, newcatelv3);
                MoveProductInCate(1, oldcatelv1, newcatelv1, newcatelv3);

                trans.Complete();
                IsResult = true;
            }

            using (var trans = new TransactionScope())
            {
                #region Update Product Count

                svCategory.UpdateProductCount(3, oldcatelv3);
                svCategory.UpdateProductCount(2, oldcatelv2);
                svCategory.UpdateProductCount(1, oldcatelv1);
                svCategory.UpdateProductCount(3, newcatelv3);
                svCategory.UpdateProductCount(2, newcatelv2);
                svCategory.UpdateProductCount(1, newcatelv1);

                #endregion

                trans.Complete();
                IsResult = true;
            }

            return(IsResult);
        }
Beispiel #3
0
        public bool UpdateBuyleadCountInCategories(int CateLV1, int CateLV2, int CateLV3)
        {
            var svCategory = new Category.CategoryService();

            IsResult = svCategory.UpdateBuyleadCount(3, CateLV3);

            IsResult = svCategory.UpdateBuyleadCount(2, CateLV2);

            IsResult = svCategory.UpdateBuyleadCount(1, CateLV1);

            return(IsResult);
        }
        public bool UpdateProductCountInCategories(int CateLV1, int CateLV2, int CateLV3)
        {
            var svCategory = new Category.CategoryService();

            if (CateLV3 != 0)
            {
                IsResult = svCategory.UpdateProductCount(3, CateLV3);
            }
            if (CateLV1 != 0)
            {
                IsResult = svCategory.UpdateProductCount(2, CateLV2);
            }
            if (CateLV2 != 0)
            {
                IsResult = svCategory.UpdateProductCount(1, CateLV1);
            }
            return(IsResult);
        }
Beispiel #5
0
        public bool Delete(List <int> BuyleadID, List <int> CateLV1, List <int> CateLV2, List <int> CateLV3, int CompID = 0)
        {
            var svCompany  = new Company.CompanyService();
            var svCategory = new Category.CategoryService();

            var sqlWhere = SQLWhereListInt(BuyleadID, "BuyleadID");

            if (CompID > 0)
            {
                sqlWhere += " AND CompID = " + CompID;
            }

            UpdateByCondition <b2bBuylead>(" IsDelete = 1   , ListNo = 0 ", sqlWhere);

            if (CompID > 0)
            {
                IsResult = svCompany.UpdateBuyleadCount(CompID);
            }
            UpdateBuyleadCountInCategories(CateLV1, CateLV2, CateLV3);

            return(IsResult);
        }
        public bool Delete(int ProductID, int CateLV1, int CateLV2, int CateLV3, int CompID = 0)
        {
            var svCompany  = new Company.CompanyService();
            var svCategory = new Category.CategoryService();

            var sqlWhere = "ProductID = " + ProductID;

            if (CompID > 0)
            {
                sqlWhere += " AND CompID = " + CompID;
            }

            UpdateByCondition <b2bProduct>(" ModifiedDate  = GETDATE()  , IsDelete = 1   , ListNo = 0  ", sqlWhere);
            if (CompID > 0)
            {
                IsResult = svCompany.UpdateProductCount(CompID);
            }
            UpdateProductCountInCategories(CateLV1, CateLV2, CateLV3);
            UpdateProductCountInCompany(CompID);


            return(IsResult);
        }