private void button3_Click(object sender, EventArgs e) { tsdAdd t = new tsdAdd(g, ""); t.ShowDialog(); loadTable(); }
public void SearchItem(string barcode) { bool found = false; bool isWeight = false; g.LoadMeta(); if (g.conf.confScan1.Trim() != "" && g.conf.confScan3.Trim() != "" && g.conf.confScan4.Trim() != "") { if (barcode.IndexOf(g.conf.confScan1) == 0) { isWeight = true; foreach (itemBook it in g.meta) { if (it.isEqual(barcode.Substring(g.conf.confScan1.Length, Convert.ToInt32(g.conf.confScan4)), g.conf.confScan2)) { try { double weight = double.Parse(barcode.Substring(g.conf.confScan1.Length + Convert.ToInt32(g.conf.confScan3.Length), Convert.ToInt32(g.conf.confScan5.Length)).Replace(',', '.'), System.Globalization.NumberFormatInfo.InvariantInfo); weight = weight * double.Parse(g.conf.confScan3.Replace(',', '.'), System.Globalization.NumberFormatInfo.InvariantInfo); tsdEdit ir = new tsdEdit(g, it, weight.ToString()); ir.ShowDialog(); Clipboard.SetDataObject(" "); loadTable(); } catch (Exception) { MessageBox.Show("Неправильные настройки весового товара! Невозможно определить вес!"); } return; } } } } if (isWeight) return; foreach (itemBook it in g.meta) { if (it.barcode == barcode) { found = true; tsdEdit ir = new tsdEdit(g, it); ir.ShowDialog(); Clipboard.SetDataObject(" "); loadTable(); return; } } if (!found) { Clipboard.SetDataObject(" "); DialogResult dialogResult = MessageBox.Show("Обьект не найден в справочнике! Хотите добавить?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dialogResult == DialogResult.Yes) { tsdAdd ir = new tsdAdd(g, barcode); ir.ShowDialog(); Clipboard.SetDataObject(" "); loadTable(); } } }