예제 #1
0
        public void ScatterData()
        {
            ServiceLoanRequest _service = new ServiceLoanRequest();

            try
            {
                TBL_MP_HR_LoanRequestApplication model = _service.GetLoanRequestInfoDbRecord(this.LoanRequestID);
                if (model != null)
                {
                    txtLoanRequestNo.Text       = model.LoanRequestNo;
                    dtLoanRequestDate.Value     = model.LoanRequestDate;
                    cboEmployees.SelectedItem   = ((List <SelectListItem>)cboEmployees.DataSource).Where(x => x.ID == model.FK_EmployeeID).FirstOrDefault();
                    cboRequestTo.SelectedItem   = ((List <SelectListItem>)cboRequestTo.DataSource).Where(x => x.ID == model.RequestTo).FirstOrDefault();
                    txtRemarks.Text             = model.Remarks;
                    txtRequestedLoanAmount.Text = model.RequestedLoanAmount.ToString();
                    if (model.ProposedDisbursementDate != null)
                    {
                        dtDisbursementDate.Value = (DateTime)model.ProposedDisbursementDate;
                    }
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLoanRequest::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 private void gridLoanRequest_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         this.SelectedLoanRequestID = (int)(gridLoanRequest.Rows[e.RowIndex].Cells["PK_LoanRequestID"].Value);
         int approvalStatusID       = (int)(gridLoanRequest.Rows[e.RowIndex].Cells["ApprovalStatus"].Value);
         ServiceLoanRequest service = new ServiceLoanRequest();
         if (approvalStatusID != service.REQUEST_STATUS_PENDING_ID)
         {
             btnEditLoanRequest.Enabled = btnDeleteLoanRequest.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
         }
         else
         {
             btnEditLoanRequest.Enabled = btnDeleteLoanRequest.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageUserInfo::gridLoanRequest_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            TBL_MP_HR_LoanRequestApplication model = null;

            ServiceLoanRequest service = new ServiceLoanRequest();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }
                if (this.LoanRequestID == 0)
                {
                    model = new TBL_MP_HR_LoanRequestApplication();
                }
                else
                {
                    model = service.GetLoanRequestInfoDbRecord(this.LoanRequestID);
                }

                #region GATHER DATA INTO MODEL FROM VIEW

                model.LoanRequestNo            = txtLoanRequestNo.Text.Trim();
                model.LoanRequestDate          = dtLoanRequestDate.Value;
                model.ProposedDisbursementDate = dtDisbursementDate.Value;
                model.FK_EmployeeID            = ((SelectListItem)cboEmployees.SelectedItem).ID;
                model.RequestTo           = ((SelectListItem)cboRequestTo.SelectedItem).ID;
                model.RequestedLoanAmount = decimal.Parse(txtRequestedLoanAmount.Text.Trim());
                model.Remarks             = txtRemarks.Text.Trim();

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

                    this.LoanRequestID = service.AddNewLoanRequest(model);
                }
                else
                {
                    service.UpdateLoanRequest(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, "frmAddEditLoanRequest::btnOk_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         errorProvider1.Clear();
         if (!this.ValidateChildren())
         {
             return;
         }
         ServiceLoanRequest service             = new ServiceLoanRequest();
         TBL_MP_HR_LoanRequestApplication model = service.GetLoanRequestInfoDbRecord(this.LoanRequestID);
         if (model != null)
         {
             model.RemarksApproved = txtApprovalRemarks.Text.Trim();
             model.FK_ApprovedBy   = Program.CURR_USER.EmployeeID;
             if (rbtnApproveLoanRequest.Checked)
             {
                 model.ApprovalStatus = service.REQUEST_STATUS_APPROVED_ID;
             }
             if (rbtnRejectLoanRequest.Checked)
             {
                 model.ApprovalStatus = service.REQUEST_STATUS_REJECTED_ID;
             }
             model.ApprovalDate   = dtApprovalDate.Value;
             model.ApprovedAmount = decimal.Parse(txtApprovedAmount.Text.Trim());
             // put validation on this
             service.UpdateLoanRequest(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, "frmApproveRejectLoanRequest::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #5
0
        private void btnDeleteLoanRequest_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceLoanRequest service = new ServiceLoanRequest();

                TBL_MP_HR_LoanRequestApplication dbModel = service.GetLoanRequestInfoDbRecord(SelectedLoanRequestID);


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

                    if (res == DialogResult.Yes)
                    {
                        if (dbModel.ApprovalStatus == service.REQUEST_STATUS_PENDING_ID)
                        {
                            (new ServiceLoanRequest()).DeleteLoanRequest(this.SelectedLoanRequestID);
                            PopulateLoanRequestGrid();
                        }
                        else
                        {
                            msg = "Unable to delete  selected Loan 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, "PageMyAdvanceRequests::btnDeleteAdvanceRequests_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private void gridLoanRegister_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                ServiceLoanRequest service = new ServiceLoanRequest();
                this.LoanRequestID = (int)(gridLoanRequestRegister.Rows[e.RowIndex].Cells["PK_LoanRequestID"].Value);
                TBL_MP_HR_LoanRequestApplication model = service.GetLoanRequestInfoDbRecord(this.LoanRequestID);

                //if (AppCommon.GetServerDateTime() < model.RequestDate)
                //    btnApproveReject.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                //else
                //    btnApproveReject.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, "PageLoanRequestRegister::gridLoanRegister_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void frmApproveRejectLoanRequest_Load(object sender, EventArgs e)
        {
            // try getting edmx again for view
            try
            {
                ServiceLoanRequest      service = new ServiceLoanRequest();
                vLoanRequestApplication model   = service.GetLoanRequestViewDbRecord(this.LoanRequestID);
                if (model != null)
                {
                    txtLoanRequestNo.Text           = string.Format("{0} dt. {1}", model.LoanRequestNo, model.LoanRequestDate.Value.ToString("dd MMM yy"));
                    dtApprovalDate.Value            = (DateTime)model.LoanRequestDate;
                    txtLoanRequestDescription.Text  = model.EmployeeName;
                    txtLoanRequestDescription.Text += string.Format("\nAmount: {0:0.00}\nRemarks: {1}", model.RequestedLoanAmount, model.Remarks);

                    if (model.ApprovalStatus == service.REQUEST_STATUS_APPROVED_ID)
                    {
                        rbtnApproveLoanRequest.Checked = true;
                    }
                    if (model.ApprovalStatus == service.REQUEST_STATUS_REJECTED_ID)
                    {
                        rbtnRejectLoanRequest.Checked = true;
                    }

                    txtApprovedAmount.Text  = model.ApprovedAmount.ToString();
                    txtApprovalRemarks.Text = model.RemarksApproved;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmApproveRejectLoanRequest::frmApproveRejectLoanRequest_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }