private void enter_Click(object sender, EventArgs e) { int er = 0; ep.Clear(); if (txtAmount.Text == "") { txtAmount.Focus(); return; } if (cmbAccountNumber.SelectedValue == null || cmbAccountNumber.SelectedValue.ToString() == "") { er++; ep.SetError(cmbAccountNumber, "Required"); } if (er > 0) { return; } int Amount = Convert.ToInt32(txtAmount.Text); txtAmount.Text = ""; if (Amount > (Int32)Money) { txtAmount.Text = ""; txtInfo.Text = "Insufficient Balance!"; } if (Amount < 100) { txtAmount.Text = ""; txtInfo.Text = "Transaction isn't possible!"; } if (Amount <= (Int32)Money && Amount >= 100) { DAL.User user = new DAL.User(); DAL.User u = new DAL.User(); user.Id = Convert.ToInt32(cmbAccountNumber.SelectedValue); user.Select_Balance(); user.Balance += Amount; Amount = (Int32)Money - Amount; u.Id = User_Id; u.Balance = Amount; if (user.Update() && u.Update()) { MessageBox.Show("Money Transfer Successfully!"); } else { MessageBox.Show(u.Error + user.Error); } } }