示例#1
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");
            }
        }