void ShowWindowAddProduct() // Wyświetlenie okna dialogowego do wprowadzenia nowego typu produktu { NewProductVM = new AddProductViewModel(); _addProductWindow = new AddProductWindow(); _addProductWindow.DataContext = NewProductVM; _addProductWindow.ShowDialog(); }
private void addProductButton_Click(object sender, RoutedEventArgs e) { AddProductWindow form = new AddProductWindow(); form.ShowDialog(); this.ShowAll(); }
private void EditProduct(ProductControlUC para) { Product product = new Product(); int id = int.Parse(para.txbID.Text); product = (Product)DataProvider.Instance.DB.Products.Where(x => x.ID == id).First(); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = Converter.Instance.ConvertByteToBitmapImage(product.Image); AddProductWindow window = new AddProductWindow(); window.txtID.Text = product.ID.ToString(); window.txtName.Text = product.Name; window.txtName.SelectionStart = window.txtName.Text.Length; window.txtUnit.Text = product.Unit; window.txtUnit.SelectionStart = window.txtUnit.Text.Length; window.txtPrice.Text = ConvertToString(product.ExportPrice); window.txtPrice.SelectionStart = window.txtPrice.Text.Length; window.Title = "Update info product"; window.grdImage.Background = imageBrush; if (window.grdImage.Children.Count != 0) { window.grdImage.Children.Remove(window.grdImage.Children[0]); window.grdImage.Children.Remove(window.grdImage.Children[0]); } window.ShowDialog(); }
private void newProductButton_Click(object sender, RoutedEventArgs e) { AddProductWindow apw = new AddProductWindow(); this.Hide(); apw.ShowDialog(); this.Show(); }
private void addProduct_Click(object sender, RoutedEventArgs e) { AddProductWindow addProduct = new AddProductWindow(); addProduct.WindowStartupLocation = WindowStartupLocation.CenterScreen; addProduct.ShowDialog(); }
private void BtnCreate_Click(object sender, RoutedEventArgs e) { AddProductWindow dlg = new AddProductWindow(); dlg.ShowDialog(); UpdateDatabase(); }
private void editProductButton_Click(object sender, RoutedEventArgs e) { if (productsGrid.SelectedItem != null) { var edit = (GridsInfo.newProduct)productsGrid.SelectedItem; AddProductWindow form = new AddProductWindow(DBContext.Products.Find(edit.ID).ID); form.ShowDialog(); } else { MessageBox.Show("Не выбрано поле для редактирования", "Ошибка"); } this.ShowAll(); }
void ShowWindowEditProduct() // Wyświetlenie okna dialogowego do edycji typu produktu { if (SelectedProduct != null) { NewProductVM = new AddProductViewModel(); NewProductVM.Prod = SelectedProduct; NewProductVM.ProductType = ProductTypeCollection.Where(x => x.Id == SelectedProduct.ProductTypeId).First(); NewProductVM.IdVisible = Visibility.Visible; NewProductVM.IsEnabled = false; _addProductWindow = new AddProductWindow(); _addProductWindow.DataContext = NewProductVM; _addProductWindow.Title = "Edycja produktu"; _addProductWindow.ShowDialog(); } }
private void allProduct_DG_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (allProduct_DG.SelectedCells.Count > 0 && allProduct_DG.SelectedCells[0].IsValid) { InfoAllProduct t = allProduct_DG.SelectedItem as InfoAllProduct; AddProductWindow window = new AddProductWindow(t.Shtrix, true); window.ShowDialog(); Refresh_DG(); } } catch (Exception err) { MessageBox.Show("Error16"); } }
public Product OpenAddProductWindow() { AddProductWindow win = new AddProductWindow(); if (win.ShowDialog() == true) { Product p = new Product() { Name = win.name.Text, Price = win.price.Text, Num = win.num.Text, Category = (win.listCategory.SelectedItem as Category).Name, Cid = (win.listCategory.SelectedItem as Category).Id, Producer = (win.listProducer.SelectedItem as Producer).Name, Pid = (win.listProducer.SelectedItem as Producer).Id, Image = win.Image == "" ? "Image/image1.ico" : win.Image }; return(p); } return(null); }
private void OpenAddProductWindow(Views.HomeWindow para) { AddProductWindow window = new AddProductWindow(); this.imageFileName = null; try { string query = "SELECT * FROM Product"; Product product = DataProvider.Instance.DB.Products.SqlQuery(query).Last(); window.txtID.Text = (product.ID + 1).ToString(); } catch { window.txtID.Text = "1"; } finally { window.ShowDialog(); } }
/// <summary> /// Creates dialog window with product adding interface /// </summary> private void Add_Click(object sender, RoutedEventArgs e) { AddProductWindow addProductWindow = new AddProductWindow(); addProductWindow.ShowDialog(); }