private void BullPitReview_Load(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; using (ShopEntities db = new ShopEntities()) { List <WrekerIntake> list = db.WrekerIntakes.ToList(); foreach (WrekerIntake w in list) { ListViewItem item = new ListViewItem(w.Id.ToString()); item.SubItems.Add(w.Year); item.SubItems.Add(w.Make); item.SubItems.Add(w.Model); item.SubItems.Add(w.Parts); item.SubItems.Add(w.Totaled); listView1.Items.Add(item); } } }
private void ReviewCustomer_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'shopDataSet.Customers' table. You can move, or remove it, as needed. this.customersTableAdapter.Fill(this.shopDataSet.Customers); Cursor.Current = Cursors.WaitCursor; using (ShopEntities db = new ShopEntities()) { List <Customer> list = db.Customers.ToList(); foreach (Customer c in list) { ListViewItem item = new ListViewItem(c.CustomerID.ToString()); item.SubItems.Add(c.FirstName); item.SubItems.Add(c.LastName); item.SubItems.Add(c.Phone.ToString()); item.SubItems.Add(c.Make); item.SubItems.Add(c.Model); listView1.Items.Add(item); } } }
private async void listView1_ItemActivate(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { ListViewItem item = listView1.SelectedItems[0]; using (ShopEntities db = new ShopEntities()) { string customerId = item.SubItems[0].Text; Customer c = await db.Customers.FindAsync(Convert.ToInt32(customerId)); if (c != null) { using (CustomerReviewSmall crs = new CustomerReviewSmall(c)) { if (crs.ShowDialog() == DialogResult.OK) { //Process } } } } } }
private async void listView1_ItemActivate(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { ListViewItem item = listView1.SelectedItems[0]; using (ShopEntities db = new ShopEntities()) { string wrekerId = item.SubItems[0].Text; WrekerIntake w = await db.WrekerIntakes.FindAsync(Convert.ToInt32(wrekerId)); if (w != null) { using (WreckerReview crs = new WreckerReview()) { if (crs.ShowDialog() == DialogResult.OK) { //Process } } } } } }