Example #1
0
 public string Save(BankWithdraw bankWithdraw)
 {
     if (bankWithdrawGateway.Insert(bankWithdraw) > 0)
     {
         return("Saved Successfully!!");
     }
     return("Could Not Save data in Database!!");
 }
Example #2
0
        protected void lastButton_Click(object sender, EventArgs e)
        {
            BankWithdraw bankWithdraw = bankWithdrawManager.GetLastBankWithdrawInfo();

            bankDateTextBox.Value     = bankWithdraw.Date;
            bankNameDropDownList.Text = bankWithdraw.BankName;
            int         id       = int.Parse(bankWithdraw.AccountNo);
            BankAccount acountNo = bankWithdrawManager.GetAccountNo(id);

            accountNoTextBox.Text  = acountNo.AccountNo;
            checkNoTextBox.Text    = bankWithdraw.CheckNo;
            withdrawByTextBox.Text = bankWithdraw.WithdrawBy;
            amountTextBox.Text     = bankWithdraw.Amount.ToString();
        }
        public int Insert(BankWithdraw bankWithdraw)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "INSERT INTO tbl_bankWithdraw VALUES('" + bankWithdraw.Date + "','" + bankWithdraw.BankId +
                                       "','" + bankWithdraw.CheckNo + "','" + bankWithdraw.WithdrawBy + "','" + bankWithdraw.Amount +
                                       "')";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
Example #4
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            BankWithdraw bankWithdraw = new BankWithdraw();

            bankWithdraw.Date       = bankDateTextBox.Value;
            bankWithdraw.BankId     = int.Parse(bankNameDropDownList.SelectedValue);
            bankWithdraw.CheckNo    = checkNoTextBox.Text;
            bankWithdraw.WithdrawBy = withdrawByTextBox.Text;
            string amount = amountTextBox.Text;

            if (bankDateTextBox.Value == "" || accountNoTextBox.Text == "" || checkNoTextBox.Text == "" ||
                withdrawByTextBox.Text == "" || amountTextBox.Text == "")
            {
                messageLabel.InnerText = "All Fields are Required!!";
            }
            else
            {
                bankWithdraw.Amount    = Convert.ToDouble(amount);
                messageLabel.InnerText = bankWithdrawManager.Save(bankWithdraw);
            }
            ClearTextBoxes();
        }
        public BankWithdraw GetLastBankWithdrawInfo()
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT TOP 1 * FROM tbl_bankWithdraw ORDER BY id DESC";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader       = command.ExecuteReader();
            BankWithdraw  bankWithdraw = new BankWithdraw();

            while (reader.Read())
            {
                bankWithdraw.BankWithdrawId = int.Parse(reader["id"].ToString());
                bankWithdraw.Date           = reader["date"].ToString();
                bankWithdraw.BankName       = reader["bank_id"].ToString();
                bankWithdraw.AccountNo      = reader["bank_id"].ToString();
                bankWithdraw.CheckNo        = reader["check_no"].ToString();
                bankWithdraw.WithdrawBy     = reader["withdrawBy"].ToString();
                bankWithdraw.Amount         = Convert.ToDouble(reader["amount"].ToString());
            }
            reader.Close();
            connection.Close();
            return(bankWithdraw);
        }