예제 #1
0
파일: Guarantor.cs 프로젝트: msifi/SBFA
        private void gridViewGuarantors_Click(object sender, EventArgs e)
        {
            try
            {
                string currentNIN = (gridViewGuarantors.GetRowCellValue(gridViewGuarantors.FocusedRowHandle, gridViewGuarantors.Columns[0]).ToString());

                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    //check from local db first for details
                    sbfa.Guarantor guarantor = agent.operation.GetLoanRequestGuarantor(currentNIN, SBFAMain.currentId);

                    //  guarantor.GuarantorNIN = txtDonorNIN.Text;
                    txtDonorName.Text               = guarantor.GuarantorName;
                    txtDonorSurname.Text            = guarantor.GuarantorSurname;
                    dtDonorDOB.DateTime             = guarantor.GuarantorDOB;
                    txtDonorAddress.Text            = guarantor.GuarantorAddress;
                    txtDonorContactNo.Text          = guarantor.GuarantorContactNo;
                    cmbDonorMaritalStatus.Text      = guarantor.GuarantorMaritalStatus;
                    txtDonorNoOfDependents.Text     = guarantor.GuarantorNoOfDependents;
                    cmbDonorEmploymentStatus.Text   = guarantor.GuarantorEmploymentStatus;
                    txtDonorEmployerAddress.Text    = guarantor.GuarantorEmployersAddress;
                    txtDonorEmployerName.Text       = guarantor.GuarantorEmployersName;
                    txtDonorCurrentPosition.Text    = guarantor.GuarantorCurrentPosition;
                    txtDonorYearsOfEmployment.Text  = guarantor.GuarantorNoOfYears.ToString();
                    txtDonorMonthlyIncome.Text      = guarantor.GuarantorTotalMonthlyIncome.ToString();
                    txtDonorMonthlyExpenditure.Text = guarantor.GuarantorTotalMonthlyExpenditure.ToString();
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error loading guarantor");
            }
        }
예제 #2
0
파일: Guarantor.cs 프로젝트: msifi/SBFA
        private void txtDonorNIN_Leave(object sender, EventArgs e)
        {
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    //check from local db first for details
                    sbfa.Guarantor guarantor = agent.operation.GetGuarantor(txtDonorNIN.Text);

                    if (guarantor == null || guarantor.GuarantorName == null)
                    {
                        sbfa.Resident response = agent.operation.GetResident(txtDonorNIN.Text);

                        txtDonorName.Text    = response.FirstName;
                        txtDonorSurname.Text = response.Surname;

                        dtDonorDOB.DateTime = response.DateOfBirth;

                        if (response.FirstName == "")
                        {
                            txtDonorNIN.Text = "";
                        }
                    }
                    else
                    {
                        //  guarantor.GuarantorNIN = txtDonorNIN.Text;
                        txtDonorName.Text               = guarantor.GuarantorName;
                        txtDonorSurname.Text            = guarantor.GuarantorSurname;
                        dtDonorDOB.DateTime             = guarantor.GuarantorDOB;
                        txtDonorAddress.Text            = guarantor.GuarantorAddress;
                        txtDonorContactNo.Text          = guarantor.GuarantorContactNo;
                        cmbDonorMaritalStatus.Text      = guarantor.GuarantorMaritalStatus;
                        txtDonorNoOfDependents.Text     = guarantor.GuarantorNoOfDependents;
                        cmbDonorEmploymentStatus.Text   = guarantor.GuarantorEmploymentStatus;
                        txtDonorEmployerAddress.Text    = guarantor.GuarantorEmployersAddress;
                        txtDonorEmployerName.Text       = guarantor.GuarantorEmployersName;
                        txtDonorCurrentPosition.Text    = guarantor.GuarantorCurrentPosition;
                        txtDonorYearsOfEmployment.Text  = guarantor.GuarantorNoOfYears.ToString();
                        txtDonorMonthlyIncome.Text      = guarantor.GuarantorTotalMonthlyIncome.ToString();
                        txtDonorMonthlyExpenditure.Text = guarantor.GuarantorTotalMonthlyExpenditure.ToString();
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Failed to validate with national database");
            }
        }
예제 #3
0
파일: Guarantor.cs 프로젝트: msifi/SBFA
        private void btnAddGuarantor_Click(object sender, EventArgs e)
        {
            try
            {
                SBFAApi agent = new SBFAApi();
                using (new OperationContextScope(agent.context))
                {
                    sbfa.Guarantor gua = new sbfa.Guarantor();
                    gua.FK_BusinessRegistrationId = SBFAMain.currentId;
                    gua.GuarantorNIN                     = txtDonorNIN.Text;
                    gua.GuarantorName                    = txtDonorName.Text;
                    gua.GuarantorSurname                 = txtDonorSurname.Text;
                    gua.GuarantorDOB                     = dtDonorDOB.DateTime;
                    gua.GuarantorAddress                 = txtDonorAddress.Text;
                    gua.GuarantorContactNo               = txtDonorContactNo.Text;
                    gua.GuarantorMaritalStatus           = cmbDonorMaritalStatus.Text;
                    gua.GuarantorNoOfDependents          = txtDonorNoOfDependents.Text;
                    gua.GuarantorEmploymentStatus        = cmbDonorEmploymentStatus.Text;
                    gua.GuarantorEmployersAddress        = txtDonorEmployerAddress.Text;
                    gua.GuarantorEmployersName           = txtDonorEmployerName.Text;
                    gua.GuarantorCurrentPosition         = txtDonorCurrentPosition.Text;
                    gua.GuarantorNoOfYears               = Globals.GetIntValue(txtDonorYearsOfEmployment);
                    gua.GuarantorTotalMonthlyIncome      = Globals.GetFloatValue(txtDonorMonthlyIncome);
                    gua.GuarantorTotalMonthlyExpenditure = Globals.GetFloatValue(txtDonorMonthlyExpenditure);

                    long save = agent.operation.SaveLoanRequestGuarantor(gua);
                    if (save > 0)
                    {
                        MessageBox.Show("Saved!!");

                        sbfa.Guarantor[] guas = agent.operation.GetGuarantors(SBFAMain.currentId);
                        gridGuarantors.DataSource = guas;
                        gridGuarantors.RefreshDataSource();
                    }
                }
            }
            catch
            {
                ShowErrorMessage("Error saving guarantor");
            }
        }