private void lstDessert_MouseDoubleClick(object sender, MouseEventArgs e) { Cs_dessert dessert = (Cs_dessert)lstDessert.SelectedItem; EditDish((IDishBean)dessert, RestaurantBL.DishTypeEnum.DESSERT); cmbDishType.Enabled = false; cmdAddDish.Enabled = false; cmdUpdateDish.Enabled = true; }
private void lstDessert_MouseClick(object sender, MouseEventArgs e) { Cs_dessert dessert1 = null; Cs_dessert dessert2 = null; if (lstDessert.IndexFromPoint(e.Location) < 0) { if (lstDessert.SelectedItems.Count == 0) { lstDessert.ClearSelected(); } return; } if (lstDessert.SelectedItems.Count > 2) { if (((Cs_dessert)lstDessert.SelectedItems[0]).DesertId == 1) { lstDessert.SetSelected(0, false); } else if (((Cs_dessert)lstDessert.SelectedItems[1]).DesertId == 1) { lstDessert.SetSelected(0, false); } } switch (lstDessert.SelectedItems.Count) { case 0: dessert1 = (Cs_dessert)lstDessert.Items[0]; dessert2 = (Cs_dessert)lstDessert.Items[0]; break; case 1: dessert1 = (Cs_dessert)lstDessert.SelectedItem; dessert2 = (Cs_dessert)lstDessert.Items[0]; break; case 2: dessert1 = (Cs_dessert)lstDessert.SelectedItems[0]; dessert2 = (Cs_dessert)lstDessert.SelectedItems[1]; break; default: ShowMessage(8); lstDessert.SetSelected(lstDessert.IndexFromPoint(e.Location), false); return; } bl.AddDessertOrder(dessert1, dessert2); lblSum.Text = bl.OrderSum.ToString(); lblDessertPrice.Text = (dessert1.DishPrice + dessert2.DishPrice).ToString(); }
partial void UpdateCs_dessert(Cs_dessert instance);
partial void DeleteCs_dessert(Cs_dessert instance);
partial void InsertCs_dessert(Cs_dessert instance);