public Form1() { InitializeComponent(); alienreader = new MyAlienReader(); myreader = new MyReader(); db = new MyDB(); Console.WriteLine("segdgdggfdgfdgfgfgdf*********"); Thread thread = new Thread(new ThreadStart(this.Check)); thread.Start(); }
private void button1_Click(object sender, EventArgs e) { string barcode = this.textBox1.Text; //调用查询函数 MyDB db = new MyDB(); List<Product> products; if (barcode.Equals("")) products = db.queryProduct(); else products = db.queryProduct(barcode); this.listView1.View = View.Details; this.listView1.BeginUpdate(); this.listView1.Items.Clear(); //调用转化函数 if (products != null && products.Count != 0) { foreach (Product product in products) { string pid = product.getPid(); string tid = product.getTid(); string name = product.getPname(); string image = product.getPimage(); int location = product.getPlocation(); double price = product.getPprice(); int minimum = product.getPminimum(); int number = product.getPnumber(); string detail = product.getPdetail(); int qgp = product.getPqgp(); this.listView1.Items.Add(tid, tid, 0); this.listView1.Items[tid].SubItems.Add(pid); this.listView1.Items[tid].SubItems.Add(name); this.listView1.Items[tid].SubItems.Add(qgp + ""); this.listView1.Items[tid].SubItems.Add(location + ""); this.listView1.Items[tid].SubItems.Add(number + ""); this.listView1.Items[tid].SubItems.Add(price + ""); this.listView1.Items[tid].SubItems.Add(minimum + ""); this.listView1.Items[tid].SubItems.Add(detail); } } this.listView1.EndUpdate(); }
private void button1_Click(object sender, EventArgs e) { string sprice, sminimum; sprice = textBox2.Text; sminimum = textBox1.Text; if (sprice.Equals("") || sminimum.Equals("")) { MessageBox.Show("信息错误"); return; } double price = Convert.ToDouble(sprice); int minimum = Convert.ToInt32(sminimum); string detail = textBox3.Text; MyDB db = new MyDB(); //price = Convert.ToDouble(textBox1.Text); //minimum = Convert.ToInt32("10"); bool flag = db.UpdatePro(barcode, price, minimum, detail); if (flag == true) MessageBox.Show("更新成功"); else MessageBox.Show("更新失败"); this.Close(); }
private void button3_Click(object sender, EventArgs e) { foreach (ListViewItem lvi in listView1.SelectedItems) { listView1.Items.Remove(lvi); //下架函数 string pid = lvi.SubItems[1].Text; MyDB db = new MyDB(); db.DropProruct(pid); } }
public FormGuard(MyReader reader) { InitializeComponent(); this.reader = reader; db = new MyDB(); }
public FormManagerAddPro(MyReader reader) { InitializeComponent(); db = new MyDB(); this.reader = reader; }