private void info_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { ReceiptForm receiptForm = new ReceiptForm(receipts.ElementAt(listView1.SelectedIndices[0])); receiptForm.Show(); } else { toolTip.Show("Select an item first", listView1, 3000); } }
private void btRnd_Click(object sender, EventArgs e) { Random rnd = new Random(); List <Item> list = new List <Item>(); for (int i = 1; i <= rnd.Next(12, 25); i++) { list.Add(new Item(i.ToString(), rnd.Next(20) * 100 + rnd.Next(2) * 50 + 49, ShopEnum.Maxima)); } Receipt receipt = Receipt.Create(ShopEnum.Maxima, list); ReceiptForm receiptForm = new ReceiptForm(receipt); receiptForm.Show(); }
private void btSubmit_Click(object sender, EventArgs e) { userconfig.ReceiptsDataSharing(); string data = string.Empty; if (rbInput.Checked) { if (tbInput.Text == string.Empty) { toolTip.Show("Empty field", tbInput, 3000); return; } data = tbInput.Text; } else { if (tbFile.Text == string.Empty) { toolTip.Show("Empty field", tbFile, 3000); return; } switch (openFileDialog.FilterIndex) { case 1: data = File.ReadAllText(tbFile.Text); break; case 2: data = Ocr.GetText(tbFile.Text); break; default: break; } } Receipt receipt = Receipt.Create(data); ReceiptForm receiptForm = new ReceiptForm(receipt); if (receipt.Items != null) { foreach (Item item in receipt.Items) { DataManager.AddItem(item); //DataManager.ClarificationSystem(item); } } DataManager.AddReceipt(receipt); receiptForm.Show(); }