protected void btnSearch_Click(object sender, EventArgs e) { try { Brand objBrand = new Brand(); DataSet ds; objBrand.BrandName = txtBrandName.Text.Trim(); if (objBrand.BrandName!=String.Empty) { objBrand.SearchBrands(); ds = objBrand.DsCategories; } else { ds = new BrandsDAO().GetAllBrands(); } if (ds!=null && ds.Tables[0].Rows.Count>0) { gvBrands.DataSource = ds; gvBrands.DataBind(); trGrid.Visible = true; trNoRecords.Visible = false; } else { trNoRecords.Visible = true; trGrid.Visible = false; } } catch (Exception ex) { ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)"); if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty) { Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false); } else { Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false); } } }
/// <summary> /// Fill the default details for the controls /// </summary> public void LoadInitialData() { try { // // category // DataSet dsCategory = (new CategoryDAO()).GetAllCategories(); if (dsCategory == null || dsCategory.Tables.Count == 0) { ddlCategory.Items.Add(new ListItem("--No Data Found--", "-1")); } else { Master.BindDropdown("CategoryType", "CategoryId", dsCategory, ddlCategory); ddlCategory.Items.Add(new ListItem("All", "-1")); ddlCategory.SelectedValue = "-1"; } // // Add Branch // DataSet dsRoles = (new LocationsDAO()).GetAllBranches(); if (dsRoles == null || dsRoles.Tables.Count == 0) { ddlBranch.Items.Add(new ListEditItem("--No Records--", "-1")); } else { //Master.BindDropdown("BranchCode", "BranchId", dsRoles, ddlBranch); ddlBranch.DataSource = dsRoles; ddlBranch.TextField = "BranchCode"; ddlBranch.ValueField = "BranchId"; ddlBranch.DataBind(); ddlBranch.Items.Add(new ListEditItem("All", "-1")); ddlBranch.SelectedIndex = ddlBranch.Items.FindByValue(-1).Index; //ddlBranch.SelectedItem.Value = -1; } // // Suppliers // DataSet dsSuppliers = (new SupplierDAO()).GetAllSuppliers(); if (dsSuppliers == null || dsSuppliers.Tables.Count == 0) { ddlSupplier.Items.Add(new ListItem("--No Records--", "-1")); } else { Master.BindDropdown("Sup_Code", "SupId", dsSuppliers, ddlSupplier); ddlSupplier.Items.Add(new ListItem("All", "-1")); ddlSupplier.SelectedValue = "-1"; } // // Brand // DataSet dsBrands = new BrandsDAO().GetAllBrands(); if (dsBrands == null || dsBrands.Tables.Count == 0) { ddlBrands.Items.Add(new ListItem("--No Data Found--", "-1")); } else { Master.BindDropdown("BrandName", "BrandId", dsBrands, ddlBrands); ddlBrands.Items.Add(new ListItem("All", "-1")); ddlBrands.SelectedValue = "-1"; } // // Status // ListItem[] status = { new ListItem("All", "-1"), new ListItem("Active", "1"), new ListItem("InActive", "0") }; ddlStatus.Items.AddRange(status); } catch (Exception ex) { ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "public void LoadInitialData()"); if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty) Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false); else Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false); } }
public void LoadInitialData() { try { // // category // DataSet dsCategory = (new CategoryDAO()).GetAllCategories(); if (dsCategory==null || dsCategory.Tables.Count == 0) { ddlCatCode.Items.Add(new ListItem("--No Data Found--", "-1")); } else { Master.BindDropdown("CategoryType", "CategoryId", dsCategory, ddlCatCode); ddlCatCode.Items.Add(new ListItem("--Please Select--", "-1")); ddlCatCode.SelectedValue = "-1"; } // // Brand // DataSet dsBrands = new BrandsDAO().GetAllBrands(); if (dsBrands == null || dsBrands.Tables.Count == 0) { ddlBrandCode.Items.Add(new ListItem("--No Data Found--", "-1")); } else { Master.BindDropdown("BrandName", "BrandId", dsBrands, ddlBrandCode); ddlBrandCode.Items.Add(new ListItem("--Please Select--", "-1")); ddlBrandCode.SelectedValue = "-1"; } // // Status // ListItem[] status = { new ListItem("--Please Select--", "-1"), new ListItem("Active", "1"), new ListItem("InActive", "0") }; ddlStatus.Items.AddRange(status); ddlStatus.SelectedValue = "1"; // // Types // DataSet dsTypes = (new TypesDAO()).GetAllTypes(); if (dsTypes == null || dsTypes.Tables.Count == 0) { ddlType.Items.Add(new ListItem("--No Data Found--", "-1")); } else { Master.BindDropdown("TypeName", "TypeId", dsTypes, ddlType); ddlType.Items.Add(new ListItem("--Please Select--", "-1")); ddlType.SelectedValue = "-1"; } } catch (Exception ex) { throw ex; } }