using BiskLog_Point_Of_Sale.Multiple_Login; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BiskLog_Point_Of_Sale.Customer { public partial class AccountPayment : Form { public decimal payment = 0; public bool deposit = false; public bool withdrawal = false; decimal available; public AccountPayment(decimal available) { InitializeComponent(); this.available = available; } private void CLOSE_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Abort; this.Close(); } private void CLOSE_MouseEnter(object sender, EventArgs e) { CLOSE.BackColor = Color.Crimson; } private void CLOSE_MouseLeave(object sender, EventArgs e) { CLOSE.BackColor = Color.Transparent; } private void sell_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; deposit = true; withdrawal = false; this.Close(); } private void schDelivery_Click(object sender, EventArgs e) { if (available >= payment) { this.DialogResult = DialogResult.OK; deposit = false; withdrawal = true; this.Close(); } else { string title = "Insufficients funds"; string message = "Customer cannot withdraw that amount from account due to insufficient funds in customer's account"; NoAction action = new NoAction(title,message); action.BringToFront(); action.ShowDialog(); } } private void textBox1_TextChanged(object sender, EventArgs e) { try { payment = decimal.Parse(textBox1.Text); } catch { } } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 8) { //accepts backspace } else if (((e.KeyChar < 48) || (e.KeyChar > 57)) && e.KeyChar != 46) //ascii code 48-57 between 0-9 { e.Handled = true; } else if (e.KeyChar == 46) { // accepts . character } } } }