protected void btnAssociateBM_Click(object sender, EventArgs e) { int branchId = 0; try { rmVo = advisorStaffBo.GetAdvisorStaff(userVo.UserId); Session["rmVo"] = rmVo; foreach (GridViewRow gvr in this.gvBranchListBM.Rows) { if (((RadioButton)gvr.FindControl("rbtnBM")).Checked == true) { branchId = int.Parse(gvBranchListBM.DataKeys[gvr.RowIndex].Value.ToString()); if (advisorBranchBo.AssociateBranch(rmVo.RMId, branchId, 1, advisorVo.UserId)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert(' Association is done successfully');", true); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert('Sorry.. Association is not done');", true); } // advisorBranchBo.AssociateBranch(rmVo.RMId, branchId, advisorVo.UserId); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "BMBranchAssociation.ascx.cs:btnAssociateBM_Click()"); object[] objects = new object[1]; objects[0] = rmVo; objects[1] = branchId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void CreateMainBranch() { AdvisorBranchVo branchVo = new AdvisorBranchVo(); AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); List <int> adviserIds = new List <int>(); adviserIds = (List <int>)Session["IDs"]; branchVo.BranchHeadId = adviserIds[2]; branchVo.BranchName = txtOrganization.Text; branchVo.City = txtCity.Text; branchVo.Email = txtEmail.Text; branchVo.BranchTypeCode = 1; branchVo.MobileNumber = Convert.ToInt64(txtMobile.Text); branchVo.AddressLine1 = string.Empty; branchVo.AddressLine2 = string.Empty; branchVo.AddressLine3 = string.Empty; branchVo.Country = string.Empty; branchVo.BranchTypeCode = 1; branchVo.PinCode = 0; branchVo.State = null; branchVo.Fax = 0; branchVo.FaxIsd = 0; branchVo.FaxStd = 0; branchVo.Phone1Isd = 0; branchVo.Phone2Isd = 0; branchVo.Phone1Number = 0; branchVo.Phone2Number = 0; branchVo.Phone1Std = 0; branchVo.Phone2Std = 0; branchVo.IsHeadBranch = 1; branchVo.BranchId = adviserBranchBo.CreateAdvisorBranch(branchVo, adviserIds[1], adviserIds[0]); adviserBranchBo.AssociateBranch(adviserIds[2], branchVo.BranchId, 1, adviserIds[0]); }
protected void btnSaveChanges_Click(object sender, EventArgs e) { string branchAdd = ""; UserVo userVo = null; try { branchAdd = Session["BranchAdd"].ToString(); userVo = (UserVo)Session["UserVo"]; // if (chkAvailability()) //{ if (Validation()) { AdvisorBo advisorBo = new AdvisorBo(); advisorId = advisorVo.advisorId; userId = userVo.UserId; //advisorBranchVo.BranchId = advisorBo.getId(); advisorBranchVo.AddressLine1 = txtLine1.Text.ToString(); advisorBranchVo.AddressLine2 = txtLine2.Text.ToString(); advisorBranchVo.AddressLine3 = txtLine3.Text.ToString(); advisorBranchVo.BranchCode = txtBranchCode.Text.ToString(); rmList = advisorStaffBo.GetRMList(advisorVo.advisorId); if (rmList == null) { advisorBranchVo.BranchHeadId = 100; } else { if (ddlRmlist.SelectedIndex != 0) { advisorBranchVo.BranchHeadId = int.Parse(ddlRmlist.SelectedItem.Value.ToString()); } } if (txtMobileNumber.Text == "") { advisorBranchVo.MobileNumber = 0; } else { advisorBranchVo.MobileNumber = long.Parse(txtMobileNumber.Text); } //advisorBranchVo.BranchId = advisorBo.getId().ToString(); advisorBranchVo.BranchName = txtBranchName.Text.ToString(); advisorBranchVo.City = txtCity.Text.Trim(); advisorBranchVo.Country = ddlCountry.SelectedItem.Value.ToString(); advisorBranchVo.Email = txtEmail.Text.Trim().ToString(); advisorBranchVo.BranchTypeCode = Int32.Parse(ddlBranchAssociateType.SelectedItem.Value.ToString()); if (ddlBranchAssociateType.SelectedValue.ToString() == "2") { if (ddlAssociateCategory.SelectedIndex != 0) { advisorBranchVo.AssociateCategoryId = Int32.Parse(ddlAssociateCategory.SelectedItem.Value.ToString()); } if (FileUpload.HasFile) { advisorBranchVo.LogoPath = advisorVo.advisorId + "_" + txtBranchCode.Text.ToString() + ".jpg"; HttpPostedFile myFile = FileUpload.PostedFile; UploadImage(imgPath, myFile, advisorBranchVo.LogoPath); //FileUpload.SaveAs(Server.MapPath("Images") + "\\" + advisorVo.advisorId + "_" + txtBranchCode.Text.ToString() + ".jpg"); } } if (txtFax.Text == "") { advisorBranchVo.Fax = 0; } else { advisorBranchVo.Fax = int.Parse(txtFax.Text.ToString()); } if (txtIsdFax.Text == "") { advisorBranchVo.FaxIsd = 0; } else { advisorBranchVo.FaxIsd = int.Parse(txtIsdFax.Text.ToString()); } if (txtIsdPhone1.Text == "") { advisorBranchVo.Phone1Isd = 0; } else { advisorBranchVo.Phone1Isd = int.Parse(txtIsdPhone1.Text.ToString()); } if (txtIsdPhone2.Text == "") { advisorBranchVo.Phone2Isd = 0; } else { advisorBranchVo.Phone2Isd = int.Parse(txtIsdPhone2.Text.ToString()); } if (txtPhone2.Text == "") { advisorBranchVo.Phone2Number = 0; } else { advisorBranchVo.Phone2Number = int.Parse(txtPhone2.Text.ToString()); } if (txtStdFax.Text == "") { advisorBranchVo.FaxStd = 0; } else { advisorBranchVo.FaxStd = int.Parse(txtStdFax.Text.ToString()); } if (txtStdPhone2.Text == "") { advisorBranchVo.Phone2Std = 0; } else { advisorBranchVo.Phone2Std = int.Parse(txtStdPhone2.Text.ToString()); } advisorBranchVo.Phone1Number = int.Parse(txtPhone1.Text.ToString()); advisorBranchVo.Phone1Std = int.Parse(txtStdPhone1.Text.ToString()); if (txtPinCode.Text == "") { advisorBranchVo.PinCode = 0; } else { advisorBranchVo.PinCode = int.Parse(txtPinCode.Text.ToString()); } if (ddlState.SelectedIndex != 0) { advisorBranchVo.State = ddlState.SelectedItem.Value.ToString(); } else { advisorBranchVo.State = ""; } // Create Branch advisorBranchVo.BranchId = advisorBranchBo.CreateAdvisorBranch(advisorBranchVo, advisorId, userId); //Add Associate Commission Details if (ddlBranchAssociateType.SelectedValue.ToString() == "2") { foreach (GridViewRow row in gvCommStructure.Rows) { DropDownList ddlAssGp = (DropDownList)row.FindControl("ddlAssetGroup"); TextBox commfee = (TextBox)row.FindControl("txtCommFee"); TextBox revUpper = (TextBox)row.FindControl("txtRevUpperLimit"); TextBox revLower = (TextBox)row.FindControl("txtRevLowerLimit"); TextBox startDate = (TextBox)row.FindControl("txtStartDate"); TextBox endDate = (TextBox)row.FindControl("txtEndDate"); if (ddlAssGp.SelectedValue.ToString() != "Select Asset Group") { advisorAssociateCommissionVo.LOBAssetGroupsCode = ddlAssGp.SelectedValue.ToString(); if (commfee.Text.ToString() != string.Empty) { advisorAssociateCommissionVo.CommissionFee = float.Parse(commfee.Text.ToString()); } else { advisorAssociateCommissionVo.CommissionFee = 0; } if (revUpper.Text.ToString() != string.Empty) { advisorAssociateCommissionVo.RevenueUpperlimit = double.Parse(revUpper.Text.ToString()); } else { advisorAssociateCommissionVo.RevenueUpperlimit = 0; } if (revLower.Text.ToString() != string.Empty) { advisorAssociateCommissionVo.RevenueLowerlimit = double.Parse(revLower.Text.ToString()); } else { advisorAssociateCommissionVo.RevenueLowerlimit = 0; } if (startDate.Text.ToString() != string.Empty) { advisorAssociateCommissionVo.StartDate = Convert.ToDateTime(startDate.Text.ToString()); } else { advisorAssociateCommissionVo.StartDate = DateTime.MinValue; } if (endDate.Text.ToString() != string.Empty) { advisorAssociateCommissionVo.EndDate = Convert.ToDateTime(endDate.Text.ToString()); } else { advisorAssociateCommissionVo.EndDate = DateTime.MinValue; } advisorAssociateCommissionVo.BranchId = advisorBranchVo.BranchId; advisorBranchBo.AddAssociateCommission(userId, advisorAssociateCommissionVo); } } } // Creating Branch Association int cnt = advisorStaffBo.CheckRMMainBranch(advisorBranchVo.BranchHeadId); if (cnt == 0) { advisorBranchBo.AssociateBranch(advisorBranchVo.BranchHeadId, advisorBranchVo.BranchId, 1, userId); } else { advisorBranchBo.AssociateBranch(advisorBranchVo.BranchHeadId, advisorBranchVo.BranchId, 0, userId); } //if (!advisorBranchBo.CheckBranchMgrRole(advisorBranchVo.BranchHeadId)) //{ // int rmUserId = advisorStaffBo.GetUserId(advisorBranchVo.BranchHeadId); // userBo.CreateRoleAssociation(rmUserId, 1002); //} //if (branchAdd == "forAdvisor") //{ // rmVo = advisorStaffBo.GetAdvisorStaff(userVo.UserId); // if (advisorBranchBo.AssociateBranch(rmVo.RMId, advisorBranchVo.BranchId, 0, userId)) // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert(' Association is done successfully');", true); // } // else // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert('Sorry.. Association is not done');", true); // } //} //if (branchAdd == "forBM" || branchAdd.Trim().ToString() == "forRM") //{ // if (rmList != null) // { // rmVo = (RMVo)Session["newRMVo"]; // //Session["newRMVo"] = rmVo; // if (advisorBranchBo.AssociateBranch(rmVo.RMId, advisorBranchVo.BranchId, 0, userId)) // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert(' Association is done successfully');", true); // } // else // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert('Sorry.. Association is not done');", true); // } // } //} // Add Terminals to the Branch if (Session["terminalId"] != null) { List <int> terminalId = (List <int>)Session["terminalId"]; for (int i = 0; i < terminalId.Count; i++) { advisorBranchBo.AddBranchTerminal(advisorBranchVo.BranchId, terminalId[i], userId); } } Session.Remove("terminalId"); Session.Remove("table"); Session.Remove("count"); btnSubmit.Enabled = false; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('ViewBranches','none');", true); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert('Please select the Branch Head..!');", true); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "AddBranch.ascx:btnSaveChanges_Click()"); object[] objects = new object[4]; objects[0] = advisorBranchVo; objects[1] = rmVo; objects[2] = advisorVo; objects[3] = userVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnAssociate_Click(object sender, EventArgs e) { try { identify = Session["id"].ToString(); userId = userVo.UserId; //if (identify == "1") //{ // rmVo = advisorStaffBo.GetAdvisorStaff(int.Parse(Session["userId"].ToString())); // // int rmId = int.Parse(Session["rmId"].ToString()); // int rmId = rmVo.RMId; // foreach (GridViewRow gvr in this.gvBranchList.Rows) // { // if (((CheckBox)gvr.FindControl("chkId")).Checked == true) // { // branchId = int.Parse(gvBranchList.DataKeys[gvr.RowIndex].Value.ToString()); // if (advisorBranchBo.AssociateBranch(rmId, branchId,0, userId)) // { // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert(' Association is done successfully');", true); // } // else // { // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry.. Association is not done');", true); // } // // advisorBranchBo.AssociateBranch(rmId, branchId, userId); // } // } // //Session["id"] = ""; // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Association done Successfully...!');", true); //} //else //{ int rmId = int.Parse(DropDownList1.SelectedItem.Value.ToString()); foreach (GridViewRow gvr in this.gvBranchList.Rows) { CheckBox chk = (CheckBox)gvr.FindControl("chkId"); if ((chk).Checked == true) { branchId = int.Parse(gvBranchList.DataKeys[gvr.RowIndex].Value.ToString()); if (advisorBranchBo.AssociateBranch(rmId, branchId, 0, userId)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert(' Association is done successfully');", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry.. Association is not done');", true); } } } //Session["id"] = ""; showBranches(); // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Association done Successfully...!');", true); //} ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('ViewBranchAssociation','none');", true); btnAssociate.Enabled = false; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "RMBranchAssocistion.ascx:btnAssociate_Click()"); object[] objects = new object[3]; objects[0] = identify; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void CreateMainBranch() { AdvisorBranchVo branchVo = new AdvisorBranchVo(); AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); List <int> adviserIds = new List <int>(); adviserIds = (List <int>)Session["IDs"]; branchVo.AddressLine1 = txtAddressLine1.Text; branchVo.BranchHeadId = adviserIds[2]; branchVo.BranchName = txtOrganizationName.Text; branchVo.City = txtCity.Text; branchVo.Country = ddlCountry.SelectedItem.Value.ToString(); branchVo.Email = txtEmail.Text; branchVo.BranchTypeCode = 1; if (txtPinCode.Text == "") { branchVo.PinCode = 0; } else { branchVo.PinCode = int.Parse(txtPinCode.Text.ToString()); } if (ddlState.SelectedIndex != 0) { branchVo.State = ddlState.SelectedItem.Value.ToString(); } else { branchVo.State = null; } if (txtFaxNumber.Text == "") { branchVo.Fax = 0; } else { branchVo.Fax = int.Parse(txtFaxNumber.Text.ToString()); } if (txtFaxISD.Text == "") { branchVo.FaxIsd = 0; } else { branchVo.FaxIsd = int.Parse(txtFaxISD.Text.ToString()); } if (txtFaxSTD.Text == "") { branchVo.FaxStd = 0; } else { branchVo.FaxStd = int.Parse(txtFaxSTD.Text.ToString()); } if (txtMobileNumber.Text == "") { branchVo.MobileNumber = 0; } else { branchVo.MobileNumber = Convert.ToInt64(txtMobileNumber.Text.ToString()); } if (txtISD1.Text == "") { branchVo.Phone1Isd = 0; } else { branchVo.Phone1Isd = int.Parse(txtISD1.Text.ToString()); } if (txtISD2.Text == "") { branchVo.Phone2Isd = 0; } else { branchVo.Phone2Isd = int.Parse(txtISD2.Text.ToString()); } if (txtPhoneNumber1.Text == "") { branchVo.Phone1Number = 0; } else { branchVo.Phone1Number = int.Parse(txtPhoneNumber1.Text.ToString()); } if (txtPhoneNumber2.Text == "") { branchVo.Phone2Number = 0; } else { branchVo.Phone2Number = int.Parse(txtPhoneNumber2.Text.ToString()); } if (txtSTD1.Text == "") { branchVo.Phone1Std = 0; } else { branchVo.Phone1Std = int.Parse(txtSTD1.Text); } if (txtSTD2.Text == "") { branchVo.Phone2Std = 0; } else { branchVo.Phone2Std = int.Parse(txtSTD2.Text); } branchVo.IsHeadBranch = 1; branchVo.BranchId = adviserBranchBo.CreateAdvisorBranch(branchVo, adviserIds[1], adviserIds[0]); adviserBranchBo.AssociateBranch(adviserIds[2], branchVo.BranchId, 1, adviserIds[0]); }