private void BindData() { DataTable DT; ylib = new ylibWebClass(constr.connect()); FillWebControlClass FCC = new FillWebControlClass(); int CompanyId; int SubCategoryId; int CategoryId; int ProductGroupCode; #region SetListVariables CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]); CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]); SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]); ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]); #endregion #region FillDropDownLists dtCompany = taCompany.GetData(); FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId", true, true, CompanyId.ToString()); dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId); FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString()); dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId); FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString()); dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId); FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString()); #endregion #region SetSelectionLabel if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0) lblGroupLevel.Text = "Product Group"; else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0) lblGroupLevel.Text = "Sub Category"; else if (CompanyId != 0 && CategoryId != 0) lblGroupLevel.Text = "Category"; else if (CompanyId != 0) lblGroupLevel.Text = "Company"; #endregion #region Set Main Repeater Page Parts DT = ylib.GiveDataTable_BySQLStatement("select PagePartName from PageParts "); if (DT.Rows.Count > 0) { if (CompanyId != 0) { Repeater1.DataSource = DT; Repeater1.DataBind(); } } else { lblMsg.Text = "No record found"; return; } #endregion }
private void BindData() { FillWebControlClass FCC = new FillWebControlClass(); int CompanyId ; int SubCategoryId ; int CategoryId; int ProductGroupCode ; #region SetListVariables CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]); CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]); SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]); ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]); #region Write Cookies if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0) { Response.Cookies["ProductGroupCode"].Value = ProductGroupCode.ToString(); Response.Cookies["ProductGroupCode"].Expires = DateTime.Now.AddDays(1); } else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0) { Response.Cookies["SubCategoryId"].Value = SubCategoryId.ToString(); Response.Cookies["SubCategoryId"].Expires = DateTime.Now.AddDays(1); } else if (CompanyId != 0 && CategoryId != 0) { Response.Cookies["CategoryId"].Value = CategoryId.ToString(); Response.Cookies["CategoryId"].Expires = DateTime.Now.AddDays(1); } else if (CompanyId != 0) { Response.Cookies["CompanyId"].Value = CompanyId.ToString(); Response.Cookies["CompanyId"].Expires = DateTime.Now.AddDays(1); } #region GetCookies if (Request.Cookies["CompanyId"] != null && CompanyId==0) CompanyId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["CompanyId"].Value)); if (Request.Cookies["CompanyId"] != null && Request.Cookies["CategoryId"] != null && CategoryId == 0) CategoryId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["CategoryId"].Value)); if (Request.Cookies["CompanyId"] != null && Request.Cookies["CategoryId"] != null && Request.Cookies["SubCategoryId"] != null && SubCategoryId == 0) SubCategoryId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["SubCategoryId"].Value)); //if (Request.Cookies["ProductGroupCode"] != null && ProductGroupCode == 0) // ProductGroupCode = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["ProductGroupCode"].Value)); #endregion #endregion #endregion #region FillDropDownLists dtCompany = taCompany.GetData(); FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId",true,true,CompanyId.ToString()); dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId); FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString()); dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId); FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString()); dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId); FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString()); #endregion if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode!=0) dtProduct = taProduct.GetDataByProductGroupCode(ProductGroupCode); else dtProduct = taProduct.GetDataByProductGroupCode(0); if (dtProduct.Rows.Count > 0) { GridView1.DataSourceID = null; GridView1.DataSource = dtProduct; GridView1.DataBind(); } else { GridView1.DataSourceID = null; GridView1.DataSource = dtProduct; GridView1.DataBind(); lblMsg.Text = "No record found"; return; } }
private void BindData() { int SectionCode = 0; FillWebControlClass FCC = new FillWebControlClass(); ylib = new ClassP.ylibWebClass(constr.connect()); lblGroupLevel.Text = Request.QueryString["lblGroupLevel"]; int CompanyId ; int SubCategoryId ; int CategoryId; int ProductGroupCode ; #region SetListVariables SectionCode = StringOperation.QueryStringInt16Value(Request.QueryString["SectionCode"]); CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]); CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]); SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]); ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]); #region Write Cookies if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0) { Response.Cookies["ProductGroupCode"].Value=ProductGroupCode.ToString(); Response.Cookies["ProductGroupCode"].Expires=DateTime.Now.AddDays(1); } else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0) { Response.Cookies["SubCategoryId"].Value=SubCategoryId.ToString(); Response.Cookies["SubCategoryId"].Expires=DateTime.Now.AddDays(1); } else if (CompanyId != 0 && CategoryId != 0) { Response.Cookies["CategoryId"].Value = CategoryId.ToString(); Response.Cookies["CategoryId"].Expires = DateTime.Now.AddDays(1); } else if (CompanyId != 0) { Response.Cookies["CompanyId"].Value = CompanyId.ToString(); Response.Cookies["CompanyId"].Expires = DateTime.Now.AddDays(1); } #endregion #endregion lblSectionName.Text = ylib.giveValue("select SectionName from MainPageSection where SectionCode=" + SectionCode); #region FillDropDownLists dtCompany = taCompany.GetData(); FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId",true,true,CompanyId.ToString()); dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId); FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString()); dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId); FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString()); dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId); FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString()); #endregion if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode!=0) dtProduct = taProduct.GetDataByProductGroupCode(ProductGroupCode); else dtProduct = taProduct.GetDataByProductGroupCode(0); if (dtProduct.Rows.Count > 0) { GridView1.DataSourceID = null; GridView1.DataSource = dtProduct; GridView1.DataBind(); } else { GridView1.DataSourceID = null; GridView1.DataSource = dtProduct; GridView1.DataBind(); lblMsg.Text = "No record found"; return; } }
private void BindData() { if (Request.QueryString["CompanyId"] != null && Request.QueryString["CategoryId"] != null && Request.QueryString["SubCategoryId"] != null) { int CompanyId = Convert.ToInt32(Request.QueryString["CompanyId"]); int CategoryId = Convert.ToInt32(Request.QueryString["CategoryId"]); int SubCategoryId = Convert.ToInt32(Request.QueryString["SubCategoryId"]); dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId); ddlCompany.Items.FindByValue(CompanyId.ToString()).Selected = true; if (dtProductGroup.Rows.Count > 0) { GridView1.DataSourceID = null; GridView1.DataSource = dtProductGroup; GridView1.DataBind(); } else { lblMsg.Text = "No record found"; return; } } }