private void addOrder_Click_1(object sender, RoutedEventArgs e) { try { ChildWindow addWin = new ChildWindow(); AddOrdreUC addOrdUC = new AddOrdreUC(); addOrdUC.ParentWin = addWin; addWin.forUC.Children.Add(addOrdUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Add Order"; bool? dialogRes = addWin.ShowDialog(); if (dialogRes.HasValue && dialogRes.Value) { if (orderManager.AddOrder(addOrdUC.CustomerId, addOrdUC.Time, addOrdUC.Cost, addOrdUC.Status, addOrdUC.OrderType)) { MessageBox.Show("Sucsses"); orderCatalogViewModel.ResetCatalog(); this.dgCatalogUC.DataContext = orderCatalogViewModel.Catalog; } } } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void addPack_Click_1(object sender, RoutedEventArgs e) { ChildWindow win = new ChildWindow(); AddPackageUC addPackUC = new AddPackageUC(); addPackUC.ParentWin = win; win.forUC.Children.Add(addPackUC); win.SizeToContent = SizeToContent.WidthAndHeight; win.Title = "Новий товар"; bool? dialogRes = win.ShowDialog(); if (dialogRes.HasValue && dialogRes.Value) { MainWindow.catalogViewModel.ResetCatalog(); this.dgCatalogUC.DataContext = MainWindow.catalogViewModel.Catalog; } }
private void btnAddSubCategory_Click_1(object sender, RoutedEventArgs e) { ChildWindow addWin = new ChildWindow(); AddSubCategoryUC addSubCatUC = new AddSubCategoryUC(); addSubCatUC.ParentWin = addWin; addWin.forUC.Children.Add(addSubCatUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Додати Категорію"; bool? dialogRes = addWin.ShowDialog(); if (dialogRes.HasValue && dialogRes.Value) { if (MainWindow.categoryManager.AddSubCategory(CategoryID, addSubCatUC.subCategoryName)) { MessageBox.Show(addSubCatUC.subCategoryName + " додано до " + CategoryName , "Додати підкатегорію", MessageBoxButton.OK , MessageBoxImage.Information); } } }
private void btnAddProduct_Click_1(object sender, RoutedEventArgs e) { ChildWindow addWin = new ChildWindow(); addProductUC addProdUC = new addProductUC(); addProdUC.ParentWin = addWin; addWin.forUC.Children.Add(addProdUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Додати Продукт"; bool? dialogRes = addWin.ShowDialog(); if (dialogRes.HasValue && dialogRes.Value) { if(MainWindow.productManager.AddProduct(addProdUC.ProductName , SubCategoryID, ProducerID)) { cmbProduct.DataContext = CmbProductItems; cmbProduct.SelectedIndex = cmbProduct.Items.IndexOf(addProdUC.ProductName); MessageBox.Show(addProdUC.ProductName + "\r\n " + " Додано", "Додати продукт", MessageBoxButton.OK , MessageBoxImage.Information); } } }
private void btnAddProducer_Click_1(object sender, RoutedEventArgs e) { ChildWindow addWin = new ChildWindow(); AddProducerUC addProdUC = new AddProducerUC(); addProdUC.ParentWin = addWin; addWin.forUC.Children.Add(addProdUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Додати Виробника"; bool? DiagRes = addWin.ShowDialog(); if (DiagRes.HasValue && DiagRes.Value) { if (MainWindow.producerManager.AddProducer(addProdUC.ProducerName , addProdUC.ProducerAdress , addProdUC.ProducerPhone)) { cmbProducer.DataContext = CmbProducerItems; cmbProducer.SelectedIndex = cmbProducer.Items.IndexOf(addProdUC.ProducerName); MessageBox.Show(addProdUC.ProducerName + "\r\n " + addProdUC.ProducerAdress + "\r\n " +addProdUC.ProducerPhone + " Додано", "Додати категорію", MessageBoxButton.OK , MessageBoxImage.Information); } } }
private void btnAddCategory_Click_1(object sender, RoutedEventArgs e) { ChildWindow addWin = new ChildWindow(); addCategoryUC addCatUC = new addCategoryUC(); addCatUC.ParentWin = addWin; addWin.forUC.Children.Add(addCatUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Додати Категорію"; bool? dialogRes = addWin.ShowDialog(); if (dialogRes.HasValue && dialogRes.Value) { if(MainWindow.categoryManager.AddCategory(addCatUC.CategoryName , addCatUC.subCategoryName)) { cmbCategory.DataContext = CmbCategoryItems; cmbCategory.SelectedIndex = cmbCategory.Items.IndexOf(addCatUC.CategoryName); MessageBox.Show(addCatUC.CategoryName +"\r\n " + addCatUC.subCategoryName + " Додано" , "Додати категорію" , MessageBoxButton.OK ,MessageBoxImage.Information); } } }
private void btnAddCust_Click_1(object sender, RoutedEventArgs e) { ChildWindow addWin = new ChildWindow(); AddCustomerUC addCustUC = new AddCustomerUC(); addCustUC.ParentWin = addWin; addWin.forUC.Children.Add(addCustUC); addWin.SizeToContent = SizeToContent.WidthAndHeight; addWin.Title = "Add Customer"; bool? DiagRes = addWin.ShowDialog(); if (DiagRes.HasValue && DiagRes.Value) { if (customerManager.AddCustomer(addCustUC.CustomerName, addCustUC.Adress, addCustUC.Phone)) { MessageBox.Show("Customer Added"); cmbCustomer.DataContext = CmbCustomerItems; cmbCustomer.SelectedIndex = cmbCustomer.Items.IndexOf(addCustUC.CustomerName); } } }