public bool UpdateProductCount(int CategoryLevel, int CategoryID) { var svProduct = new Product.ProductService(); if (CategoryLevel == 3) { var sqlWhere = svProduct.CreateWhereAction(ProductAction.FrontEnd) + "AND CateLV3 = " + CategoryID; var count = CountData <view_SearchProduct>(" * ", sqlWhere); var sqlUpdate = " ProductCount = " + count; sqlWhere = "CategoryLevel = 3 AND CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } else if (CategoryLevel == 2) { var sqlUpdate = " ProductCount = (Select SUM(ProductCount) from b2bCategory where ParentCategoryID = " + CategoryID + " ) "; var sqlWhere = " CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } else if (CategoryLevel == 1) { var sqlUpdate = " ProductCount = (Select SUM(ProductCount) from b2bCategory where ParentCategoryID = " + CategoryID + " ) "; var sqlWhere = " CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } return(IsResult); }
public bool UpdateProductCount(int CompID) { var svProduct = new Product.ProductService(); var sqlWhere = svProduct.CreateWhereAction(ProductAction.FrontEnd, CompID); var count = CountData <view_SearchProduct>(" * ", sqlWhere); var svCompany = new Company.CompanyService(); IsResult = svCompany.UpdateByCondition <b2bCompany>(" ProductCount = " + count, "CompID = " + CompID); return(IsResult); }
public ActionResult GetRelateSupplier(List <int> compid, string textsearch) { var svProduct = new Product.ProductService(); var products = new List <view_SearchProduct>(); foreach (var item in compid) { var where = string.Empty; where = " IsDelete = 0 AND RowFlag IN (4,5,6) "; where = where + svProduct.CreateWhereCause(item, textsearch); var data = svProduct.SelectData <view_SearchProduct>(" ProductID,CompID,CompName,ProductName,ProductImgPath ", where, null, 1, 4); foreach (var p in data) { products.Add(p); } } return(Json(products)); }