示例#1
0
 private void LoanAssesment_Load(object sender, EventArgs e)
 {
     try
     {
         SBFAApi agent = new SBFAApi();
         using (new OperationContextScope(agent.context))
         {
             sbfa.LoanAssesment ass = agent.operation.GetLoanAssesment(SBFAMain.currentId);
             txtAmount.Text             = ass.LoanAmount.ToString();
             txtAnanlysis.Text          = ass.Analysis;
             txtCondition.Text          = ass.Condition;
             txtFee.Text                = ass.ProcessingFee.ToString();
             txtFinancial.Text          = ass.FinancialCommitment;
             txtGrace.Text              = ass.GracePeriod.ToString();
             txtMonthly.Text            = ass.MonthlyRepayment.ToString();
             txtPayback.Text            = ass.PaybackPeriod.ToString();
             txtTotal.Text              = (ass.LoanAmount - ass.ProcessingFee).ToString();
             txtProposedLoanAmount.Text = ass.ProposedLoanAmount.ToString();
             gridSuppliers.DataSource   = ass.Supplier;
             gridSuppliers.RefreshDataSource();
         }
     }
     catch
     {
         ShowErrorMessage("Error initializing assesment");
     }
 }
示例#2
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    sbfa.LoanAssesment ass = new sbfa.LoanAssesment();
                    ass.FK_LoanRequestId    = SBFAMain.currentId;
                    ass.LoanAmount          = float.Parse(txtAmount.Text);
                    ass.Analysis            = txtAnanlysis.Text;
                    ass.Condition           = txtCondition.Text;
                    ass.ProcessingFee       = float.Parse(txtFee.Text);
                    ass.FinancialCommitment = txtFinancial.Text;
                    ass.GracePeriod         = int.Parse(txtGrace.Text);
                    ass.MonthlyRepayment    = float.Parse(txtMonthly.Text);
                    ass.PaybackPeriod       = int.Parse(txtPayback.Text);
                    ass.Total = float.Parse(txtTotal.Text);
                    ass.ProposedLoanAmount = float.Parse(txtProposedLoanAmount.Text);

                    List <sbfa.LoanAssesmentSupplier> supplier = new List <sbfa.LoanAssesmentSupplier>();

                    for (int a = 0; a < gridViewSuppliers.RowCount; a++)
                    {
                        sbfa.LoanAssesmentSupplier temp = new sbfa.LoanAssesmentSupplier();
                        temp.Price            = float.Parse(gridViewSuppliers.GetRowCellValue(a, gridViewSuppliers.Columns[5]).ToString());
                        temp.Quantity         = float.Parse(gridViewSuppliers.GetRowCellValue(a, gridViewSuppliers.Columns[3]).ToString());
                        temp.Description      = (gridViewSuppliers.GetRowCellValue(a, gridViewSuppliers.Columns[2]).ToString());
                        temp.FK_LoanRequestId = SBFAMain.currentId;
                        temp.PriceDisbursed   = 0;
                        temp.Id       = ass.Id;
                        temp.Currency = "SCR";
                        temp.Supplier = (gridViewSuppliers.GetRowCellValue(a, gridViewSuppliers.Columns[1]).ToString());
                    }

                    sbfa.LoanAssesmentSupplier[] supps = supplier.ToArray();
                    ass.Supplier = supps;

                    bool save = agent.operation.SaveLoanAssesment(ass);
                    if (save)
                    {
                        ShowSuccessMessage("Saved Successfully!!");
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Error saving assesment");
            }
        }
示例#3
0
 private void btnRefreshSuppliers_Click(object sender, EventArgs e)
 {
     try
     {
         SBFAApi agent = new SBFAApi();
         using (new OperationContextScope(agent.context))
         {
             sbfa.LoanAssesment ass = agent.operation.GetLoanAssesment(SBFAMain.currentId);
             gridSuppliers.DataSource = ass.Supplier;
             gridSuppliers.RefreshDataSource();
         }
     }
     catch
     {
         ShowErrorMessage("Error processing");
     }
 }
示例#4
0
        private void btnDeleteSupplier_Click(object sender, EventArgs e)
        {
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    sbfa.LoanAssesment ass = new sbfa.LoanAssesment();
                    ass.FK_LoanRequestId    = SBFAMain.currentId;
                    ass.LoanAmount          = float.Parse(txtAmount.Text);
                    ass.Analysis            = txtAnanlysis.Text;
                    ass.Condition           = txtCondition.Text;
                    ass.ProcessingFee       = float.Parse(txtFee.Text);
                    ass.FinancialCommitment = txtFinancial.Text;
                    ass.GracePeriod         = int.Parse(txtGrace.Text);
                    ass.MonthlyRepayment    = float.Parse(txtMonthly.Text);
                    ass.PaybackPeriod       = int.Parse(txtPayback.Text);

                    sbfa.LoanAssesmentSupplier temp = new sbfa.LoanAssesmentSupplier();
                    temp.Price            = 0;
                    temp.Quantity         = 0;
                    temp.Description      = "";
                    temp.FK_LoanRequestId = SBFAMain.currentId;
                    temp.PriceDisbursed   = 0;
                    temp.Id       = ass.Id;
                    temp.Currency = "SCR";
                    temp.Supplier = gridViewSuppliers.GetRowCellValue(gridViewSuppliers.FocusedRowHandle, gridViewSuppliers.Columns[1]).ToString();

                    sbfa.LoanAssesmentSupplier[] supps = new sbfa.LoanAssesmentSupplier[] { temp };
                    ass.Supplier = supps;

                    bool save = agent.operation.DeleteLoanAssesment(ass);
                    if (save)
                    {
                        sbfa.LoanAssesment assL = agent.operation.GetLoanAssesment(SBFAMain.currentId);
                        gridSuppliers.DataSource = assL.Supplier;
                        gridSuppliers.RefreshDataSource();
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Error deleting supplier");
            }
        }
示例#5
0
        private void btnAddSupplier_Click_1(object sender, EventArgs e)
        {
            if (txtPrice.Text == "" || txtQuantity.Text == "")
            {
                ShowErrorMessage("Enter valid supplier details");
                return;
            }

            if (txtSupplier.Text == "" || float.Parse(txtPrice.Text) <= 0 || float.Parse(txtQuantity.Text) <= 0)
            {
                ShowErrorMessage("Enter valid supplier details");
                return;
            }
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    sbfa.LoanAssesment ass = new sbfa.LoanAssesment();
                    ass.FK_LoanRequestId    = SBFAMain.currentId;
                    ass.LoanAmount          = float.Parse(txtAmount.Text);
                    ass.Analysis            = txtAnanlysis.Text;
                    ass.Condition           = txtCondition.Text;
                    ass.ProcessingFee       = float.Parse(txtFee.Text);
                    ass.FinancialCommitment = txtFinancial.Text;
                    ass.GracePeriod         = int.Parse(txtGrace.Text);
                    ass.MonthlyRepayment    = float.Parse(txtMonthly.Text);
                    ass.PaybackPeriod       = int.Parse(txtPayback.Text);

                    ass.Total = float.Parse(txtTotal.Text);
                    ass.ProposedLoanAmount = float.Parse(txtProposedLoanAmount.Text);

                    sbfa.LoanAssesmentSupplier temp = new sbfa.LoanAssesmentSupplier();
                    temp.Price            = float.Parse(txtPrice.Text);
                    temp.Quantity         = float.Parse(txtQuantity.Text);
                    temp.Description      = (txtDesc.Text);
                    temp.FK_LoanRequestId = SBFAMain.currentId;
                    temp.PriceDisbursed   = 0;
                    temp.Id       = ass.Id;
                    temp.Currency = "SCR";
                    temp.Supplier = (txtSupplier.Text);

                    sbfa.LoanAssesmentSupplier[] supps = new sbfa.LoanAssesmentSupplier[] { temp };
                    ass.Supplier = supps;

                    bool save = agent.operation.SaveLoanAssesment(ass);
                    if (save)
                    {
                        ShowSuccessMessage("Saved Succesfully!!");

                        sbfa.LoanAssesment assL = agent.operation.GetLoanAssesment(SBFAMain.currentId);
                        gridSuppliers.DataSource = assL.Supplier;
                        gridSuppliers.RefreshDataSource();
                    }
                    else
                    {
                        ShowErrorMessage("Please ensure your amounts are valid");
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Error adding supplier");
            }
        }