private void addItem_Click(object sender, RoutedEventArgs e) { var senderButton = sender as Button; switch (senderButton.Name) { case "addNewTypeCakeBtn": { var screen = new DialogTypeCake(null, ConstantVariable.ADD_TYPECAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case "addNewCakeBtn": { var screen = new DialogCake(null, ConstantVariable.ADD_CAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case "addNewCakeImportBtn": { var screen = new DialogCakeImport(null, ConstantVariable.ADD_CAKEIMPORT); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; } }
private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var item = sender as ListViewItem; if (item != null && item.IsSelected) { switch (this.RibbonItem) { case ConstantVariable.RIBBON_TYPECAKE: { dynamic selectedItem = typeCakeListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); TypeCake typeCake = new TypeCake(); typeCake.ID = selectedItem.ID; typeCake.NameTypeCake = selectedItem.NameTypeCake; var screen = new DialogTypeCake(typeCake, ConstantVariable.UPDATE_TYPECAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_CAKE: { dynamic selectedItem = cakeListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); Product product = new Product(); product.ID = selectedItem.ID; product.Name = selectedItem.NameCake; product.Price = selectedItem.Price; product.IDTypeCake = selectedItem.Type; product.Description = selectedItem.Description; var screen = new DialogCake(product, ConstantVariable.UPDATE_CAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_CAKEIMPORT: { dynamic selectedItem = cakeImportOrderListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); CakeImportOrder cakeImportOrder = new CakeImportOrder(); cakeImportOrder.ID = selectedItem.ID; cakeImportOrder.ImportOrderName = selectedItem.ImportOrderName; cakeImportOrder.ProductID = selectedItem.ProductID; cakeImportOrder.ImportDate = selectedItem.ImportDate; cakeImportOrder.ExpirationDate = selectedItem.ExpirationDate; cakeImportOrder.Quantity = selectedItem.Quantity; cakeImportOrder.ImportPrice = selectedItem.ImportPrice; cakeImportOrder.Total = selectedItem.Total; var screen = new DialogCakeImport(cakeImportOrder, ConstantVariable.UPDATE_CAKEIMPORT); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_PAYMENT: { dynamic selectedItem = detailCartListViewRibbon.SelectedItem; Product product = QueryDB.Instance.findProductByID(selectedItem.ID_Product); DetailCakeScreen screen = new DetailCakeScreen(product); screen.Owner = this; screen.ShowDialog(); BackstageTabItem_MouseLeftButtonDown(CartItem, null); } break; } } }