/// <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; }
protected void BindSearchData() { ManufacturerAdmin manufaturer = new ManufacturerAdmin(); DataSet ds = manufaturer.GetManufacturerBySearchData(txtManufacturerName.Text.Trim()); DataView dv = new DataView(ds.Tables[0]); dv.Sort = "Name"; uxGrid.DataSource = dv; uxGrid.DataBind(); }
/// <summary> /// Bind Edit Datas /// </summary> public void BindEditDatas() { ManufacturerAdmin ManuAdmin = new ManufacturerAdmin(); Manufacturer _manufacturer = ManuAdmin.GetByManufactureId(ItemId); if (_manufacturer != null) { Name.Text = _manufacturer.Name; Description.Text = _manufacturer.Description; CheckActiveInd.Checked = _manufacturer.ActiveInd; if(_manufacturer.IsDropShipper.HasValue) DropShipInd.Checked = _manufacturer.IsDropShipper.Value; EmailId.Text = _manufacturer.EmailID; NotificationTemplate.Text = _manufacturer.EmailNotificationTemplate; Custom1.Text = _manufacturer.Custom1; Custom2.Text = _manufacturer.Custom2; Custom3.Text = _manufacturer.Custom3; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ManufacturerAdmin ManuAdmin = new ManufacturerAdmin(); Manufacturer _manufacturer = new Manufacturer(); if (ItemId > 0) { _manufacturer = ManuAdmin.GetByManufactureId(ItemId); } _manufacturer.PortalID = ZNodeConfigManager.SiteConfig.PortalID; _manufacturer.Name = Name.Text; _manufacturer.Description = Description.Text; _manufacturer.ActiveInd = CheckActiveInd.Checked; _manufacturer.IsDropShipper = DropShipInd.Checked; _manufacturer.EmailID = EmailId.Text.Trim(); _manufacturer.EmailNotificationTemplate = NotificationTemplate.Text.Trim(); _manufacturer.Custom1 = Custom1.Text.Trim(); _manufacturer.Custom2 = Custom2.Text.Trim(); _manufacturer.Custom3 = Custom3.Text.Trim(); bool check = false; if (ItemId > 0) { check = ManuAdmin.Update(_manufacturer); } else { check = ManuAdmin.Insert(_manufacturer); } if (check) { //redirect to main page Response.Redirect("list.aspx"); } else { //display error message lblError.Text = "An error occurred while updating. Please try again."; } }
protected void uxGrid_Sorting(object sender, GridViewSortEventArgs e) { if (IsSearchEnabled) { ManufacturerAdmin manufaturer = new ManufacturerAdmin(); DataSet ds = manufaturer.GetManufacturerBySearchData(txtManufacturerName.Text.Trim()); uxGrid.DataSource = SortDataTable(ds, e.SortExpression, true); uxGrid.DataBind(); } else { ManufacturerAdmin ManuAdmin = new ManufacturerAdmin(); DataSet ds = ManuAdmin.GetAllByPortalID(ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.PortalID).ToDataSet(true); uxGrid.DataSource = SortDataTable(ds, e.SortExpression, true); uxGrid.DataBind(); } if (GetSortDirection() == "DESC") { e.SortDirection = SortDirection.Descending; } else { e.SortDirection = SortDirection.Ascending; } }
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(); }