Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool blnValid     = false;
            bool blnSuccess   = false;
            int  intMemberNum = 0;
            int  intLoanId    = 0;

            blnValid = ValidateInputs();

            if (blnValid)
            {
                string strXML = CreateInsertXML();
                try
                {
                    Member _obj         = new Member();
                    string strPaymentId = string.Empty;
                    byte[] bytes        = null;
                    if (!strPhotoName.Equals(string.Empty))
                    {
                        bytes = File.ReadAllBytes(fdPhoto.FileName);
                    }

                    blnSuccess = _obj.AddNewMember(strXML, out intMemberNum, bytes, out intLoanId, out strPaymentId);
                    if (blnSuccess)
                    {
                        ShowMesage("New member added successfully", "New member added", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MembershipForm _form = new MembershipForm(intMemberNum);
                        _form.ShowDialog();
                        if (intLoanId != 0)
                        {
                            LoanApplicationForm applicationForm = new LoanApplicationForm(intLoanId);
                            applicationForm.ShowDialog();
                        }
                        PaymentReceipt receipt = new PaymentReceipt(strPaymentId);
                        receipt.ShowDialog();
                        ClearAllControls();
                    }
                    else
                    {
                        MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    LogError.LogEvent("Create New Member", ex.Message, "Save Button Click Event");
                }
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool blnSelected = false;

            foreach (DataGridViewRow dgvRow in dgvPayment.Rows)
            {
                bool isSelected = Convert.ToBoolean(dgvRow.Cells["chkColumn"].Value);
                if (isSelected)
                {
                    blnSelected = true;
                    break;
                }
            }
            if (!blnSelected)
            {
                MessageBox.Show("Select at least one row for payment", "Select row", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                try
                {
                    string  strXML       = CreatePaymentXML();
                    string  strPaymentId = string.Empty;
                    Payment _obj         = new Payment();
                    bool    blnSuccess   = _obj.AddPayment(strXML, intTotalRow, out strPaymentId);
                    if (blnSuccess)
                    {
                        MessageBox.Show("Payment saved successfully", "Payment saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        PaymentReceipt receipt = new PaymentReceipt(strPaymentId);
                        receipt.ShowDialog();
                        btnClear_Click(sender, e);
                    }
                    else
                    {
                        MessageBox.Show("Payment failed. Try again later", "Payment failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Payment failed. Try again later", "Payment failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    LogError.LogEvent("SavePayment", ex.Message, "Save Payment");
                }
            }
        }
Ejemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtNumber.Text.Trim().Equals(""))
     {
         MessageBox.Show("Select application from application list", "Select application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         dgvLoanList.Focus();
     }
     else if (txtAmount.Text.Trim().Equals("") || txtAmount.Text.Trim().Equals("0"))
     {
         MessageBox.Show("Enter loan amount", "Enter loan amount", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         txtAmount.Focus();
     }
     else if (cmbEmi.SelectedIndex == -1)
     {
         MessageBox.Show("Select number of loan EMI count", "Loan EMI count", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         cmbEmi.Focus();
     }
     else if (txtEvidenceNumber.Text.Trim().Equals("") || txtEvidenceNumber2.Text.Trim().Equals(""))
     {
         MessageBox.Show("Select both guarantor", "Select both guarantor", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else if (!txtEvidenceNumber.Text.Trim().Equals("") && !txtEvidenceNumber2.Text.Trim().Equals("") && txtEvidenceNumber.Text.Trim().Equals(txtEvidenceNumber2.Text.Trim()))
     {
         MessageBox.Show("Both guarantor should be different", "Both Guarantor", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         try
         {
             Loan _obj = new Loan();
             if (_obj.CheckLoanRunning(Convert.ToInt32(txtNumber.Text.Trim())))
             {
                 MessageBox.Show("Old loan is still running for member", "Old loan is still running", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
             else
             {
                 string strXML       = CreateInsertXML();
                 bool   blnSuccess   = false;
                 string strPaymentId = string.Empty;
                 int    loanId       = 0;
                 blnSuccess = _obj.AddNewLoan(strXML, Convert.ToInt32(cmbEmi.Text.Trim()) + 4, out loanId, out strPaymentId);
                 if (blnSuccess)
                 {
                     MessageBox.Show("New loan added successfully!", "New loan added", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     LoanApplicationForm loanApplication = new LoanApplicationForm(loanId);
                     loanApplication.ShowDialog();
                     PaymentReceipt receipt = new PaymentReceipt(strPaymentId);
                     receipt.ShowDialog();
                     btnClear_Click(sender, e);
                 }
                 else
                 {
                     MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             LogError.LogEvent("", ex.Message, "Add New Loan");
         }
     }
 }