private void BindData() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { this.txtName.Text = manufacturer.Name; this.txtDescription.Value = manufacturer.Description; CommonHelper.SelectListItem(this.ddlTemplate, manufacturer.TemplateID); Picture manufacturerPicture = manufacturer.Picture; btnRemoveManufacturerImage.Visible = manufacturerPicture != null; string pictureUrl = PictureManager.GetPictureUrl(manufacturerPicture, 100); this.iManufacturerPicture.Visible = true; this.iManufacturerPicture.ImageUrl = pictureUrl; this.txtPriceRanges.Text = manufacturer.PriceRanges; this.cbPublished.Checked = manufacturer.Published; this.txtDisplayOrder.Value = manufacturer.DisplayOrder; } else { this.btnRemoveManufacturerImage.Visible = false; this.iManufacturerPicture.Visible = false; } }
public void SaveInfo() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { foreach (GridViewRow row in gvProductManufacturerMappings.Rows) { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductID = row.FindControl("hfProductID") as HiddenField; HiddenField hfProductManufacturerID = row.FindControl("hfProductManufacturerID") as HiddenField; CheckBox cbFeatured = row.FindControl("cbFeatured") as CheckBox; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productID = int.Parse(hfProductID.Value); int productManufacturerID = int.Parse(hfProductManufacturerID.Value); bool featured = cbFeatured.Checked; int displayOrder = txtRowDisplayOrder.Value; if (productManufacturerID > 0 && !cbProductInfo.Checked) { ManufacturerManager.DeleteProductManufacturer(productManufacturerID); } if (productManufacturerID > 0 && cbProductInfo.Checked) { ManufacturerManager.UpdateProductManufacturer(productManufacturerID, productID, manufacturer.ManufacturerID, featured, displayOrder); } } } }
protected void btnSave_Click(object sender, EventArgs e) { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { ProductManufacturerCollection existingProductManufacturers = manufacturer.ProductManufacturers; foreach (GridViewRow row in gvProducts.Rows) { try { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductID = row.FindControl("hfProductID") as HiddenField; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productID = int.Parse(hfProductID.Value); int displayOrder = txtRowDisplayOrder.Value; if (cbProductInfo.Checked) { if (existingProductManufacturers.FindProductManufacturer(productID, this.ManufacturerID) == null) { ManufacturerManager.InsertProductManufacturer(productID, this.ManufacturerID, false, displayOrder); } } } catch (Exception exc) { ProcessException(exc); } } } this.Page.ClientScript.RegisterStartupScript(typeof(ManufacturerProductAddControl), "closerefresh", "<script language=javascript>try {window.opener.document.forms[0]." + this.BtnID + ".click();}catch (e){} window.close();</script>"); }
public Manufacturer SaveInfo() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { Picture manufacturerPicture = manufacturer.Picture; HttpPostedFile manufacturerPictureFile = fuManufacturerPicture.PostedFile; if ((manufacturerPictureFile != null) && (!String.IsNullOrEmpty(manufacturerPictureFile.FileName))) { byte[] manufacturerPictureBinary = PictureManager.GetPictureBits(manufacturerPictureFile.InputStream, manufacturerPictureFile.ContentLength); if (manufacturerPicture != null) { manufacturerPicture = PictureManager.UpdatePicture(manufacturerPicture.PictureID, manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } else { manufacturerPicture = PictureManager.InsertPicture(manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } } int manufacturerPictureID = 0; if (manufacturerPicture != null) { manufacturerPictureID = manufacturerPicture.PictureID; } manufacturer = ManufacturerManager.UpdateManufacturer(manufacturer.ManufacturerID, txtName.Text, txtDescription.Value, int.Parse(this.ddlTemplate.SelectedItem.Value), manufacturer.MetaKeywords, manufacturer.MetaDescription, manufacturer.MetaTitle, manufacturer.SEName, manufacturerPictureID, manufacturer.PageSize, txtPriceRanges.Text, cbPublished.Checked, manufacturer.Deleted, txtDisplayOrder.Value, manufacturer.CreatedOn, DateTime.Now); } else { Picture manufacturerPicture = null; HttpPostedFile manufacturerPictureFile = fuManufacturerPicture.PostedFile; if ((manufacturerPictureFile != null) && (!String.IsNullOrEmpty(manufacturerPictureFile.FileName))) { byte[] manufacturerPictureBinary = PictureManager.GetPictureBits(manufacturerPictureFile.InputStream, manufacturerPictureFile.ContentLength); manufacturerPicture = PictureManager.InsertPicture(manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } int manufacturerPictureID = 0; if (manufacturerPicture != null) { manufacturerPictureID = manufacturerPicture.PictureID; } DateTime nowDt = DateTime.Now; manufacturer = ManufacturerManager.InsertManufacturer(txtName.Text, txtDescription.Value, int.Parse(this.ddlTemplate.SelectedItem.Value), string.Empty, string.Empty, string.Empty, string.Empty, manufacturerPictureID, 10, txtPriceRanges.Text, cbPublished.Checked, false, txtDisplayOrder.Value, nowDt, nowDt); } return(manufacturer); }
private void BindData() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { ProductManufacturerCollection existingProductManufacturerCollection = manufacturer.ProductManufacturers; List <ProductManufacturerMappingHelperClass> productManufacturerMappings = GetProductManufacturerMappings(existingProductManufacturerCollection); gvProductManufacturerMappings.DataSource = productManufacturerMappings; gvProductManufacturerMappings.DataBind(); } }
public void SaveInfo() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { manufacturer = ManufacturerManager.UpdateManufacturer(manufacturer.ManufacturerID, manufacturer.Name, manufacturer.Description, manufacturer.TemplateID, txtMetaKeywords.Text, txtMetaDescription.Text, txtMetaTitle.Text, txtSEName.Text, manufacturer.PictureID, txtPageSize.Value, manufacturer.PriceRanges, manufacturer.Published, manufacturer.Deleted, manufacturer.DisplayOrder, manufacturer.CreatedOn, manufacturer.UpdatedOn); } }
private void BindData() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { this.txtMetaKeywords.Text = manufacturer.MetaKeywords; this.txtMetaDescription.Text = manufacturer.MetaDescription; this.txtMetaTitle.Text = manufacturer.MetaTitle; this.txtSEName.Text = manufacturer.SEName; this.txtPageSize.Value = manufacturer.PageSize; } }
protected void btnRemoveManufacturerImage_Click(object sender, EventArgs e) { try { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { PictureManager.DeletePicture(manufacturer.PictureID); ManufacturerManager.RemoveManufacturerPicture(manufacturer.ManufacturerID); BindData(); } } catch (Exception exc) { ProcessException(exc); } }
private void CreateChildControlsTree() { manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID); if (manufacturer != null) { Control child = null; ManufacturerTemplate manufacturerTemplate = manufacturer.ManufacturerTemplate; if (manufacturerTemplate == null) { throw new NopException(string.Format("Manufacturer template path can not be empty. ManufacturerID={0}", manufacturer.ManufacturerID)); } child = base.LoadControl(manufacturerTemplate.TemplatePath); this.ManufacturerPlaceHolder.Controls.Add(child); } }
protected void BindData() { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(ManufacturerID); lName.Text = Server.HtmlEncode(manufacturer.Name); lDescription.Text = manufacturer.Description; ProductCollection featuredProducts = manufacturer.FeaturedProducts;; if (featuredProducts.Count > 0) { dlFeaturedProducts.DataSource = featuredProducts; dlFeaturedProducts.DataBind(); } else { pnlFeaturedProducts.Visible = false; } int totalRecords = 0; int pageSize = 10; if (manufacturer.PageSize > 0) { pageSize = manufacturer.PageSize; } ProductCollection productCollection = ProductManager.GetAllProducts(0, this.ManufacturerID, false, null, null, pageSize, this.CurrentPageIndex, null, out totalRecords); if (productCollection.Count > 0) { this.productsPager.PageSize = pageSize; this.productsPager.TotalRecords = totalRecords; this.productsPager.PageIndex = this.CurrentPageIndex; this.dlProducts.DataSource = productCollection; this.dlProducts.DataBind(); } else { this.dlProducts.Visible = false; } }
/// <summary> /// Gets manufacturer URL /// </summary> /// <param name="ManufacturerID">Manufacturer identifier</param> /// <returns>Manufacturer URL</returns> public static string GetManufacturerURL(int ManufacturerID) { Manufacturer manufacturer = ManufacturerManager.GetManufacturerByID(ManufacturerID); return(GetManufacturerURL(manufacturer)); }