private void LoadBranchAssociation(int currentPage) { AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo(); AdvisorStaffBo advisorStaffBo = new AdvisorStaffBo(); UserVo userVo = null; DataSet ds = null; try { int Count; ds = advisorBranchBo.GetBranchAssociation(advisorVo.advisorId, currentPage, out Count, hdnBranchFilter.Value, hdnRMFilter.Value, hdnSort.Value, out genDictBranch, out genDictRM); if (Count > 0) { lblTotalRows.Text = hdnRecordCount.Value = Count.ToString(); tblPager.Visible = true; } if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { lblMsg.Visible = false; DataTable dt = new DataTable(); dt.Columns.Add("BranchId"); dt.Columns.Add("RMId"); dt.Columns.Add("Branch Name"); dt.Columns.Add("RM Name"); DataRow dr; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { dr = dt.NewRow(); dr["BranchId"] = ds.Tables[0].Rows[i]["branchId"].ToString(); dr["RMId"] = ds.Tables[0].Rows[i]["RMId"].ToString(); dr["Branch Name"] = ds.Tables[0].Rows[i]["BranchName"].ToString(); dr["RM Name"] = ds.Tables[0].Rows[i]["RMName"].ToString(); dt.Rows.Add(dr); } gvBranchList.DataSource = dt; gvBranchList.DataBind(); if (genDictBranch.Count > 0) { DropDownList ddlBranch = GetBranchDDL(); if (ddlBranch != null) { ddlBranch.DataSource = genDictBranch; ddlBranch.DataTextField = "Value"; ddlBranch.DataValueField = "Key"; ddlBranch.DataBind(); ddlBranch.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select")); } if (hdnBranchFilter.Value != "") { ddlBranch.SelectedValue = hdnBranchFilter.Value.ToString(); } } if (genDictRM.Count > 0) { DropDownList ddlRM = GetRMDDL(); if (ddlRM != null) { ddlRM.DataSource = genDictRM; ddlRM.DataTextField = "Value"; ddlRM.DataValueField = "Key"; ddlRM.DataBind(); ddlRM.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select")); } if (hdnRMFilter.Value != "") { ddlRM.SelectedValue = hdnRMFilter.Value.ToString(); } } gvBranchList.Visible = true; this.GetPageCount(); } } else { gvBranchList.DataSource = null; gvBranchList.DataBind(); lblMsg.Visible = true; lblMsg.Text = "Branch Association is not done..! "; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ViewBranchAssociation.ascx.cs:LoadBranchAssociation()"); object[] objects = new object[2]; objects[0] = ds; objects[1] = userVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }