Example #1
0
        private void loadProduct(int productID)
        {
            ProductBL productBL = new ProductBL();
            Product product = productBL.GetProduct(productID, string.Empty, false);

            lblProductID.Value = product.ProductID.ToString();
            txtCode.Text = product.Code;
            txtSupplierCode.Text = product.SupplierCode;
            txtName.Text = product.Name;
            cmbBrand.SelectedValue = cmbBrand.Items.FindByValue(product.Brand.BrandID.ToString()).Value;
            txtDescription.Text = product.Description;
            txtPrice.Text = string.Format("{0:N2}", product.Price);
            txtWebPrice.Text = string.Format("{0:N2}", product.WebPrice);
            txtInsertDate.Text = product.InsertDate.ToString();
            txtUpdateDate.Text = product.UpdateDate.ToString();
            cmbVat.SelectedValue = cmbVat.Items.FindByValue(product.VatID.ToString()).Value;
            cmbSupplier.SelectedValue = cmbSupplier.Items.FindByValue(product.SupplierID.ToString()).Value;
            chkApproved.Checked = product.IsApproved;
            chkActive.Checked = product.IsActive;
            chkLocked.Checked = product.IsLocked;
            chkInStock.Checked = product.IsInStock;
            txtEan.Text = product.Ean;
            txtSpecification.Text = product.Specification;
            Page.Title = product.Name + " | Admin panel";
            ViewState.Add("pageTitle", Page.Title);

            if (product.Promotion != null)
            {
                cmbPromotions.SelectedValue = cmbPromotions.Items.FindByValue(product.Promotion.PromotionID.ToString()).Value;
                txtPromotionPrice.Text = product.Promotion.Price.ToString();
            }

            if (product.Categories != null)
            {
                cmbCategory.SelectedValue = cmbCategory.Items.FindByValue(product.Categories[0].CategoryID.ToString()).Value;
                createControls();
                int i = 0;
                if (product.Attributes != null)
                {
                    int attributeID = -1;
                    foreach (object control in pnlAttributes.Controls)
                    {
                        if (control is Literal)
                        {
                            int.TryParse(((Literal)control).Text, out attributeID);
                        }
                        if (control is customControls.AttributeControl)
                        {
                            int index;
                            if ((index = hasAttribute(product.Attributes, attributeID)) > -1)
                                ((customControls.AttributeControl)control).AttributeValueID = product.Attributes[index].AttributeValueID;
                            else
                                ((customControls.AttributeControl)control).AttributeValue = "NP";
                        }
                    }
                }
            }

            if (product.Images != null)
            {
                ViewState.Add("images", product.Images);
                loadImages();

                string imageUrl = product.Images[0].Substring(0, product.Images[0].IndexOf(".jpg"));
                imgProduct.ImageUrl = createImageUrl(imageUrl, "");
                imgHome.ImageUrl = createImageUrl(imageUrl, "home");
                imgLarge.ImageUrl = createImageUrl(imageUrl, "large");
                imgThumb.ImageUrl = createImageUrl(imageUrl, "thumb");
            }
            /*rptImages.DataSource = product.Images;
            rptImages.DataBind();*/
        }
Example #2
0
        private void loadProduct(int productID)
        {
            ProductBL productBL = new ProductBL();
            Product product = productBL.GetProduct(productID, string.Empty, true);

            //images = product.Images;
            priProductImages.Images = product.Images;
            priProductImages.ShowImages();

            lblBrand.Text = product.Brand.Name;
            lblName.Text = product.Name;
            lblNamePrimary.Text = product.Name;
            lblDescription.Text = product.Description;
            lblPrice.Text = "MP cena: " + string.Format("{0:N2}", product.Price) + " din";
            lblWebPrice.Text = (product.Promotion == null) ? string.Format("{0:N2}", product.WebPrice) + " din" : string.Format("{0:N2}", product.Promotion.Price) + " din";
            lblSaving.Text = "Ušteda: " + string.Format("{0:N2}", product.Price - double.Parse(lblWebPrice.Text.Substring(0, lblWebPrice.Text.IndexOf(" din")))) + " din";
            lblSpecification.Text = (product.Specification != null) ? (!product.Specification.Contains("<table class='table table-striped'><tbody></table>") ? product.Specification : "Nema podataka") : "Nema podataka";
            lblDescription.Text = product.Description;
            if (product.Promotion != null)
            {
                imgPromotion.ImageUrl = "/images/" + product.Promotion.ImageUrl;
                imgPromotion.Visible = true;
            }
            lblProductID.Value = product.ProductID.ToString();
            Page.Title = product.Brand.Name + " " + product.Name;
            ViewState.Add("pageTitle", Page.Title);
            ViewState.Add("productDescription", product.Description);
            ViewState.Add("image", product.Images != null ? product.Images[0] : string.Empty);

            lnkCategory.NavigateUrl = "/proizvodi/" + product.Categories[0].Url;
            lnkCategory.Text = product.Categories[0].Name;
            ViewState["productUrl"] = product.Url;
            loadProductSliders(product.Brand, product.Categories[0]);
        }
Example #3
0
        private void loadProduct(int productID)
        {
            ProductBL productBL = new ProductBL();
            Product product = productBL.GetProduct(productID, string.Empty);

            //images = product.Images;
            priProductImages.Images = product.Images;
            priProductImages.ShowImages();

            lblBrand.Text = product.Brand.Name;
            lblName.Text = product.Name;
            lblDescription.Text = product.Description;
            lblPrice.Text = "MP cena: " + string.Format("{0:N2}", product.Price) + " din";
            lblWebPrice.Text = string.Format("{0:N2}", product.WebPrice) + " din";
            lblSaving.Text = "Ušteda: " + string.Format("{0:N2}", product.Price - product.WebPrice) + " din";
            lblSpecification.Text = !product.Specification.Contains("<table class='table table-striped'><tbody></table>") ? product.Specification : "Nema podataka";
            lblDescription.Text = product.Description;
            if (product.Promotion != null)
            {
                imgPromotion.ImageUrl = "/images/" + product.Promotion.ImageUrl;
                imgPromotion.Visible = true;
            }
            lblProductID.Value = product.ProductID.ToString();
            Page.Title = product.Brand.Name + " " + product.Name;
            ViewState.Add("pageTitle", Page.Title);
            ViewState.Add("productDescription", product.Description);
            ViewState.Add("image", product.Images[0]);
        }