protected void Page_Load(object sender, EventArgs e) { FormsAuthenticationHelper.AuthenticateUserWithReturnUrl(); connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString()); if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER) { Response.Redirect("../unauthorizedaccess.aspx"); } if (!(IsPostBack)) { if (Session["XMLFile"] != null) { hdnXMLFileName.Value = Session["XMLFile"].ToString().Trim(); } BrandsTransaction b = new BrandsTransaction(); lstBrandsCarried.DataSource = b.GetAllBrands(connstring); lstBrandsCarried.DataValueField = "BrandId"; lstBrandsCarried.DataTextField = "BrandName"; lstBrandsCarried.DataBind(); ItemsCarriedTransaction i = new ItemsCarriedTransaction(); lstItemsCarried.DataSource = i.GetAllItemsCarried(connstring); lstItemsCarried.DataValueField = "ItemNo"; lstItemsCarried.DataTextField = "ItemsCarried"; lstItemsCarried.DataBind(); ServicesTransaction s = new ServicesTransaction(); lstServicesOffered.DataSource = s.GetAllServices(connstring); lstServicesOffered.DataValueField = "ServiceId"; lstServicesOffered.DataTextField = "ServiceName"; lstServicesOffered.DataBind(); LocationsTransaction l = new LocationsTransaction(); lstLocation.DataSource = l.GetAllLocations(connstring); lstLocation.DataValueField = "LocationId"; lstLocation.DataTextField = "LocationName"; lstLocation.DataBind(); PCABClassTransaction p = new PCABClassTransaction(); ddlPCABClass.DataSource = p.GetAllPCABClass(connstring); ddlPCABClass.DataValueField = "PCABClassId"; ddlPCABClass.DataTextField = "PCABClassName"; ddlPCABClass.DataBind(); ListItem li = new ListItem(); li.Value = ""; li.Text = "-- PCAB Class --"; ddlPCABClass.Items.Insert(0, li); ISOStandard iso = new ISOStandard(); chkISOStandard_white.DataSource = iso.GetISOStandard(connstring); chkISOStandard_white.DataTextField = "ISOStandardName"; chkISOStandard_white.DataValueField = "ISOStandardId"; chkISOStandard_white.DataBind(); } }
private void PutDataToComboBoxes() { BrandsTransaction brands = new BrandsTransaction(); ItemsCarriedTransaction items = new ItemsCarriedTransaction(); LocationsTransaction loc = new LocationsTransaction(); ServicesTransaction serv = new ServicesTransaction(); CategoryTransaction cat = new CategoryTransaction(); SubCategory sub = new SubCategory(); PCABClassTransaction pcab = new PCABClassTransaction(); ISOStandard iso = new ISOStandard(); ddlBrands.DataSource = brands.GetAllBrands(connstring); ddlBrands.DataTextField = "BrandName"; ddlBrands.DataValueField = "BrandId"; ddlBrands.DataBind(); ListItem lst = new ListItem(); lst.Text = "Select Brands"; lst.Value = ""; ddlBrands.Items.Insert(0, lst); ddlItemsCarried.DataSource = items.GetAllItemsCarried(connstring); ddlItemsCarried.DataTextField = "ItemsCarried"; ddlItemsCarried.DataValueField = "ItemNo"; ddlItemsCarried.DataBind(); ListItem lst1 = new ListItem(); lst1.Text = "Select Items"; lst1.Value = ""; ddlItemsCarried.Items.Insert(0, lst1); ddlLocations.DataSource = loc.GetAllLocations(connstring); ddlLocations.DataTextField = "LocationName"; ddlLocations.DataValueField = "LocationId"; ddlLocations.DataBind(); ListItem lst2 = new ListItem(); lst2.Text = "Select Locations"; lst2.Value = ""; ddlLocations.Items.Insert(0, lst2); ddlServices.DataSource = serv.GetAllServices(connstring); ddlServices.DataTextField = "ServiceName"; ddlServices.DataValueField = "ServiceId"; ddlServices.DataBind(); ListItem lst3 = new ListItem(); lst3.Text = "Select Services"; lst3.Value = ""; ddlServices.Items.Insert(0, lst3); ddlCategory.DataSource = cat.GetCategories(connstring); ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryId"; ddlCategory.DataBind(); ListItem lst4 = new ListItem(); lst4.Text = "Select Category"; lst4.Value = ""; ddlCategory.Items.Insert(0, lst4); ddlSubCategory.DataSource = sub.GetSubCategoryByCategoryId(connstring, ddlCategory.SelectedItem.Value); ddlSubCategory.DataTextField = "SubCategoryName"; ddlSubCategory.DataValueField = "SubCategoryId"; ddlSubCategory.DataBind(); ListItem lst5 = new ListItem(); lst5.Text = "Select Sub-category"; lst5.Value = ""; ddlSubCategory.Items.Insert(0, lst5); ddlPCAAB.DataSource = pcab.GetAllPCABClass(connstring); ddlPCAAB.DataTextField = "PCABClassName"; ddlPCAAB.DataValueField = "PCABClassId"; ddlPCAAB.DataBind(); ListItem lst6 = new ListItem(); lst6.Text = "PCAB Class"; lst6.Value = ""; ddlPCAAB.Items.Insert(0, lst6); chkISOStandard.DataSource = iso.GetISOStandard(connstring); //chkISOStandard.DataSource = iso.GetISOStandard(connstring); chkISOStandard.DataTextField = "ISOStandardName"; chkISOStandard.DataValueField = "ISOStandardId"; chkISOStandard.DataBind(); }