/// <summary> /// this is the delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DeleteButtonClicked(object sender, NewEventArgs e) { int li = e.LineItemID; UserControl1 RemoveCandidate = new UserControl1(); foreach (UserControl1 item in flowPanel.Controls) { if (item.UserControlLineItemID == li) { RemoveCandidate = item; } } flowPanel.Controls.Remove(RemoveCandidate); TheSale.DeleteRow(li); CalculateRegister(); FocusMe(); }
private void txtBarCodeScan_TextChanged(object sender, EventArgs e) { //call the barcode look up if (txtBarCodeScan.TextLength == 9) { int ScanID = 0; if (int.TryParse(txtBarCodeScan.Text.ToString(), out ScanID) == true) { ScanID = int.Parse(txtBarCodeScan.Text); SoldLineItem c = BarCodeScan(ScanID); if (c != null) { if (DuplicateCheck(c) == false) { TheSale.Add(c); UserControl1 u = new UserControl1(); u.LoadControl(c); u.DeleteClick += new UserControl1.ButtonClick(DeleteButtonClicked); u.TextChange += new UserControl1.TextBoxChange(TextBoxChanged); flowPanel.Controls.Add(u); CalculateRegister(); LineItem = LineItem + 1; } else { MessageBox.Show("Duplicate Scan", "DoubleTake POS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } txtBarCodeScan.Text = string.Empty; FocusMe(); } else { MessageBox.Show("No Scan ID Found", "DoubleTake POS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }