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 Point_Of_Sale_Managment.CashierModule { public partial class quantityManual : Form { AddProducttoCart formSale; public quantityManual(AddProducttoCart formsales) { InitializeComponent(); formSale = formsales; } private void txtqty_TextChanged(object sender, EventArgs e) { } private void quantityManual_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { int quantity = int.Parse(txtqty.Text); int possibility = int.Parse(AddProducttoCart.quantity) - quantity; if (possibility >= 0) { formSale.AddtoCart(AddProducttoCart.id, AddProducttoCart.product_name, AddProducttoCart.price, quantity, AddProducttoCart.unitname, AddProducttoCart.unitcode, AddProducttoCart.distinctive); this.Close(); } else { string title = "Out of stock"; string message = "Sorry you do not have enough quantity of the item available to sell to customer"; NoAction noAction = new NoAction(title, message); noAction.BringToFront(); noAction.ShowDialog(); } } } private void Txtqty_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 8) { //accepts backspace } else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48-57 between 0-9 { e.Handled = true; } } private void Label1_Click(object sender, EventArgs e) { this.Close(); } private void Label1_MouseEnter(object sender, EventArgs e) { label1.BackColor = Color.Crimson; } private void Label1_MouseLeave(object sender, EventArgs e) { label1.BackColor = Color.Transparent; } } }