Exemple #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtNumber.Text.Trim().Equals(""))
     {
         MessageBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         try
         {
             bool   blnSuccess = false;
             Loan   _obj       = new Loan();
             string strXML     = CreateNewXML();
             blnSuccess = _obj.AddNewLoanApplication(strXML);
             if (blnSuccess)
             {
                 MessageBox.Show("New loan application added successfully!", "New loan application", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 btnClear_Click(sender, e);
                 GetLoanApplicationList();
             }
             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, "AddNewLoanApplication");
         }
     }
 }
 private void LoadMemberList()
 {
     try
     {
         Member _obj = new Member();
         dstMember            = _obj.GetMemberList("");
         dgvMember.DataSource = dstMember.Tables[0];
         SetDataGridProperties();
     }
     catch (Exception ex)
     {
         LogError.LogEvent("LoadMemberList", ex.Message, "LoadMemberList");
     }
 }
Exemple #3
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");
                }
            }
        }
        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");
                }
            }
        }
Exemple #5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (cmbMonth.SelectedIndex == -1)
     {
         MessageBox.Show("Select Month", "Select Month", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); cmbMonth.Focus();
     }
     else if (cmbYear.SelectedIndex == -1)
     {
         MessageBox.Show("Select Year", "Select Year", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); cmbYear.Focus();
     }
     else if (txtEMI.Text.Trim().Equals("") || txtEMI.Text.Trim().Equals("0"))
     {
         MessageBox.Show("Enter Amount", "Enter Amount", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtEMI.Focus();
     }
     else
     {
         try
         {
             Member _obj      = new Member();
             int    intResult = _obj.ChangeEMImount(cmbMonth.SelectedIndex + 1, Convert.ToInt32(cmbYear.Text), Convert.ToDecimal(txtEMI.Text.Trim()));
             if (intResult == 1)
             {
                 MessageBox.Show("New EMI inserted successfully", "New EMI", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 LoadEMIHistory();
                 cmbMonth.SelectedIndex = -1;
                 cmbYear.SelectedIndex  = -1;
                 txtEMI.Text            = string.Empty;
                 cmbMonth.Focus();
             }
             else
             {
                 MessageBox.Show("EMI already configured for greater than given date", "EMI Configured", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
         }
         catch (Exception ex)
         {
             LogError.LogEvent("", ex.Message, "ChangeEMI Save");
         }
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtAmount.Text.Trim().Equals("") || txtAmount.Text.Trim().Equals("0"))
     {
         MessageBox.Show("Enter Expense Amount", "Expense Amount", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         txtAmount.Focus();
     }
     else if (txtDetails.Text.Trim().Equals(""))
     {
         MessageBox.Show("Enter Expense Details", "Expense Details", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         txtDetails.Focus();
     }
     else
     {
         try
         {
             string strInsertXML = CreateExpenseXML();
             Common _obj         = new Common();
             bool   blnSuccess   = _obj.AddNewExpense(strInsertXML);
             if (blnSuccess)
             {
                 MessageBox.Show(intPaymentId == 0 ? "Expense Added Successfully" : "Expense Updated Successfully", intPaymentId == 0 ? "Expense Added" : "Expense Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 btnClear_Click(sender, e);
                 if (dgvExpense.Rows.Count > 0)
                 {
                     btnSearchExpense_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, "SaveExpense");
         }
     }
 }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool blnValid   = false;
            bool blnSuccess = false;

            blnValid = ValidateInputs();

            if (blnValid)
            {
                string strXML = CreateInsertXML();
                try
                {
                    Member _obj = new Member();

                    byte[] bytes = null;
                    if (!strPhotoName.Equals(string.Empty))
                    {
                        bytes = File.ReadAllBytes(fdPhoto.FileName);
                    }

                    blnSuccess = _obj.UpdateMemberDetails(strXML, bytes);
                    if (blnSuccess)
                    {
                        ShowMesage("Member details upudated successfully", "Member details updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    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("Update Member Details", ex.Message, "Save Button Click Event");
                }
            }
        }
        private void LoadPendingPayments()
        {
            try
            {
                Payment _obj       = new Payment();
                DataSet dstPayment = _obj.GetPendingPayments(Convert.ToInt32(txtNumber.Text.Trim()), (strFormName.Equals("MONTHLY AND LOAN EMI PAYMENT") ? 0 : 1));
                dstPayment.Tables[0].Columns.Add("TOTAL", typeof(string));
                decimal dcmlTotal = 0;
                foreach (DataRow row in dstPayment.Tables[0].Rows)
                {
                    dcmlTotal   += Convert.ToDecimal(row["PAYMENT_AMOUNT"].ToString()) + Convert.ToDecimal(row["PANELTY"].ToString());
                    row["TOTAL"] = (Convert.ToDecimal(row["PAYMENT_AMOUNT"].ToString()) + Convert.ToDecimal(row["PANELTY"].ToString())).ToString();
                }

                dgvPayment.DataSource = dstPayment.Tables[0];
                SetDataGridProperties();
                lblAmount.Text         = dcmlTotal.ToString() + "/-";
                btnSearch.Enabled      = false;
                lblAmountLabel.Visible = true;
                lblAmount.Visible      = true;
                btnClear.Enabled       = true;
                if (dgvPayment.Rows.Count > 0)
                {
                    btnSave.Enabled    = true;
                    lblPayment.Visible = true;
                    dtpPayment.Visible = true;
                }
                else
                {
                    MessageBox.Show("No amount due for selected member", "No amount due", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                LogError.LogEvent("Get Pending Payments", ex.Message, "Get Pending Payments");
            }
        }
 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");
         }
     }
 }