/// <summary> /// Get all the liabilities of the customer /// </summary> /// <param name="customerIds"></param> /// <returns></returns> public DataSet GetLiabilities(string customerIds) { Database db; DbCommand cmdGetLiabilities; DataSet dsGetLiabilities; int tempId = 0; Calculator calculator = new Calculator(); List <LiabilitiesVo> liabilitiesVoList = new List <LiabilitiesVo>(); LiabilitiesVo liabilityVo = new LiabilitiesVo(); LiabilitiesBo liabilitiesBo = new LiabilitiesBo(); double liabilityValue = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); cmdGetLiabilities = db.GetStoredProcCommand("SP_RPT_GetLiabilities"); db.AddInParameter(cmdGetLiabilities, "@PortfolioIds", DbType.String, customerIds); cmdGetLiabilities.CommandTimeout = 60 * 60; dsGetLiabilities = db.ExecuteDataSet(cmdGetLiabilities); if (dsGetLiabilities != null && dsGetLiabilities.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsGetLiabilities.Tables[0].Rows.Count; i++) { liabilityValue = 0; liabilityVo = liabilitiesBo.GetLiabilityDetails(int.Parse(dsGetLiabilities.Tables[0].Rows[i]["CL_LiabilitiesId"].ToString())); if (liabilityVo.PaymentOptionCode == 1) { liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.CompoundFrequency, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 1, liabilityVo.LumpsumRepaymentAmount, liabilityVo.NoOfInstallments); } else if (liabilityVo.PaymentOptionCode == 2) { liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.FrequencyCodeEMI, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 2, liabilityVo.EMIAmount, liabilityVo.NoOfInstallments); } else { liabilityValue = liabilityVo.LoanAmount; } dsGetLiabilities.Tables[0].Rows[i]["LoanAmount"] = liabilityValue.ToString(); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "LiabilitiesDao.cs:GetLiabilities()"); object[] objects = new object[1]; objects[0] = customerIds; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(dsGetLiabilities); }
protected void btnSubmit_Click(object sender, EventArgs e) { schemeDetailsVo.LoanSchemeName = txtSchemeName.Text; schemeDetailsVo.MinimunLoanAmount = TryParseDouble(txtMinLoanAmount.Text); schemeDetailsVo.MaximumLoanAmount = TryParseDouble(txtMaxLoanAmount.Text); schemeDetailsVo.MinimumLoanPeriod = TryParseInt(txtMinLoanPeriod.Text); schemeDetailsVo.MaximumLoanPeriod = TryParseInt(txtMaxLoanPeriod.Text); schemeDetailsVo.PLR = TryParseFloat(txtPrimeLendingRate.Text); schemeDetailsVo.MarginMaintained = TryParseInt(txtMargin.Text); //schemeDetailsVo.AdviserId = adviserVo.advisorId; //if (txtMinAge != null && txtMinAge.Text != string.Empty) schemeDetailsVo.MinimumAge = TryParseInt(txtMinAge.Text); //if (txtMaxAge != null && txtMaxAge.Text != string.Empty) schemeDetailsVo.MaximumAge = TryParseInt(txtMaxAge.Text); //if (txtMinSalary != null && txtMinSalary.Text != string.Empty) schemeDetailsVo.MinimumSalary = TryParseFloat(txtMinSalary.Text); //if (txtMinimumProfitAmount != null && txtMinimumProfitAmount.Text != string.Empty) schemeDetailsVo.MinimumProfitAmount = TryParseFloat(txtMinimumProfitAmount.Text); //if (txtMinimumProfitPeriod != null && txtMinimumProfitAmount.Text != string.Empty) schemeDetailsVo.MinimumProfitPeriod = TryParseInt(txtMinimumProfitPeriod.Text); schemeDetailsVo.Remark = txtRemarks.Text; schemeDetailsVo.CustomerCategory = TryParseInt(ddlBorrowerType.SelectedValue); schemeDetailsVo.LoanPartner = TryParseInt(ddlLoanPartner.SelectedValue); schemeDetailsVo.LoanType = TryParseInt(ddlLoanType.SelectedValue); if (rdoFloatingRate.SelectedValue == "1") { schemeDetailsVo.IsFloatingRateInterest = true; } else { schemeDetailsVo.IsFloatingRateInterest = false; } if (mode == Mode.Add) { schemeDetailsVo.CreatedBy = userVo.UserId; schemeId = LiabilitiesBo.CreateScheme(schemeDetailsVo); SaveInterestRates(); bool isProofsUpdated = AddProofs(); } else { schemeDetailsVo.LoanSchemeId = schemeId; schemeDetailsVo.ModifiedBy = userVo.UserId; Boolean isUpdated = LiabilitiesBo.UpdateScheme(schemeDetailsVo); SaveInterestRates(); bool isProofsUpdated = AddProofs(); } string url = "?mode=view"; Session["LoanSchemeViewStatus"] = "View"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('LoanSchemeView','" + url + "');", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loadcontrol('LoanSchemeView','');", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loadcontrol('SessionExpired','');", true); }
private void BindLoanType() { // string path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString()); DataTable dt = LiabilitiesBo.GetAllLoanTypes(); //XMLBo.GetLoanType(path); ddlLoanType.DataSource = dt; ddlLoanType.DataValueField = dt.Columns["XLT_LoanTypeCode"].ToString(); ddlLoanType.DataTextField = dt.Columns["XLT_LoanType"].ToString(); ddlLoanType.DataBind(); ddlLoanType.Items.Insert(0, new ListItem("Select", "0")); }
protected void ddlLoanType_SelectedIndexChanged(object sender, EventArgs e) { //string path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString()); //DataTable dt = XMLBo.GetCustomerCategory(path); DataTable dt = LiabilitiesBo.GetAllCustomerTypes(int.Parse(ddlLoanType.SelectedValue)); ddlBorrowerType.DataSource = dt; ddlBorrowerType.DataValueField = dt.Columns["XCC_CustomerCategoryCode"].ToString(); ddlBorrowerType.DataTextField = dt.Columns["XCC_CustomerCategory"].ToString(); ddlBorrowerType.DataBind(); ddlBorrowerType.Items.Insert(0, new ListItem("Select", "0")); tblDocuments.Visible = false; }
private bool AddProofs() { LiabilitiesBo.DeleteProofs(schemeId); foreach (String key in Request.Params.AllKeys) { if (key.Contains("chkLoan-")) { int proofCode = int.Parse(key.Substring(key.IndexOf("chkLoan-") + 8)); LiabilitiesBo.AddProofs(schemeId, proofCode, userVo.UserId); } } return(false); }
private void BindBorrowerType(int loanType) { //string path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString()); //DataTable dt = XMLBo.GetCustomerCategory(path); DataTable dt = LiabilitiesBo.GetAllCustomerTypes(loanType); ddlBorrowerType.DataSource = dt; ddlBorrowerType.DataSource = dt; ddlBorrowerType.DataValueField = dt.Columns["XCC_CustomerCategoryCode"].ToString(); ddlBorrowerType.DataTextField = dt.Columns["XCC_CustomerCategory"].ToString(); ddlBorrowerType.DataBind(); ddlBorrowerType.Items.Insert(0, new ListItem("Select", "0")); }
private void BindLoanSchemes() { if (hdnCurrentPage.Value.ToString() != "") { mypager.CurrentPage = Int32.Parse(hdnCurrentPage.Value.ToString()); hdnCurrentPage.Value = ""; } int count; gvAdviserLoanSchemeView.DataSource = LiabilitiesBo.GetLoanSchemes(mypager.CurrentPage, out count); gvAdviserLoanSchemeView.DataBind(); hdnRecordCount.Value = count.ToString(); if (count > 0) { DivPager.Style.Add("display", "visible"); lblTotalRows.Text = hdnRecordCount.Value; } this.GetPageCount(); }
private void BindInterestRates() { if (mode == Mode.Edit || mode == Mode.View) { if (!Page.IsPostBack) { DataSet ds = LiabilitiesBo.GetInterestRateBySchemeId(schemeId); gvAdviserInterestRates.DataSource = ds; if (ds != null && ds.Tables[0].Rows.Count > 0) { gvAdviserInterestRates.DataBind(); ViewState["CurrentTable"] = ds.Tables[0]; } else { SetDummyRow(); } } else { if ((DataTable)ViewState["CurrentTable"] != null) { gvAdviserInterestRates.DataSource = (DataTable)ViewState["CurrentTable"]; gvAdviserInterestRates.DataBind(); } } } else if (mode == Mode.Add) { if (!Page.IsPostBack) { SetDummyRow(); //gvAdviserInterestRates.FooterRow.Visible = true; } } DisplayFooter(); }
private void BindLoanProposal(int CurrentPage) { Dictionary <string, string> genDictLoanType = new Dictionary <string, string>(); Dictionary <string, string> genDictLoanStage = new Dictionary <string, string>(); LiabilitiesBo liabilitiesBo = new LiabilitiesBo(); List <LoanProposalVo> proposalList = new List <LoanProposalVo>(); DataTable dtLoanProposals = new DataTable(); try { DropDownList ddl = new DropDownList(); Label lbl = new Label(); if (hdnCurrentPage.Value.ToString() != "") { mypager.CurrentPage = Int32.Parse(hdnCurrentPage.Value.ToString()); hdnCurrentPage.Value = ""; } int Count = 0; proposalList = liabilitiesBo.GetLoanProposalList(rmVo.RMId, mypager.CurrentPage, out Count, hdnSort.Value, hdnNameFilter.Value, hdnLoanTypeFilter.Value, hdnLoanStageFilter.Value, out genDictLoanType, out genDictLoanStage); lblTotalRows.Text = hdnRecordCount.Value = Count.ToString(); if (proposalList == null) { hdnRecordCount.Value = "0"; trMessage.Visible = true; lblMessage.Visible = true; trPager.Visible = false; lblTotalRows.Visible = false; //tblGV.Visible = false; } else { trMessage.Visible = false; lblMessage.Visible = false; trPager.Visible = true; lblTotalRows.Visible = true; dtLoanProposals.Columns.Add("LoanProposalId"); dtLoanProposals.Columns.Add("CustomerName"); dtLoanProposals.Columns.Add("LoanType"); dtLoanProposals.Columns.Add("LoanStage"); dtLoanProposals.Columns.Add("LoanAmount"); dtLoanProposals.Columns.Add("LoanPartner"); dtLoanProposals.Columns.Add("Remarks"); dtLoanProposals.Columns.Add("Commission"); DataRow drRMCustomer; for (int i = 0; i < proposalList.Count; i++) { drRMCustomer = dtLoanProposals.NewRow(); loanProposalVo = new LoanProposalVo(); loanProposalVo = proposalList[i]; drRMCustomer[0] = loanProposalVo.LoanProposalId.ToString(); drRMCustomer[1] = loanProposalVo.CustomerName.ToString(); drRMCustomer[2] = loanProposalVo.LoanType.ToString(); drRMCustomer[3] = loanProposalVo.LoanStage.ToString(); drRMCustomer[4] = loanProposalVo.AppliedLoanAmount.ToString("f2"); drRMCustomer[5] = loanProposalVo.LoanPartner.ToString(); drRMCustomer[6] = loanProposalVo.Remark.ToString(); drRMCustomer[7] = loanProposalVo.Commission.ToString("f2"); dtLoanProposals.Rows.Add(drRMCustomer); } gvLoanProposals.DataSource = dtLoanProposals; gvLoanProposals.DataBind(); if (genDictLoanType.Count > 0) { DropDownList ddlLoanType = GetLoanTypeDDL(); if (ddlLoanType != null) { ddlLoanType.DataSource = genDictLoanType; ddlLoanType.DataTextField = "Key"; ddlLoanType.DataValueField = "Value"; ddlLoanType.DataBind(); ddlLoanType.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select")); } if (hdnLoanTypeFilter.Value != "") { ddlLoanType.SelectedValue = hdnLoanTypeFilter.Value.ToString(); } } if (genDictLoanStage.Count > 0) { DropDownList ddlLoanStage = GetLoanStageDDL(); if (ddlLoanStage != null) { ddlLoanStage.DataSource = genDictLoanStage; ddlLoanStage.DataTextField = "Key"; ddlLoanStage.DataValueField = "Value"; ddlLoanStage.DataBind(); ddlLoanStage.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select")); } if (hdnLoanStageFilter.Value != "") { ddlLoanStage.SelectedValue = hdnLoanStageFilter.Value.ToString(); } } TextBox txtName = GetCustNameTextBox(); if (txtName != null) { if (hdnNameFilter.Value != "") { txtName.Text = hdnNameFilter.Value.ToString(); } } this.GetPageCount(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "LoanTrackingGrid.ascx.cs:BindLoanProposal()"); object[] objects = new object[2]; objects[0] = rmVo; objects[1] = proposalList; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void SaveInterestRates() { SchemeInterestRateVo interestRateVo = new SchemeInterestRateVo(); bool result = false; foreach (GridViewRow gvr in gvAdviserInterestRates.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { DataControlRowState dcrs = gvr.RowState; if (gvr.RowState == (DataControlRowState.Alternate | DataControlRowState.Edit) || gvr.RowState == DataControlRowState.Edit) { result = true; break; } } } if (!result) { UpdationIncomplete.Visible = false; for (int i = 0; i < gvAdviserInterestRates.Rows.Count; i++) { if (gvAdviserInterestRates.Rows[i].RowType == DataControlRowType.DataRow && gvAdviserInterestRates.DataKeys[i].Value != "-1") { GridViewRow row = gvAdviserInterestRates.Rows[i]; interestRateVo.InterestCategory = ((Label)row.FindControl("lblCategory")).Text.Trim(); interestRateVo.MinimumFinance = TryParseFloat(((Label)row.FindControl("lblMinFinance")).Text.Trim()); interestRateVo.MaximumFinance = TryParseFloat(((Label)row.FindControl("lblMaxFinance")).Text.Trim()); interestRateVo.MinimumPeriod = TryParseInt(((Label)row.FindControl("lblMinimumPeriod")).Text.Trim()); interestRateVo.MaximumPeriod = TryParseInt(((Label)row.FindControl("lblMaximumPeriod")).Text.Trim()); interestRateVo.DifferentialInterestRate = TryParseFloat(((Label)row.FindControl("lblDifferentialInterestRate")).Text.Trim()); interestRateVo.PreClosingCharges = TryParseFloat(((Label)row.FindControl("lblPreClosingCharges")).Text.Trim()); interestRateVo.ProcessingCharges = TryParseFloat(((Label)row.FindControl("lblProcessingCharges")).Text.Trim()); interestRateVo.MaximumFinancePer = TryParseFloat(((Label)row.FindControl("lblMaximumFinancePer")).Text.Trim()); //if(mode == Mode.Add) // // bool isUpdated = LiabilitiesBo.UpdateInterestRate(interestRateVo); //else interestRateVo.LoanSchemeId = schemeId; bool isUpdated = false; if (gvAdviserInterestRates.DataKeys[i] != null && int.Parse(gvAdviserInterestRates.DataKeys[i].Value.ToString()) < 99999) { interestRateVo.CreatedBy = userVo.UserId; interestRateVo.LoanSchemeInterestRateId = int.Parse(gvAdviserInterestRates.DataKeys[i].Value.ToString()); isUpdated = LiabilitiesBo.UpdateInterestRate(interestRateVo); } else { interestRateVo.ModifiedBy = userVo.UserId; isUpdated = LiabilitiesBo.AddInterestRate(interestRateVo); } //schemeId = int.Parse(gvAdviserLoanSchemeView.DataKeys[selectedRow].Values["SchemeId"].ToString()); //gvAdviserInterestRates.EditIndex = -1; // BindInterestRates(); } } } else { UpdationIncomplete.Visible = true; } }
private void BindSchemeDetails() { schemeDetailsVo = LiabilitiesBo.GetSchemeDetails(schemeId); //if (mode == Mode.Edit || mode == Mode.Add || mode == Mode.View) //{ txtSchemeName.Text = schemeDetailsVo.LoanSchemeName; txtMinLoanAmount.Text = schemeDetailsVo.MinimunLoanAmount.ToString("#0.00"); txtMaxLoanAmount.Text = schemeDetailsVo.MaximumLoanAmount.ToString("#0.00"); txtMinLoanPeriod.Text = schemeDetailsVo.MinimumLoanPeriod.ToString(); txtMaxLoanPeriod.Text = schemeDetailsVo.MaximumLoanPeriod.ToString(); txtPrimeLendingRate.Text = schemeDetailsVo.PLR.ToString("#0.00"); txtMargin.Text = schemeDetailsVo.MarginMaintained.ToString("#0.00"); txtMinAge.Text = schemeDetailsVo.MinimumAge.ToString(); txtMaxAge.Text = schemeDetailsVo.MaximumAge.ToString(); txtMinSalary.Text = schemeDetailsVo.MinimumSalary.ToString("#0.00"); txtMinimumProfitAmount.Text = schemeDetailsVo.MinimumProfitAmount.ToString("#0.00"); txtMinimumProfitPeriod.Text = schemeDetailsVo.MinimumProfitPeriod.ToString(); txtRemarks.Text = schemeDetailsVo.Remark; ddlLoanPartner.SelectedValue = schemeDetailsVo.LoanPartner.ToString(); ddlLoanType.SelectedValue = schemeDetailsVo.LoanType.ToString(); BindBorrowerType(int.Parse(ddlLoanType.SelectedValue)); ddlBorrowerType.SelectedValue = schemeDetailsVo.CustomerCategory.ToString(); if (schemeDetailsVo.IsFloatingRateInterest) { rdoFloatingRate.SelectedValue = "1"; gvAdviserInterestRates.HeaderRow.Cells[CONST_INTERESTE_RATE_COLUMN_ID].Text = "Diff. Interest Rate"; } else { rdoFloatingRate.SelectedValue = "0"; gvAdviserInterestRates.HeaderRow.Cells[CONST_INTERESTE_RATE_COLUMN_ID].Text = "Interest Rate"; } //} if (mode == Mode.View) { txtSchemeName.Enabled = false; txtMinLoanAmount.Enabled = false; txtMaxLoanAmount.Enabled = false; txtMinLoanPeriod.Enabled = false; txtMaxLoanPeriod.Enabled = false; txtPrimeLendingRate.Enabled = false; txtMargin.Enabled = false; txtMinAge.Enabled = false; txtMaxAge.Enabled = false; txtMinSalary.Enabled = false; txtMinimumProfitAmount.Enabled = false; txtMinimumProfitPeriod.Enabled = false; txtRemarks.Enabled = false; ddlLoanPartner.Enabled = false; ddlLoanType.Enabled = false; ddlBorrowerType.Enabled = false; rdoFloatingRate.Enabled = false; //lblSchemeName.Text = schemeDetailsVo.LoanSchemeName; //lblMinLoanAmount.Text = schemeDetailsVo.MinimunLoanAmount.ToString(); //lblMaxLoanAmount.Text = schemeDetailsVo.MaximumLoanAmount.ToString(); //lblMinLoanPeriod.Text = schemeDetailsVo.MinimumLoanPeriod.ToString(); //lblMaxLoanPeriod.Text = schemeDetailsVo.MaximumLoanPeriod.ToString(); //lblPrimeLendingRate.Text = schemeDetailsVo.PLR.ToString(); //lblMargin.Text = schemeDetailsVo.MarginMaintained.ToString(); //lblMinAge.Text = schemeDetailsVo.MinimumAge.ToString(); //lblMaxAge.Text = schemeDetailsVo.MaximumAge.ToString(); //lblMinSalary.Text = schemeDetailsVo.MinimumSalary.ToString(); //lblMinimumProfitAmount.Text = schemeDetailsVo.MinimumProfitAmount.ToString(); //lblMinimumProfitPeriod.Text = schemeDetailsVo.MinimumProfitPeriod.ToString(); //lblRemarks.Text = schemeDetailsVo.Remark; //lblBorrowerType.Text = GetBorrowerTypeName(schemeDetailsVo.CustomerCategory.ToString()); //lblLoanPartner.Text = GetLoanPartnerName(schemeDetailsVo.LoanPartner.ToString()); //lblLoanType.Text = GetLoanTypeName(schemeDetailsVo.LoanType.ToString()); //if (schemeDetailsVo.IsFloatingRateInterest) // lblFloatingRate.Text = "Yes"; //else // lblFloatingRate.Text = "No"; } int bType = int.Parse(schemeDetailsVo.CustomerCategory.ToString()); if (bType == 1 || bType == 2 || bType == 3) //|| bType == 5 { tblIndividual1.Visible = true; tblNonIndividual1.Visible = false; } else { tblIndividual1.Visible = false; tblNonIndividual1.Visible = true; } }
private void BindDocuments() { if (!IsPostBack && mode == Mode.Add) { return; } int customerType = 0; int loanTypeCode = 0; tblDocuments.Visible = true; if (mode == Mode.Add || mode == Mode.Edit) { if (ddlLoanType.SelectedValue != string.Empty) { loanTypeCode = int.Parse(ddlLoanType.SelectedValue); } if (ddlBorrowerType.SelectedValue != string.Empty) { customerType = int.Parse(ddlBorrowerType.SelectedValue); } } else { customerType = int.Parse(schemeDetailsVo.CustomerCategory.ToString()); loanTypeCode = int.Parse(schemeDetailsVo.LoanType.ToString()); } if (customerType == 0 || loanTypeCode == 0) { return; } List <SchemeProof> schemeProofs = LiabilitiesBo.GetDocumentsForBorrower(schemeId, customerType, loanTypeCode); tblDocuments.Rows.Clear(); foreach (SchemeProof schemeProof in schemeProofs) { TableRow tr = new TableRow(); TableCell tcProofType = new TableCell(); tcProofType.Text = "<b>" + schemeProof.proofTypeName + "</b>"; tcProofType.CssClass = "FieldName"; TableCell tcProof = new TableCell(); //CheckBoxList chkBoxList = new CheckBoxList(); //chkBoxList.ID = "chkDocuments"; foreach (Proof proof in schemeProof.proofs) { CheckBox chk = new CheckBox(); //chkBoxList.Items.Add(new ListItem(proof.proofName, proof.proofCode)); chk.ID = "chkLoan-" + proof.proofCode; chk.Text = proof.proofName; //chk.ToolTip = schemeProof.proofTypeCode + schemeProof.proofTypeName; if (proof.isAdded) { chk.Checked = true; } LiteralControl newline = new LiteralControl("<br/>"); if (mode == Mode.View) { chk.Enabled = false; } tcProof.Controls.Add(chk); tcProof.Controls.Add(newline); } tr.Cells.Add(tcProofType); tr.Cells.Add(tcProof); tblDocuments.Rows.Add(tr); } }