private void loadCategory(int categoryID) { CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); txtName.Text = category.Name; txtUrl.Text = category.Url; txtImageUrl.Text = category.ImageUrl; cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value; txtSortOrder.Text = category.SortOrder.ToString(); lblCategoryID.Value = category.CategoryID.ToString(); txtPricePercent.Text = category.PricePercent.ToString(); txtWebPricePercent.Text = category.WebPricePercent.ToString(); chkShowOnFirstPage.Checked = category.ShowOnFirstPage; txtNumber.Text = category.NumberOfProducts.ToString(); txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString(); if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null) cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value; setFirstPageControls(category.ShowOnFirstPage); Page.Title = category.Name + " | Admin panel"; ViewState.Add("pageTitle", Page.Title); txtDescription.Text = category.Description; chkActive.Checked = category.Active; if(category.Slider != null) { cmbSlider.SelectedValue = category.Slider.SliderID.ToString(); } if (lblCategoryID.Value != string.Empty) { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID); dgvAttributes.DataBind(); } }
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."; }