public int UpdatePriceAndStock(int productID, double price, double webPrice, bool isInStock) { ProductDL productDL = new ProductDL(); return productDL.UpdatePriceAndStock(productID, price, webPrice, isInStock); }
public int SetLocked(int productID, bool isLocked) { ProductDL productDL = new ProductDL(); return productDL.SetLocked(productID, isLocked); }
public int DeleteProduct(int productID) { ProductDL productDL = new ProductDL(); return productDL.DeleteProduct(productID); }
public string parseProductsStockPrice(string eweCategory, string[] eweSubcategories, int categoryID, int supplierID) { EweDL eweDL = new EweDL(); ProductDL productDL = new ProductDL(); CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); productDL.SetInStock(supplierID, false, categoryID); int status = 0; for (int i = 0; i < eweSubcategories.Length; i++) { XmlDocument xmlDoc = eweDL.GetXml(eweCategory, eweSubcategories[i], false, false); XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("product"); foreach (XmlNode xmlNode in nodeList) { string supplierCode = xmlNode.SelectSingleNode("id").InnerText.Trim(); int productID; if ((productID = productDL.GetProductIDBySupplierCode(supplierCode)) > 0) { if (!productDL.IsLocked(productID)) { double price = calculatePrice(double.Parse(xmlNode.SelectSingleNode("price").InnerText.Replace('.', ',').Trim()), category.PricePercent); double webPrice = calculatePrice(double.Parse(xmlNode.SelectSingleNode("price").InnerText.Replace('.', ',').Trim()), category.WebPricePercent); status += productDL.UpdatePriceAndStock(productID, price, webPrice, true); } } } } return "Uspešno izmenjeno " + status.ToString() + " artikala."; }
public Product GetProduct(int productID, string url) { ProductDL productDL = new ProductDL(); return productDL.GetProduct(productID, url); }
public int GetProductIDBySupplierCode(string supplierCode) { ProductDL productDL = new ProductDL(); return productDL.GetProductIDBySupplierCode(supplierCode); }
public List<Product> GetProducts(int categoryID, int supplierID, string isApprovedName, string isActiveName, int? brandID, int? promotionID) { ProductDL productDL = new ProductDL(); return productDL.GetProducts(categoryID, supplierID, getApproved(isApprovedName), getActive(isActiveName), brandID, promotionID); }
public bool IsLocked(int productID) { ProductDL productDL = new ProductDL(); return productDL.IsLocked(productID); }
public int SaveProduct(Product product) { ProductDL productDL = new ProductDL(); if (product.ProductID > 0) { product.UpdateDate = DateTime.Now.ToUniversalTime(); return productDL.UpdateProduct(product); } else { product.InsertDate = DateTime.Now.ToUniversalTime(); product.UpdateDate = DateTime.Now.ToUniversalTime(); return productDL.SaveProduct(product); } }
public List<Product> GetProductsForFirstPage(int categoryID, int numberOfProducts, string orderBy) { ProductDL productDL = new ProductDL(); switch (orderBy) { case "Novi": { orderBy = "insertDate DESC"; break; } case "Ceni": { orderBy = "webPrice"; break; } case "Slučajni": { orderBy = "NEWID()"; break; } } return productDL.GetProductsForFirstPage(categoryID, numberOfProducts, orderBy); }
public List<Product> GetProductsForPromotion(int promotionID) { ProductDL productDL = new ProductDL(); return productDL.GetProductsForPromotion(promotionID); }
public List<Product> GetProductsForCategory(int categoryID) { ProductDL productDL = new ProductDL(); return productDL.GetProductsForCategory(categoryID); }
public bool SaveProductFromExternalApplication(string barcode, string name, double quantity, double price) { Product product = new ProductDL().GetProduct(-1, string.Empty, false, barcode); if(product != null) { product.Name = name; product.Price = price; product.WebPrice = price; product.IsInStock = quantity > 0; } else { product = new Product(); product.Code = barcode; product.Name = name; product.Price = price; product.WebPrice = price; product.Brand = new Brand(0, "Nepoznat"); product.Categories = new List<Category>(); product.Categories.Add(new Category(0, "Nepoznat", null, string.Empty, string.Empty, 0, 0, 0, string.Empty, -1)); product.Description = string.Empty; product.Ean = string.Empty; product.Images = new List<string>(); product.Images.Add("000.jpg"); product.IsActive = false; product.IsApproved = false; product.IsInStock = quantity > 0; product.IsLocked = false; product.Specification = string.Empty; product.SupplierCode = string.Empty; product.SupplierID = 0; product.VatID = 4; } int status = SaveProduct(product); return status > 0; }
public List<Product> GetProductsForCategory(int categoryID, bool isActive, bool isApproved) { ProductDL productDL = new ProductDL(); return productDL.GetProductsForCategory(categoryID, isActive, isApproved); }
public List<Product> GetAllProducts() { ProductDL productDL = new ProductDL(); return productDL.GetAllProducts(); }
public int SetActive(int productID, bool isActive) { ProductDL productDL = new ProductDL(); return productDL.SetActive(productID, isActive); }
public Product GetProduct(int productID, string url, bool count) { ProductDL productDL = new ProductDL(); return productDL.GetProduct(productID, url, count); }
public int SetApproved(int productID, bool isApproved) { ProductDL productDL = new ProductDL(); return productDL.SetApproved(productID, isApproved); }
/*public List<Product> GetProduct(string code) { ProductDL productDL = new ProductDL(); return productDL.GetProduct(code); }*/ public List<Product> GetProducts(List<AttributeValue> attributes) { ProductDL productDL = new ProductDL(); return productDL.GetProducts(attributes); }
public int SetInStock(int supplierID, bool inStock, int categoryID) { ProductDL productDL = new ProductDL(); return productDL.SetInStock(supplierID, inStock, categoryID); }
public List<Product> GetProducts(string categoryUrl, List<string> brandsID, List<AttributeValue> attributeValues, string sortName, string priceFrom, string priceTo) { /*string sort = string.Empty; switch (sortString) { case "Nazivu": { sort = " brand.name"; break; } case "Ceni opadajuće": { sort = " product.price DESC"; break; } case "Ceni rastuće": { sort = " product.price"; break; } }*/ CategoryDL categoryDL = new CategoryDL(); Category category = categoryDL.GetCategoryByUrl(categoryUrl); ProductDL productDL = new ProductDL(); return productDL.GetProducts(category.CategoryID, brandsID, attributeValues, getSort(sortName), getPrice(priceFrom), getPrice(priceTo)); }
public int SetIsInStock(int productID, bool isInStock) { ProductDL productDL = new ProductDL(); return productDL.SetIsInStock(productID, isInStock); }
public DataTable parseProductsToDataTable(string category, string[] subcategories) { EweDL eweDL = new EweDL(); DataTable products = new DataTable(); products.Columns.Add("code"); products.Columns.Add("ean"); products.Columns.Add("manufacturer"); products.Columns.Add("name"); products.Columns.Add("price", typeof(double)); products.Columns.Add("exists", typeof(bool)); ProductDL productDL = new ProductDL(); DataRow newRow; for (int i = 0; i < subcategories.Length; i++) { XmlDocument xmlDoc = eweDL.GetXml(category, subcategories[i], false, false); if (xmlDoc != null) { XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("product"); foreach (XmlNode xmlNode in nodeList) { newRow = products.NewRow(); foreach (XmlNode xmlChildNode in xmlNode.ChildNodes) { switch (xmlChildNode.Name) { case "id": { newRow["code"] = xmlChildNode.InnerText.Trim(); break; } case "ean": { newRow["ean"] = xmlChildNode.InnerText.Trim(); break; } case "manufacturer": { newRow["manufacturer"] = xmlChildNode.InnerText.Trim(); break; } case "name": { newRow["name"] = xmlChildNode.InnerText.Trim(); break; } case "price": { newRow["price"] = xmlChildNode.InnerText.Trim().Replace('.', ','); break; } } } newRow["exists"] = (productDL.GetProductIDBySupplierCode(newRow["code"].ToString()) > 0) ? true : false; products.Rows.Add(newRow); } } } return products; }
public bool SaveProduct(string code, bool isActive, bool isApproved, int categoryID, int kimtecCategoryID) { //int newProducts = 0; //int updatedProducts = 0; DataTable kimtecProduct = new KimtecDL().GetProductBySupplierCode(code); Category category = new CategoryDL().GetCategory(categoryID); Product product = new Product(); product.IsApproved = isApproved; product.IsActive = isActive; product.SupplierID = 1004; product.SupplierCode = code; product.VatID = 4; product.Categories = new List<Category>(); product.Categories.Add(category); product.Specification = string.Empty; product.IsInStock = true; bool isNew = false; bool isLocked = false; product.Code = code; product.ProductID = new ProductDL().GetProductIDBySupplierCode(code); if (product.ProductID <= 0) isNew = true; isLocked = new ProductDL().IsLocked(product.ProductID); Brand brand = new BrandDL().GetBrandByName(kimtecProduct.Rows[0]["brand"].ToString()); if(brand == null) { brand = new Brand(); brand.Name = kimtecProduct.Rows[0]["brand"].ToString(); brand.BrandID = new BrandDL().SaveBrand(brand); } if (product.Brand == null) product.Brand = new Brand(); product.Brand = brand; product.Name = kimtecProduct.Rows[0]["name"].ToString(); product.Price = calculatePrice(double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString()), category.PricePercent); product.WebPrice = calculatePrice(double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString()), category.WebPricePercent); product.Ean = kimtecProduct.Rows[0]["barcodeValue"].ToString(); product.SupplierPrice = double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString()); product.Images = new List<string>(); product.Images.Add(saveProductImage(kimtecProduct.Rows[0]["imageUrl"].ToString())); product.Attributes = GetProductAttributes(code, kimtecCategoryID); product.Description = kimtecProduct.Rows[0]["marketingDescription"].ToString(); if (!isLocked) if (new ProductBL().SaveProduct(product) > 0) return true; return false; //return new int[] { newProducts, updatedProducts }; }