protected void btnFinalize_Click(object sender, EventArgs e) { try { ///End the application process. InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter(); InvApp.UpdateApplicationStatus(5, MySessionManager.InvAppID); ///Converts the application into an account InvestmentDS.GetInvestmentAppDataTable rowInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID); if (rowInvApp.Rows.Count > 0) { InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter(); InvAcc.InsertInvAccount(rowInvApp[0].datInvestmentName, rowInvApp[0].datApplicationNumber, MySessionManager.ClientID, rowInvApp[0].datInvestmentType, rowInvApp[0].datTerms, rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, rowInvApp[0].datFrequencyOfInterestPayment, rowInvApp[0].datModeOfRepayment, rowInvApp[0].datAdvise, rowInvApp[0].datValueDate, rowInvApp[0].datInvestmentAmount, MySessionManager.CurrentUser.BranchID, 0, 0, 0, 0, 1, MySessionManager.InvAppID); ///Calculates the interest for the days elapsed before creation of the account int days = DateDiff(DateTime.Now, rowInvApp[0].datValueDate); int term = Convert.ToInt32(util.displayValue("opt_terms",rowInvApp[0].datTerms.ToString())); if (days > term) days = term; InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter InvAcc1 = new InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter(); if (days > 0) { decimal previousInt = calc_interest(MySessionManager.InvAppID, days); ///Insert a new record into the calculation table for the Daily chron-job InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(), MySessionManager.ClientID, rowInvApp[0].datApplicationNumber.ToString(), DateTime.Now.ToShortDateString(), rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, days, term, previousInt, previousInt); } else { // decimal previousInt = calc_interest(MySessionManager.InvAppID, days); ///Insert a new record into the calculation table for the Daily chron-job InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(), MySessionManager.ClientID, rowInvApp[0].datApplicationNumber.ToString(), DateTime.Now.ToShortDateString(), rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, 0, term, 0, 0); } } Response.Redirect("~/pages/invapplications.aspx"); } catch (Exception ex) { } }
protected void btnFinalize_Click(object sender, EventArgs e) { try { ///End the application process. InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter(); InvApp.UpdateApplicationStatus(5, MySessionManager.InvAppID); ///Converts the application into an account InvestmentDS.GetInvestmentAppDataTable rowInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID); if (rowInvApp.Rows.Count > 0) { InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter(); InvAcc.InsertInvAccount(rowInvApp[0].datInvestmentName, rowInvApp[0].datApplicationNumber, MySessionManager.ClientID, rowInvApp[0].datInvestmentType, rowInvApp[0].datTerms, rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, rowInvApp[0].datFrequencyOfInterestPayment, rowInvApp[0].datModeOfRepayment, rowInvApp[0].datAdvise, rowInvApp[0].datValueDate, rowInvApp[0].datInvestmentAmount, MySessionManager.CurrentUser.BranchID, 0, 0, 0, 0, 1, MySessionManager.InvAppID); ///Calculates the interest for the days elapsed before creation of the account int days = DateDiff(DateTime.Now, rowInvApp[0].datValueDate); int term = Convert.ToInt32(util.displayValue("opt_terms", rowInvApp[0].datTerms.ToString())); if (days > term) { days = term; } InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter InvAcc1 = new InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter(); if (days > 0) { decimal previousInt = calc_interest(MySessionManager.InvAppID, days); ///Insert a new record into the calculation table for the Daily chron-job InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(), MySessionManager.ClientID, rowInvApp[0].datApplicationNumber.ToString(), DateTime.Now.ToShortDateString(), rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, days, term, previousInt, previousInt); } else { // decimal previousInt = calc_interest(MySessionManager.InvAppID, days); ///Insert a new record into the calculation table for the Daily chron-job InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(), MySessionManager.ClientID, rowInvApp[0].datApplicationNumber.ToString(), DateTime.Now.ToShortDateString(), rowInvApp[0].datInvestmentAmount, rowInvApp[0].datInterestRatePerAnnum, 0, term, 0, 0); } } Response.Redirect("~/pages/invapplications.aspx"); } catch (Exception ex) { } }