示例#1
0
        public void ScatterData()
        {
            ServiceLoanDisbursement _service = new ServiceLoanDisbursement();

            try
            {
                TBL_MP_HR_LoanDisbursement model = _service.GetLoanDisbursementInfoDbRecord(this.SelectedLoanDisbursementID);
                if (model != null)
                {
                    dtLoanDisbursementDate.Value = model.DisbursementDate;
                    cboLoanRequests.SelectedItem = ((List <SelectListItem>)cboLoanRequests.DataSource).Where(x => x.ID == model.FK_LoanRequestID).FirstOrDefault();
                    txtLoanAmount.Text           = string.Format("{0:0.00}", model.LoanAmount);
                    txtInterestRate.Text         = string.Format("{0:0.00}", model.InterestRate);
                    txttotalEMI.Text             = model.NoOfInstallment.ToString();
                    TxtEMIAmount.Text            = string.Format("{0:0.00}", model.InstallmentAmount);
                    dtDeductionFromDate.Value    = model.InstallmentStartDate;
                    cboPreparedBy.SelectedItem   = ((List <SelectListItem>)cboPreparedBy.DataSource).Where(x => x.ID == model.FK_PreparedBy).FirstOrDefault();
                    cboRequestTo.SelectedItem    = ((List <SelectListItem>)cboRequestTo.DataSource).Where(x => x.ID == model.FK_ApprovedBy).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLoanDisbursement::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
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;
 }
示例#3
0
 private void gridLoanDisbursement_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         this.SelectedLoanDisbursementID = (int)gridLoanDisbursement.Rows[e.RowIndex].Cells["DisbursementID"].Value;
         ServiceLoanDisbursement    service = new ServiceLoanDisbursement();
         TBL_MP_HR_LoanDisbursement model   = service.GetLoanDisbursementInfoDbRecord(this.SelectedLoanDisbursementID);
         if (model.ApprovalStatus == service.LOAN_DISBURSEMENT_STATUS_PENDING_ID)
         {
             btnApproveDisbursement.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
         }
         else
         {
             btnApproveDisbursement.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageLoanDisbursement::gridLoanDisbursement_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#4
0
        private void btnDeleteLoan_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceLoanDisbursement service = new ServiceLoanDisbursement();

                TBL_MP_HR_LoanDisbursement dbModel = service.GetLoanDisbursementInfoDbRecord(SelectedLoanDisbursementID);


                {
                    string       msg = "Are you sure to Delete selected Loan disbursement Permanently";
                    DialogResult res = MessageBox.Show(msg, "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (res == DialogResult.Yes)
                    {
                        if (dbModel.ApprovalStatus == service.LOAN_DISBURSEMENT_STATUS_PENDING_ID)
                        {
                            (new ServiceLoanDisbursement()).DeleteLoanDisbursement(this.SelectedLoanDisbursementID);
                            PopulateLoanDisbursmentGrid();
                        }
                        else
                        {
                            msg = "Unable to delete  selected Loan disbursement request..";
                            MessageBox.Show(msg, "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageLoanDisbursement::btnDeleteLoan_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
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);
            }
        }