예제 #1
0
파일: Debit Form.cs 프로젝트: Jusharra/RMS
        private void savebutton_Click(object sender, EventArgs e)
        {
            try
            {

            BankTransactionDAO aBankTransactionDao = new BankTransactionDAO();
            amount = new List<double>();
            amount = aBankTransactionDao.GetNowBankbalance(debitdateTimePicker.Value);
            double cashamount = 0;
            if (amount.Count >= 1)
            {
                cashamount = amount[0];
            }
               List<double> amount1 = new List<double>();
            amount1 = aBankTransactionDao.GetNowBankbalance(DateTime.Now);
            double cashamount1 = 0;
            if (amount1.Count >= 1)
            {
                cashamount1 = amount[0];
            }

            BankTransaction aTransaction=new BankTransaction();
            if (cashamount >= Convert.ToDouble("0" + amounttextBox.Text) && (Convert.ToDouble("0" + amounttextBox.Text) != 0)
                && (cashamount1 >= Convert.ToDouble("0" + amounttextBox.Text)))
            {
                aTransaction.BankName = banknametextBox.Text;
                aTransaction.BranchName = branchnametextBox.Text;
                aTransaction.AcoountNumber = accountnumbertextBox.Text;
                aTransaction.DepositeDate = debitdateTimePicker.Value.ToShortDateString();
                aTransaction.DepositePerson = depositepersontextBox.Text;
                aTransaction.DepositeAmount = Convert.ToDouble("0" + amounttextBox.Text);
                string sr = aBankTransactionDao.InsertDebitTransaction(aTransaction);
                MessageBox.Show(sr);
            }
            else
            {
                MessageBox.Show("There is insufficient Balance");
            }
            }
            catch (Exception)
            {
                MessageBox.Show("Please Check input field");

            }
        }
예제 #2
0
파일: CashForm.cs 프로젝트: Jusharra/RMS
        private void savebutton_Click(object sender, EventArgs e)
        {
            try
            {
            BankTransactionDAO aBankTransactionDao = new BankTransactionDAO();
            BankTransaction aTransaction = new BankTransaction();
            aTransaction.BankName = banknametextBox.Text;
            aTransaction.DepositeDate = debitdateTimePicker.Value.ToShortDateString();
            aTransaction.DepositePerson = depositepersontextBox.Text;
            aTransaction.DepositeAmount = Convert.ToDouble("0" + amounttextBox.Text);
            string sr = aBankTransactionDao.InsertCashTransaction(aTransaction);
            MessageBox.Show(sr);

            }
              catch (Exception)
              {
                  MessageBox.Show("Please Check input field");

              }
        }
예제 #3
0
        public string InsertotherCreditTransaction(BankTransaction aTransaction)
        {
            string result;

            try
            {
                this.OpenConnection();
                string sqlCommand = String.Format(SqlQueries.GetQuery(Query.InsertotherCreditTransaction), aTransaction.BankName, aTransaction.BankName, aTransaction.AcoountNumber,
                    aTransaction.DepositeDate, aTransaction.DepositePerson, aTransaction.DepositeAmount);
                this.ExecuteNonQuery(sqlCommand);
                result = "Credit Transaction Save Successfully";
            }

            catch (Exception ex)
            {
                result = "Credit Transaction Couldn,t Save Successfully";
            }
            finally
            {
                this.CloseConnection();
            }

            return result;
        }