private void addButton_Click(object sender, EventArgs e) { BrandForm brandForm = new BrandForm(); brandForm.setFlag("add"); if (brandForm.ShowDialog() == DialogResult.OK) { initListView(); } }
private void updateButton_Click(object sender, EventArgs e) { ListViewItem item = this.cutomerListView.FocusedItem; if (null != item) { BrandForm brandForm = new BrandForm(); Model.Brand brand = new Brand(item.SubItems[1].Text); brand.Id = Int32.Parse(item.SubItems[0].Text); brandForm.setBrand(brand); brandForm.init(); brandForm.setFlag("update"); if (brandForm.ShowDialog() == DialogResult.OK) { initListView(); } } else { MessageBox.Show("请先选择品牌!"); } }