Exemplo n.º 1
0
        public void BindLoans()
        {
            LoanManager oManager = new LoanManager();

            oManager.ConnectionString = this.ConnectionString;
            oManager.Open();
            grdCtlLoanInfo.DataSource = oManager.GetLoans();
            grdCtlLoanInfo.Refresh();
            oManager.Close();
        }
Exemplo n.º 2
0
        private void txtStatus_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                if (txtStatus.Text == "Draft")
                {

                    if (MessageBox.Show("Are you sure you want to approved this document? This action is irreversible!!!", "Post", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        LoanManager oManager = new LoanManager();

                        oManager.ConnectionString = this.ConnectionString;
                        oManager.Open();

                        oManager.Approved(txtLoanNo.Text);

                        oManager.Close();

                        MessageBox.Show("Successfully approved!!!", "Posted", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        txtStatus.Text = "Approved";
                    }
                    else
                    {
                        return;
                    }
                }
                else if (txtStatus.Text == "Approved")
                {
                    if (MessageBox.Show("Are you sure you want to post this document? This action is irreversible!!!", "Post", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        LoanManager oManager = new LoanManager();

                        oManager.ConnectionString = this.ConnectionString;
                        oManager.Open();

                        oManager.PostDocument(txtLoanNo.Text);

                        oManager.Close();

                        MessageBox.Show("Successfully posted!!!", "Posted", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        txtStatus.Text = "Posted";
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else if (e.Button.Index == 1)
            {
                if (txtStatus.Text == "Draft")
                {
                    if (MessageBox.Show("Are you sure you want to cancel this document? This action is irreversible!!!", "Post", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        LoanManager oManager = new LoanManager();

                        oManager.ConnectionString = this.ConnectionString;
                        oManager.Open();

                        oManager.CancelDocument(txtLoanNo.Text);

                        oManager.Close();

                        MessageBox.Show("Successfully cancelled!!!", "Posted", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        txtStatus.Text = "Canceled";
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to close this document? This action is irreversible!!!", "Post", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        LoanManager oManager = new LoanManager();

                        oManager.ConnectionString = this.ConnectionString;
                        oManager.Open();

                        oManager.CloseDocument(txtLoanNo.Text);

                        oManager.Close();

                        MessageBox.Show("Successfully closed!!!", "Closed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        txtStatus.Text = "Closed";
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void txtPayment_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                if (txtStatus.Text == "Draft")
                {
                    MessageBox.Show("Your not able to add payment to draft documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (txtStatus.Text == "Approved")
                {
                    MessageBox.Show("Your not able to add payment to approved documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (txtStatus.Text == "Closed" || txtStatus.Text == "Canceled")
                {
                    MessageBox.Show("Your not able to add payment to closed documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                addCollection oform = new addCollection();
                int iFocusedRowIndex = gridView1.FocusedRowHandle;

                oform.ConnectionString = this.ConnectionString;
                oform.ActiveUserID = this.ActiveUserID;
                oform.LoanNumber = txtLoanNo.Text;

                oform.ScheduledNo = Convert.ToInt16(gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduleNo"]));

                oform.ShowDialog();

                LoanManager oManager = new LoanManager();

                oManager.ConnectionString = this.ConnectionString;
                oManager.Open();

                this.LineScheduleOfPayment = oManager.GetLoanInfoLineItems(txtLoanNo.Text);

                oManager.Close();

                gridControl1.DataSource = this.LineScheduleOfPayment;
                gridControl1.Refresh();

                BindCollections(txtLoanNo.Text);
                ComputeOutstandingBalance();
            }
            else
            {
                PaymentBreakdown oForm = new PaymentBreakdown();
                int iFocusedRowIndex = gridView1.FocusedRowHandle;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ScheduleNo = Convert.ToInt16(gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduleNo"]));
                oForm.DocumentNumber = txtLoanNo.Text;

                oForm.ShowDialog();
                ComputeOutstandingBalance();
            }
        }
Exemplo n.º 4
0
        private void txtOtherCharges_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                if (txtStatus.Text == "Draft")
                {
                    MessageBox.Show("Your not able to add charges to draft documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtStatus.Text == "Approved")
                {
                    MessageBox.Show("Your not able to add charges to approved status documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtStatus.Text == "Closed" || txtStatus.Text == "Canceled")
                {
                    MessageBox.Show("Your not able to add charges to canceled or closed documents!!!", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                addOtherCharges oForm = new addOtherCharges();

                int iFocusedRowIndex = gridView1.FocusedRowHandle;
                string sScheduleNo = gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduleNo"]).ToString();
                DateTime dtDueDate = (DateTime)gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduledDate"]);

                oForm.ConnectionString = this.ConnectionString;
                oForm.DocumentNumber = txtLoanNo.Text;
                oForm.ScheduleNo = sScheduleNo;
                oForm.ScheduledDate = dtDueDate;

                oForm.ShowDialog();

                LoanManager oManager = new LoanManager();

                oManager.ConnectionString = this.ConnectionString;
                oManager.Open();
                this.LineScheduleOfPayment = oManager.GetLoanInfoLineItems(txtLoanNo.Text);
                oManager.Close();

                gridControl1.DataSource = this.LineScheduleOfPayment;
                gridControl1.Refresh();

                barSaveLoan.Caption = "Update";
                txtLoanNo.Enabled = false;

                BindCashReleased();
                BindCollections(txtLoanNo.Text);
                ComputeOutstandingBalance();
            }
            else
            {
                detailOtherCharges oForm = new detailOtherCharges();

                int iFocusedRowIndex = gridView1.FocusedRowHandle;
                string sScheduleNo = gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduleNo"]).ToString();
                DateTime dtDueDate = (DateTime)gridView1.GetRowCellValue(iFocusedRowIndex, gridView1.Columns["ScheduledDate"]);

                oForm.ConnectionString = this.ConnectionString;
                oForm.DocumentNumber = txtLoanNo.Text;
                oForm.ScheduleNo = sScheduleNo;
                oForm.ShowDialog();
                ComputeOutstandingBalance();
            }
        }
Exemplo n.º 5
0
        private void barSaveLoan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (barSaveLoan.Caption == "Save")
            {
                LoanManager oConnectionManager = new LoanManager();
                LoanUnit oUnit = new LoanUnit();

                if (txtCardCode.Text == "")
                {
                    MessageBox.Show("Please select borrower before saving!!!", "Loan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (Convert.ToDouble(txtLoanAmount.EditValue) <= 0)
                {
                    MessageBox.Show("Please insert loan amount and click calculate button to generate schedule of payment!!!", "Loan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (this.LineScheduleOfPayment.Rows.Count <= 0)
                {
                    MessageBox.Show("Please click calculate button to generate schedule of payment!!!", "Loan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                txtLoanNo.Text = GetSeries();

                oConnectionManager.ConnectionString = this.ConnectionString;
                oConnectionManager.Open();

                if (oConnectionManager.IsExists(txtLoanNo.Text))
                {
                    MessageBox.Show("Loan Document Number is already exists!!!", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                oUnit.DocumentNumber = txtLoanNo.Text;
                oUnit.CardCode = txtCardCode.Text;
                oUnit.CardName = txtCardName.Text;
                oUnit.TransactionType = cboTransType.Text;
                oUnit.Guarantor = txtGuarrantor.Text;
                oUnit.LoanAmount = Convert.ToDouble(txtLoanAmount.Text.Replace(",", ""));
                oUnit.Terms = Convert.ToInt16(txtTerms.Text);
                oUnit.InterestRate = Convert.ToDouble(txtInterestRate.Text);
                oUnit.FrequencyOfPayment = cboFrequencyOfPayment.EditValue.ToString();
                oUnit.PayDayCode = cboPayDayCode.EditValue != null ? cboPayDayCode.EditValue.ToString() : "";
                oUnit.FirstDateOfPayment = (DateTime)dtStartOfPayment.EditValue;
                oUnit.ReleaseDate = (DateTime)dtDateOfRelease.EditValue;
                oUnit.MonthlyPayment = Convert.ToDouble(string.Format("{0}", txtAmortization.Text));
                oUnit.NumberOfPayment = Convert.ToInt16(txtNoOfPayments.Text);
                oUnit.TotalAmortization = Convert.ToDouble(string.Format("{0}", txtTotalAmortization.Text));
                oUnit.TotalInterest = Convert.ToDouble(txtTotalInterest.Text);

                oUnit.DocumentStatus = txtStatus.Text;
                oUnit.CreatedBy = this.ActiveUserID;
                oUnit.DateCreated = (DateTime)dtCreated.EditValue;
                oUnit.ModifiedBy = txtModifiedBy.Text;
                oUnit.DateModified = (DateTime)dtModified.EditValue;

                oConnectionManager.AddLoan(oUnit);

                oConnectionManager.AddLineItems(txtLoanNo.Text, this.LineScheduleOfPayment);
                oConnectionManager.Close();

                barSaveLoan.Caption = "Update";
                txtLoanNo.Enabled = false;

                MessageBox.Show("Adding completed successfully!!!", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                LoanManager oConnectionManager = new LoanManager();
                LoanUnit oUnit = new LoanUnit();

                oConnectionManager.ConnectionString = this.ConnectionString;
                oConnectionManager.Open();
                oUnit.DocumentNumber = txtLoanNo.Text;
                oUnit.CardCode = txtCardCode.Text;
                oUnit.CardName = txtCardName.Text;
                oUnit.TransactionType = cboTransType.Text;
                oUnit.Guarantor = txtGuarrantor.Text;
                oUnit.LoanAmount = Convert.ToDouble(txtLoanAmount.Text.Replace(",", ""));
                oUnit.Terms = Convert.ToInt16(txtTerms.Text);
                oUnit.InterestRate = Convert.ToDouble(txtInterestRate.Text);
                oUnit.FrequencyOfPayment = cboFrequencyOfPayment.EditValue.ToString();
                oUnit.PayDayCode = cboPayDayCode.EditValue != null ? cboPayDayCode.EditValue.ToString() : "";
                oUnit.FirstDateOfPayment = (DateTime)dtStartOfPayment.EditValue;
                oUnit.ReleaseDate = (DateTime)dtDateOfRelease.EditValue;
                oUnit.MonthlyPayment = Convert.ToDouble(txtAmortization.Text.Replace(",", ""));
                oUnit.NumberOfPayment = Convert.ToInt16(txtNoOfPayments.Text);
                oUnit.TotalAmortization = Convert.ToDouble(txtTotalAmortization.Text.Replace(",", ""));
                oUnit.TotalInterest = Convert.ToDouble(txtTotalInterest.Text);
                oUnit.DocumentStatus = txtStatus.Text;
                oUnit.ModifiedBy = txtModifiedBy.Text;
                oUnit.DateModified = (DateTime)dtModified.EditValue;

                oConnectionManager.UpdateLoan(oUnit);

                oConnectionManager.DeleteLineItems(txtLoanNo.Text);
                oConnectionManager.AddLineItems(txtLoanNo.Text, this.LineScheduleOfPayment);

                oConnectionManager.Close();
                MessageBox.Show("Updating completed successfully!!!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }