protected void gvRMBranch_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable dt = new DataTable(); RadioButton rbtn; DataSet ds; ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A"); dt.Columns.Add("BranchId"); dt.Columns.Add("Branch Name"); dt.Columns.Add("Branch Code"); DataRowView drv = e.Row.DataItem as DataRowView; if (e.Row.RowType == DataControlRowType.DataRow) { //if (ds.Tables[0].Rows[gvRMBranch.Rows.Count]["ARB_IsMainBranch"].ToString() == "1") //{ // rbtn = e.Row.FindControl("rbtnMainBranch") as RadioButton; // rbtn.Checked = true; //} //else //{ rbtn = e.Row.FindControl("rbtnMainBranch") as RadioButton; //rbtn.Checked = false; //} } }
/// <summary> /// Used to bind branches of the Branch dropdown /// </summary> /// <param name="advisorVo"></param> /// <param name="rmVo"></param> private void BindBranch(AdvisorVo advisorVo, RMVo rmVo) { AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo(); UploadCommonBo uploadsCommonDao = new UploadCommonBo(); //DataSet ds = uploadsCommonDao.GetAdviserBranchList(advisorVo.advisorId, "adviser"); DataSet ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A"); if (ds != null) { ddlPickBranch.DataSource = ds; ddlPickBranch.DataValueField = ds.Tables[0].Columns["AB_BranchId"].ToString(); ddlPickBranch.DataTextField = ds.Tables[0].Columns["AB_BranchName"].ToString(); ddlPickBranch.DataBind(); } }
private void BindListBranch(int rmId, string userType) { UploadCommonBo uploadCommonBo = new UploadCommonBo(); //DataSet ds = uploadCommonBo.GetAdviserBranchList(rmId, userType); DataSet dsAssociatedBranch = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A"); if (dsAssociatedBranch != null && dsAssociatedBranch.Tables[0].Rows.Count > 0) { ddlAdviserBranchList.DataSource = dsAssociatedBranch.Tables[0]; ddlAdviserBranchList.DataTextField = "AB_BranchName"; ddlAdviserBranchList.DataValueField = "AB_BranchId"; ddlAdviserBranchList.DataBind(); ddlAdviserBranchList.Items.Insert(0, new ListItem("Select a Branch", "Select a Branch")); } else { ddlAdviserBranchList.Items.Insert(0, new ListItem("No Branches Available to Associate", "No Branches Available to Associate")); ddlAdviserBranchList_CompareValidator2.ValueToCompare = "No Branches Available to Associate"; ddlAdviserBranchList_CompareValidator2.ErrorMessage = "Cannot Add Customer Without a Branch"; } }
//private void BindBranchAssociation() //{ // DataSet ds; // DataTable dt; // DataRow dr; // try // { // if (rmVo.IsExternal == 1) // { // setBranchList("Y"); // } // else // { // setBranchList("N"); // } // if (Session["CurrentrmVo"] != null) // { // rmVo = (RMVo)Session["CurrentrmVo"]; // } // else // { // rmVo = (RMVo)Session["rmVo"]; // } // if (Session["advisorVo"] != null) // { // ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A"); // } // else // { // ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A"); // } // if (ds != null) // { // trBranchAssoication.Visible = true; // dt = new DataTable(); // dt.Columns.Add("BranchId"); // dt.Columns.Add("Branch Code"); // dt.Columns.Add("Branch Name"); // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // dr = dt.NewRow(); // dr["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString(); // dr["Branch Code"] = ds.Tables[0].Rows[i]["AB_BranchCode"].ToString(); // dr["Branch Name"] = ds.Tables[0].Rows[i]["AB_BranchName"].ToString(); // dt.Rows.Add(dr); // } // associatedBranch.DataSource = dt; // associatedBranch.DataTextField = "Branch Name"; // associatedBranch.DataValueField = "Branch Code"; // associatedBranch.DataBind(); // associatedBranch.Enabled = false; // availableBranch.Enabled = false; // //gvRMBranch.DataSource = dt; // //gvRMBranch.DataBind(); // //gvRMBranch.Visible = true; // } // else // { // //trBranchAssoication.Visible = false; // //gvRMBranch.DataSource = null; // //gvRMBranch.DataBind(); // //gvRMBranch.Visible = false; // } // } // catch (BaseApplicationException Ex) // { // throw Ex; // } // catch (Exception Ex) // { // BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); // NameValueCollection FunctionInfo = new NameValueCollection(); // FunctionInfo.Add("Method", "ViewRMDetails.ascx.cs:BindBranchAssociation()"); // object[] objects = new object[2]; // objects[0] = rmVo; // objects[1] = advisorVo; // FunctionInfo = exBase.AddObject(FunctionInfo, objects); // exBase.AdditionalInformation = FunctionInfo; // ExceptionManager.Publish(exBase); // throw exBase; // } //} private void BindBranchAssociation() { DataSet ds; //DataTable dt; DataTable dtList; //DataRow dr; DataRow drList; AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo(); try { if (Session["CurrentrmVo"] != null) { rmVo = (RMVo)Session["CurrentrmVo"]; } else { rmVo = (RMVo)Session["rmVo"]; } if (Session["advisorVo"] != null) { ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A"); } else { ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A"); } if (ds != null) { _commondatasetdestination = ds; //dt = new DataTable(); //dt.Columns.Add("BranchId"); //dt.Columns.Add("RMId"); //dt.Columns.Add("Branch Name"); //dt.Columns.Add("Branch Code"); dtList = new DataTable(); dtList.Columns.Add("Branch"); dtList.Columns.Add("BranchId"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //dr = dt.NewRow(); //dr["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString(); //dr["RMId"] = ds.Tables[0].Rows[i]["AR_RMId"].ToString(); //dr["Branch Code"] = ds.Tables[0].Rows[i]["AB_BranchCode"].ToString(); //dr["Branch Name"] = ds.Tables[0].Rows[i]["AB_BranchName"].ToString(); drList = dtList.NewRow(); drList["Branch"] = ((ds.Tables[0].Rows[i]["AB_BranchName"].ToString()) + "," + (ds.Tables[0].Rows[i]["AB_BranchCode"].ToString())); drList["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString(); //dt.Rows.Add(dr); dtList.Rows.Add(drList); hdnExistingBranches.Value += drList["BranchId"].ToString() + ","; } Session["AssociatedBranch"] = dtList; // Show binded contents in List box associatedBranch.DataSource = dtList; associatedBranch.DataTextField = "Branch"; associatedBranch.DataValueField = "BranchId"; associatedBranch.DataBind(); if (rmVo.IsExternal == 1) { setBranchList("Y"); } else { setBranchList("N"); } } else { if (rmVo.IsExternal == 1) { setBranchList("Y"); } else { setBranchList("N"); } //gvBranchList.Visible = false; } associatedBranch.Enabled = false; availableBranch.Enabled = false; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ViewRMDetails.ascx.cs:BindBranchAssociation()"); object[] objects = new object[2]; objects[0] = rmVo; objects[1] = advisorVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public void showBranches() { DataSet ds; DataTable dt; DataRow dr; int rmId = 0; try { ShowAssociatedBranches(); //advisorBranchList = advisorBranchBo.GetAdvisorBranches(advisorVo.advisorId); // rmId = int.Parse(Session["rmId1"].ToString()); rmId = int.Parse(DropDownList1.SelectedItem.Value.ToString()); if (advisorBranchBo.GetRMBranchAssociation(rmId, advisorVo.advisorId, "N") != null) { ds = advisorBranchBo.GetRMBranchAssociation(rmId, advisorVo.advisorId, "N"); if (ds.Tables[0].Rows.Count > 0) { lblError.Visible = false; trBranch.Visible = true; dt = new DataTable(); dt.Columns.Add("BranchId"); dt.Columns.Add("Branch Name"); dt.Columns.Add("Branch Code"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { dr = dt.NewRow(); dr["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString(); dr["Branch Code"] = ds.Tables[0].Rows[i]["AB_BranchCode"].ToString(); dr["Branch Name"] = ds.Tables[0].Rows[i]["AB_BranchName"].ToString(); dt.Rows.Add(dr); } gvBranchList.DataSource = dt; gvBranchList.DataBind(); gvBranchList.Visible = true; } } else { lblError.Visible = true; lblError.Text = "No Records Found"; trBranch.Visible = true; gvBranchList.DataSource = null; gvBranchList.DataBind(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "RMBranchAssociation.ascx.cs:showBranches()"); object[] objects = new object[2]; objects[0] = advisorBranchList; objects[1] = advisorBranchVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }