/// <summary> /// Bind data to the drop down list /// </summary> public void BindDropDownData() { //Add the manufacturers to the drop-down list ManufacturerAdmin manuadmin = new ManufacturerAdmin(); dmanufacturer.DataSource = manuadmin.GetAllByPortalID(ZNodeConfigManager.SiteConfig.PortalID); dmanufacturer.DataTextField = "Name"; dmanufacturer.DataValueField = "ManufacturerID"; dmanufacturer.DataBind(); ListItem item = new ListItem("ALL", "0"); dmanufacturer.Items.Insert(0, item); //making ALL as the default value of the drop-down list box dmanufacturer.SelectedIndex = 0; //Add Producttypes to the drop-down list ProductTypeAdmin producttypeadmin = new ProductTypeAdmin(); dproducttype.DataSource = producttypeadmin.GetAllProductType(ZNodeConfigManager.SiteConfig.PortalID); dproducttype.DataTextField = "Name"; dproducttype.DataValueField = "Producttypeid"; dproducttype.DataBind(); ListItem item1 = new ListItem("ALL", "0"); dproducttype.Items.Insert(0, item1); dproducttype.SelectedIndex = 0; //Add Product categories to the drop-down list CategoryAdmin categoryadmin = new CategoryAdmin(); dproductcategory.DataSource = categoryadmin.GetAllCategories(ZNodeConfigManager.SiteConfig.PortalID); dproductcategory.DataTextField = "Name"; dproductcategory.DataValueField = "Categoryid"; dproductcategory.DataBind(); ListItem item2 = new ListItem("ALL", "0"); dproductcategory.Items.Insert(0, item2); dproductcategory.SelectedIndex = 0; }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { ProductTypeAdmin prodTypeAdmin = new ProductTypeAdmin(); ProductType prodType = new ProductType(); prodType.ProductTypeId = ItemId; prodType.PortalId = ZNodeConfigManager.SiteConfig.PortalID ; prodType.Name = Name.Text; prodType.Description = Description.Text; prodType.DisplayOrder = Convert.ToInt32(DisplayOrder.Text); bool check = false; if (ItemId > 0) { check = prodTypeAdmin.Update(prodType); } else { check = prodTypeAdmin.Add(prodType); } if (check) { //redirect to main page Response.Redirect("list.aspx"); } else { //display error message lblError.Text = "An error occurred while updating. Please try again."; } }
/// <summary> /// Bind data to the fields on the screen /// </summary> protected void BindData() { ProductTypeAdmin ProductTypeAdmin = new ProductTypeAdmin(); ProductType ProdType = ProductTypeAdmin.GetByProdTypeId(ItemId); if (ProdType != null) { ProductCategoryName = ProdType.Name; } else { throw (new ApplicationException("Product Type Requested could not be found.")); } }
/// <summary> /// Bind data to the fields on the edit screen /// </summary> protected void BindEditData() { ProductTypeAdmin ProdTypeAdmin = new ProductTypeAdmin(); ProductType ProductTypes = ProdTypeAdmin.GetByProdTypeId(ItemId); if (ProductTypes != null) { Name.Text = ProductTypes.Name; Description.Text = ProductTypes.Description; DisplayOrder.Text = ProductTypes.DisplayOrder.ToString(); } else { throw (new ApplicationException("Product Type Requested could not be found.")); } }
/// <summary> /// Delete Button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { ProductTypeAdmin ProdTypeAdmin = new ProductTypeAdmin(); ProductType ProdType = new ProductType(); ProdType.ProductTypeId = ItemId; ProdType.PortalId = ZNodeConfigManager.SiteConfig.PortalID; bool Check = false; Check = ProdTypeAdmin.Delete(ProdType); if (Check) { Response.Redirect("list.aspx"); } else { lblError.Text = "* Delete action could not be completed because the Product Type is in use."; } }
private void BindData() { ProductTypeAdmin _AdminAccess = new ProductTypeAdmin(); ProductType _ProductTypeList = _AdminAccess.GetByProdTypeId(ItemID); if(_ProductTypeList != null) { lblProductType.Text = _ProductTypeList.Name; //lblProductTypeName.Text = _ProductTypeList.Name; //lblDescription.Text = _ProductTypeList.Description; //lblDisplayOrder.Text = _ProductTypeList.DisplayOrder.ToString(); } }
/// <summary> /// Binds the Grid /// </summary> private void BindGrid() { ProductTypeAdmin _ProductTypeAdmin = new ProductTypeAdmin(); DataSet ds = new DataSet(); ds = _ProductTypeAdmin.GetAttributeNamesByProductTypeid(ItemID, ZNodeConfigManager.SiteConfig.PortalID); DataView dv = new DataView(ds.Tables[0]); dv.Sort = "AttributeTypeId DESC"; uxGrid.DataSource = dv; uxGrid.DataBind(); }
public void BindData() { //Bind product Type ProductTypeAdmin productTypeAdmin = new ProductTypeAdmin(); ProductTypeList.DataSource = productTypeAdmin.GetAllProductTypes(ZNodeConfigManager.SiteConfig.PortalID); ProductTypeList.DataTextField = "name"; ProductTypeList.DataValueField = "productTypeid"; ProductTypeList.DataBind(); //Bind Manufacturer ManufacturerAdmin ManufacturerAdmin = new ManufacturerAdmin(); ManufacturerList.DataSource=ManufacturerAdmin.GetAllByPortalID(ZNodeConfigManager.SiteConfig.PortalID); ManufacturerList.DataTextField = "name"; ManufacturerList.DataValueField = "manufacturerid"; ManufacturerList.DataBind(); ListItem li = new ListItem("No Manufacturer Selected", "0"); ManufacturerList.Items.Insert(0,li); //Bind Supplier SupplierService serv = new SupplierService(); TList<ZNode.Libraries.DataAccess.Entities.Supplier> list = serv.GetAll(); list.Sort("DisplayOrder Asc"); list.ApplyFilter(delegate(ZNode.Libraries.DataAccess.Entities.Supplier supplier) { return (supplier.ActiveInd == true); }); DataSet ds = list.ToDataSet(false); DataView dv = new DataView(ds.Tables[0]); ddlSupplier.DataSource = dv; ddlSupplier.DataTextField = "name"; ddlSupplier.DataValueField = "supplierid"; ddlSupplier.DataBind(); ListItem li1 = new ListItem("None", "0"); ddlSupplier.Items.Insert(0, li1); //Bind Categories this.BindTreeViewCategory(); // Bind Tax Class TaxRuleAdmin TaxRuleAdmin = new TaxRuleAdmin(); ddlTaxClass.DataSource = TaxRuleAdmin.GetAllTaxClass(); ddlTaxClass.DataTextField = "name"; ddlTaxClass.DataValueField = "TaxClassID"; ddlTaxClass.DataBind(); }