Example #1
0
 private void btnApproveDisbursement_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         string strMessage = "Are You sure to Approve Selected Loan";
         if (MessageBox.Show(strMessage, "Continue", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             ServiceLoanDisbursement    service = new ServiceLoanDisbursement();
             TBL_MP_HR_LoanDisbursement model   = service.GetLoanDisbursementInfoDbRecord(this.SelectedLoanDisbursementID);
             model.ApprovalStatus = service.LOAN_DISBURSEMENT_APPROVED_ID;
             model.FK_ApprovedBy  = Program.CURR_USER.EmployeeID;
             service.UpdateLoanDisbursement(model);
             PopulateLoanDisbursmentGrid();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageLoanDisbursement::btnApproveDisbursement_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;
 }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            TBL_MP_HR_LoanDisbursement model = null;

            ServiceLoanDisbursement service = new ServiceLoanDisbursement();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }
                if (this.SelectedLoanDisbursementID == 0)
                {
                    model = new TBL_MP_HR_LoanDisbursement();
                }
                else
                {
                    model = service.GetLoanDisbursementInfoDbRecord(this.SelectedLoanDisbursementID);
                }

                #region GATHER DATA INTO MODEL FROM VIEW

                model.DisbursementDate     = dtLoanDisbursementDate.Value;
                model.FK_LoanRequestID     = ((SelectListItem)cboLoanRequests.SelectedItem).ID;
                model.FK_EmployeeID        = this.EmployeeID;
                model.LoanAmount           = decimal.Parse(txtLoanAmount.Text.Trim());
                model.InterestRate         = decimal.Parse(txtInterestRate.Text.Trim());
                model.NoOfInstallment      = int.Parse(txttotalEMI.Text.Trim());
                model.InstallmentAmount    = decimal.Parse(TxtEMIAmount.Text.Trim());
                model.InstallmentStartDate = dtDeductionFromDate.Value;
                model.FK_PreparedBy        = ((SelectListItem)cboPreparedBy.SelectedItem).ID;
                model.FK_ApprovedBy        = ((SelectListItem)cboRequestTo.SelectedItem).ID;
                model.Remarks = txtRemarks.Text.Trim();

                #endregion
                if (this.SelectedLoanDisbursementID == 0)
                {
                    model.FK_YearID    = Program.CURR_USER.FinYearID;
                    model.FK_BranchID  = Program.CURR_USER.BranchID;
                    model.FK_CompanyID = Program.CURR_USER.CompanyID;

                    this.SelectedLoanDisbursementID = service.AddNewLoanDisbursement(model);
                }
                else
                {
                    service.UpdateLoanDisbursement(model);
                }

                this.DialogResult = DialogResult.OK;
            }

            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLoanDisbursement::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }