public void createNewApp()
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        string AppID;
        string AppNewID = "";
        try
        {
            LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter RefreshAccount = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
            LoanAccountDS.GetAccountRefreshmentRecordDataTable tblRefreshAccount = RefreshAccount.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));

            if (tblRefreshAccount.Rows.Count>0)
            {
                MySessionManager.AppID = tblRefreshAccount[0].datNewAppID;
            }
            else
            {
                int? getAppID = null;

                AppID = tblLoanAcc.datApplicationID.ToString();
                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter LoanAccRefreshment = new LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter();

                string appNo = loanApp.GetLoanApplicationNo(Convert.ToInt32(AppID)).ToString() + "-00";
                LoanAccRefreshment.InsertNewRefreshApp(MySessionManager.ClientID,
                                                       tblLoanAcc.datClientFullName.ToString(),
                                                       Convert.ToInt32(ddlLoanType.SelectedValue),
                                                       appNo,
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToInt32(txtDuration.Text),
                                                       1,
                                                       Convert.ToDecimal(txtIntRate.Text),
                                                       DateTime.Now,
                                                       Convert.ToDateTime(txtFirstPaymentDate.Text),
                                                       0,
                                                       Convert.ToInt32(ddlInterestRateType.SelectedValue),
                                                       Convert.ToInt32(AppID),
                                                       Convert.ToInt32(ddlCT.SelectedValue),
                                                       Convert.ToInt32(tblLoanAcc.datTeamID),
                                                       ref getAppID);

                AppNewID = getAppID.ToString();

                LoanAccRefreshment.InsertCopyAssets(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyAuditors(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyBankers(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyChecklist(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCollaterals(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyComments(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCorporateInfo(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCreditInformation(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyEnterprises(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFinancials(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyGuarantor(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIncomeExpense(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIntiator(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyLegalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNextOfKin(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNoOfEmployees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyOwnership(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPaymentPlan(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPDC(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPreApprovalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReligion(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyRiskReport(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySpouse(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySupportingDocuments(AppID, AppNewID);

                LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
                loanAcRef.InsertAccountRefreshment(Convert.ToInt32(MySessionManager.AccountID),
                                                   Convert.ToInt32(AppID));
                loanAcRef.UpdateNewAppID(Convert.ToInt32(AppNewID),
                                         Convert.ToInt32(MySessionManager.AccountID));
                MySessionManager.AppID = Convert.ToInt32(AppNewID);
            }
        }
        catch (Exception ex) { }
    }
Пример #2
0
    public void createNewApp()
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        string AppID;
        string AppNewID = "";

        try
        {
            LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter RefreshAccount = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
            LoanAccountDS.GetAccountRefreshmentRecordDataTable tblRefreshAccount = RefreshAccount.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));

            if (tblRefreshAccount.Rows.Count > 0)
            {
                MySessionManager.AppID = tblRefreshAccount[0].datNewAppID;
            }
            else
            {
                int?getAppID = null;

                AppID = tblLoanAcc.datApplicationID.ToString();
                LoanDSTableAdapters.LoanApplicationsTableAdapter          loanApp            = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter LoanAccRefreshment = new LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter();

                string appNo = loanApp.GetLoanApplicationNo(Convert.ToInt32(AppID)).ToString() + "-00";
                LoanAccRefreshment.InsertNewRefreshApp(MySessionManager.ClientID,
                                                       tblLoanAcc.datClientFullName.ToString(),
                                                       Convert.ToInt32(ddlLoanType.SelectedValue),
                                                       appNo,
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToInt32(txtDuration.Text),
                                                       1,
                                                       Convert.ToDecimal(txtIntRate.Text),
                                                       DateTime.Now,
                                                       Convert.ToDateTime(txtFirstPaymentDate.Text),
                                                       0,
                                                       Convert.ToInt32(ddlInterestRateType.SelectedValue),
                                                       Convert.ToInt32(AppID),
                                                       Convert.ToInt32(ddlCT.SelectedValue),
                                                       Convert.ToInt32(tblLoanAcc.datTeamID),
                                                       ref getAppID);

                AppNewID = getAppID.ToString();

                LoanAccRefreshment.InsertCopyAssets(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyAuditors(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyBankers(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyChecklist(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCollaterals(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyComments(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCorporateInfo(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCreditInformation(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyEnterprises(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFinancials(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyGuarantor(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIncomeExpense(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIntiator(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyLegalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNextOfKin(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNoOfEmployees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyOwnership(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPaymentPlan(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPDC(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPreApprovalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReligion(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyRiskReport(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySpouse(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySupportingDocuments(AppID, AppNewID);

                LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
                loanAcRef.InsertAccountRefreshment(Convert.ToInt32(MySessionManager.AccountID),
                                                   Convert.ToInt32(AppID));
                loanAcRef.UpdateNewAppID(Convert.ToInt32(AppNewID),
                                         Convert.ToInt32(MySessionManager.AccountID));
                MySessionManager.AppID = Convert.ToInt32(AppNewID);
            }
        }
        catch (Exception ex) { }
    }