protected void btnReassignRM_Click(object sender, EventArgs e) { string selectedCusmoerIds = ""; StringBuilder allPageCustomerIds = new StringBuilder(); AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); DataTable dtAllPagesCustomer; if (hndAllPageSelect.Value == "1") { dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value); foreach (DataRow dr in dtAllPagesCustomer.Rows) { allPageCustomerIds.Append(dr["C_CustomerId"].ToString()); allPageCustomerIds.Append("~"); } selectedCusmoerIds = allPageCustomerIds.ToString(); } else { selectedCusmoerIds = Convert.ToString(GetSelectedCustomerIdString()); } if (ddlBranchRMList.Visible == true && ddlBranchRMList.SelectedIndex != 0) { advisorBranchBO.ReassignCustomersBranchRM(selectedCusmoerIds, int.Parse(ddlBranchList.SelectedValue), int.Parse(ddlBranchRMList.SelectedValue)); SuccessMsg.Visible = true; this.BindCustomer(mypager.CurrentPage); } }
protected void ddlBranchRMList_SelectedIndexChanged(object sender, EventArgs e) { bool groupHead = false; string allCustomersId = ""; StringBuilder allPageCustomerIds = new StringBuilder(); AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); //ddlBranchRMList.Visible = false; DataTable dtAllPagesCustomer; if (ddlAdvisorBranchList.SelectedIndex != 0) { if (hndAllPageSelect.Value == "1") { dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value); foreach (DataRow dr in dtAllPagesCustomer.Rows) { allPageCustomerIds.Append(dr["C_CustomerId"].ToString()); allPageCustomerIds.Append("~"); } allCustomersId = allPageCustomerIds.ToString(); } else { allCustomersId = Convert.ToString(GetSelectedCustomerIdString()); if (string.IsNullOrEmpty(allCustomersId)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Please select some customer for RM reassign');", true); return; } } groupHead = advisorBranchBO.CheckCustomerGroupHead(allCustomersId); if (groupHead == true) { hndIsGroupHead.Value = "true"; } else { hndIsGroupHead.Value = "false"; } } }
protected void ddlAdvisorBranchList_SelectedIndexChanged(object sender, EventArgs e) { AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); //ddlBranchRMList.Visible = false; DataTable dtAllPagesCustomer; bool groupHead = false; if (ddlAdvisorBranchList.SelectedIndex != 0) { if (hndAllPageSelect.Value == "1") { dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value); DataTable dtRMList = advisorStaffBo.GetBranchRMList(int.Parse(ddlAdvisorBranchList.SelectedValue.ToString())); ddlBranchRMList.DataSource = dtRMList; ddlBranchRMList.DataTextField = dtRMList.Columns["RMName"].ToString(); ddlBranchRMList.DataValueField = dtRMList.Columns["AR_RMId"].ToString(); ddlBranchRMList.DataBind(); ddlBranchRMList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0")); foreach (DataRow dr in dtAllPagesCustomer.Rows) { dtRMList.DefaultView.Sort = "AR_RMId"; int i = dtRMList.DefaultView.Find(dr["AR_RMId"]); if (i == (0 - 1)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Some of the selected customer need to change RM also, please select the RM');", true); trReassignRM.Visible = true; } else { trReassignRM.Visible = false; } } } else { string allCustomersId = Convert.ToString(GetSelectedCustomerIdString()); if (string.IsNullOrEmpty(allCustomersId)) { ddlAdvisorBranchList.SelectedIndex = 0; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Please select some customer for branch reassign');", true); return; } groupHead = advisorBranchBO.CheckCustomerGroupHead(allCustomersId); if (groupHead == true) { hndIsGroupHead.Value = "true"; } else { hndIsGroupHead.Value = "false"; } //if (groupHead == true) //{ // //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "window.confirm('The search fee will now be deducted for the criteria entered. Do you wish to continue?');", true); // //AjaxControlToolkit.ConfirmButtonExtender cbExt = new AjaxControlToolkit.ConfirmButtonExtender(); // //cbExt.ConfirmText // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "confirm('Unable to locate your search item. Do you want to search the closest match from your item?');", true); //} DataTable dtRMList = advisorStaffBo.GetBranchRMList(int.Parse(ddlAdvisorBranchList.SelectedValue.ToString())); ddlBranchRMList.DataSource = dtRMList; ddlBranchRMList.DataTextField = dtRMList.Columns["RMName"].ToString(); ddlBranchRMList.DataValueField = dtRMList.Columns["AR_RMId"].ToString(); ddlBranchRMList.DataBind(); ddlBranchRMList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0")); foreach (GridViewRow dr in gvAssociation.Rows) { int rowIndex = dr.RowIndex; DataKey dKey = gvAssociation.DataKeys[rowIndex]; int customerId = int.Parse(dKey.Values["CustomerId"].ToString()); int userId = int.Parse(dKey.Values["UserId"].ToString()); string rmId = dKey.Values["RMId"].ToString(); int branchId = int.Parse(dKey.Values["BranchId"].ToString()); if (((CheckBox)dr.FindControl("chkId")).Checked == true) { dtRMList.DefaultView.Sort = "AR_RMId"; int i = dtRMList.DefaultView.Find(rmId); if (i == (0 - 1)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Some of the selected customer need to change RM also, please select the RM');", true); trReassignRM.Visible = true; } else { trReassignRM.Visible = false; } } } } } }