Beispiel #1
0
        private void InsertButton_Click(object sender, RoutedEventArgs e)
        {
            ProductWindow productWindow = new ProductWindow();

            productWindow.EnterButton.Content = "Добавить";
            productWindow.Show();
        }
        private void ExecuteCreateProduct()
        {
            string        type          = (ProductType as ComboBoxItem).Content.ToString();
            ProductWindow productWindow = new ProductWindow();

            switch (type)
            {
            case "Настольный пк":
                productWindow = new ProductWindow(new Desktop(), new DesktopUC());
                break;

            case "Ноутбук":
                productWindow = new ProductWindow(new Laptop(), new LaptopUC());
                break;

            case "Моноблок":
                productWindow = new ProductWindow(new Monoblock(), new MonoblockUC());
                break;

            case "Клавиатура":
                productWindow = new ProductWindow(new Keyboard(), new KeyboardUC());
                break;

            case "Мышь":
                productWindow = new ProductWindow(new Mouse(), new MouseUC());
                break;
            }

            productWindow.Show();
        }
Beispiel #3
0
        void update_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try {
                productCategoryDbUtils = new ProductCategoryDbUtils();
                productDbUtils         = new ProductDbUtils();
                product         = new Product();
                productCategory = new ProductCategory();


                productCategory.setCategoryCode(categoryid_Textbox.Text);

                if (productCategoryDbUtils.getCategoryByCode(productCategory) == false)
                {
                    MessageBox.Show("No Category Found! Create First.");
                    categoryid_Textbox.Text = "";
                }
                else
                {
                    product.setProductCode(code_Textbox.Text);
                    product.setProductName(name_Textbox.Text);
                    product.setProductBrand(brand_Textbox.Text);
                    product.setProductQuantity(Int32.Parse(quantity_Textbox.Text));
                    product.setProductPrice(Int32.Parse(price_Textbox.Text));
                    product.setProductCategoryCode(categoryid_Textbox.Text);
                    productDbUtils.updateProduct(product);

                    var productWindow = new ProductWindow();
                    productWindow.Show();
                    Hide();
                }
            } catch (Exception) {
                MessageBox.Show("Digits only in Quantity and Price!");
            }
        }
Beispiel #4
0
        private void BtnAddProduct_Click(object sender, RoutedEventArgs e)
        {
            ProductWindow addProduct = new ProductWindow();

            addProduct.DataAdded += Product_DataAdded;
            addProduct.Show();
        }
Beispiel #5
0
        void Edit(int n, object item)
        {
            switch (n)
            {
            //case 0:
            //    BillWindow bw = new BillWindow(db, (Bill)item);
            //    bw.ShowDialog();
            //    break;
            //case 1:
            //    EntryWindow ew = new EntryWindow(db, (Entry)item);
            //    ew.ShowDialog();
            //    break;
            case 2:
                ProductWindow pw = new ProductWindow(db, (Product)item);
                pw.ShowDialog();
                break;

            case 3:
                ServiceWindow sw = new ServiceWindow(db, (Service)item);
                sw.ShowDialog();
                break;

            case 4:
                ClientWindow cw = new ClientWindow(db, (Client)item);
                cw.ShowDialog();
                break;

            case 5:
                CarWashWindow cww = new CarWashWindow(db, (CarWash)item);
                cww.ShowDialog();
                break;
            }
            Refresh(n);
        }
Beispiel #6
0
        public void ShowProduct(object sender)
        {
            Product    product   = (sender as ListBox).SelectedItem as Product;
            IProductUC productUC = null;

            switch (product)
            {
            case Desktop _:
                productUC = new DesktopUC();
                break;

            case Keyboard _:
                productUC = new KeyboardUC();
                break;

            case Laptop _:
                productUC = new LaptopUC();
                break;

            case Monoblock _:
                productUC = new MonoblockUC();
                break;

            case Mouse _:
                productUC = new MouseUC();
                break;
            }

            ProductWindow productWindow = new ProductWindow(product, productUC, MainVM.Customer.Role == model.enums.Role.User);

            productWindow.Owner = MainVM.View;
            productWindow.Show();
        }
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            ProductWindow cw = new ProductWindow();

            cw.CallbackAction = async() => { await LoadData(); };
            cw.Show();
        }
Beispiel #8
0
 public GoodsViewModel()
 {
     inputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         var w = new InputWindow();
         w.ShowDialog();
     });
     outputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         OutputWindow w = new OutputWindow();
         w.ShowDialog();
     });
     productCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         ProductWindow w = new ProductWindow();
         w.ShowDialog();
     });
     categoryCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         CategoryWindow w = new CategoryWindow();
         w.ShowDialog();
     });
     statisticCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         StatisticWindow w = new StatisticWindow();
         w.ShowDialog();
     });
 }
Beispiel #9
0
        public void HandleProducts()
        {
            var view      = new ProductWindow();
            var presenter = new ProductPresenter(view, this, productRepository, this.reportCreator);

            presenter.Initialize();
            view.ShowDialog();
        }
 public static ProductWindow GetProductWindowInstance(System.Windows.Controls.DataGrid productsDataGrid = null)
 {
     if (productWindow == null)
     {
         productWindow = new ProductWindow(productsDataGrid);
     }
     return(productWindow);
 }
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            Product       c  = ((FrameworkElement)sender).DataContext as Product;
            ProductWindow cw = new ProductWindow();

            cw.SetProductId(c.ProductId);
            cw.CallbackAction = async() => { await LoadData(); };
            cw.Show();
        }
Beispiel #12
0
        void delete_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            productDbUtils = new ProductDbUtils();
            productDbUtils.deleteProduct(code_Textbox.Text);

            var productWindow = new ProductWindow();

            productWindow.Show();
            Hide();
        }
 private void SpProducts_MouseUp(object sender, MouseButtonEventArgs e)
 {
     clearAllItems();
     spProducts.Background = selectedBrush;
     if (productWindow == null)
     {
         productWindow = new ProductWindow();
     }
     productWindow.DetachContent();
     fragmentWindow.Children.Add(productWindow.OptionMain);
 }
Beispiel #14
0
        private void ProductUpdateButton_Click(object sender, RoutedEventArgs e)
        {
            var window = new ProductWindow(this.businessLogic, ProductsListView.SelectedItem as Product);

            window.ShowDialog();

            if (window.SaveChanges)
            {
                this.businessLogic.Product.Update(window.Product);
                ProductsUserControl_Loaded(this, null); // To refresh the product's list
            }
        }
 public void AddProduct()
 {
     if (!string.IsNullOrWhiteSpace(ClientNameViewInput) && !ClientNameViewInput.All(char.IsDigit))
     {
         ProductWindow productWindow = new ProductWindow(ProductsDataGrid);
         productWindow.Show();
     }
     else
     {
         MessageBox.Show(UserMessages.ClientNameIsEmptyOrInvalidFormat, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
 /// <summary>
 /// Exibe a janela dos produtos.
 /// </summary>
 private void ShowProductWindow()
 {
     if (productWindow == null)
     {
         productWindow       = new ProductWindow();
         productWindow.Owner = mainWindow;
         productWindow.Show();
     }
     else
     {
         ShowOrHideWindow(productWindow);
     }
 }
        public MainWindow(DatabaseContext context)
        {
            _context = context;
            InitializeComponent();

            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();

            companyWindow = new CompanyWindow(_context);
            customerWindow = new CustomerWindow(_context);
            invoiceWindow = new InvoiceWindow(_context);
            productWindow = new ProductWindow(_context);
            taxWindow = new TaxWindow(_context);
        }
 public ProductWindowViewModel(ProductWindow view, Product product)
 {
     View = view;
     if (product.Name == null || product.Name.Length == 0)
     {
         IsCreatedNow = true;
     }
     Product           = product;
     ProductId         = product.Id;
     ProductRepository = new ProductRepository();
     GetImage          = new RelayCommand(param => GetImageExecute());
     Accept            = new RelayCommand(param => AcceptExecute());
     ResetImage        = new RelayCommand(param => Product.Photo = null);
     Cancel            = new RelayCommand(param => CancelExecute());
 }
Beispiel #19
0
        private void BtnEditProduct_Click(object sender, RoutedEventArgs e)
        {
            Product rowEntity = ((Button)e.OriginalSource).DataContext as Product;

            if (rowEntity != null)
            {
                ProductWindow addProduct = new ProductWindow(rowEntity);
                addProduct.DataChanged += Product_DataChanged;
                addProduct.Show();
            }
            else
            {
                MessageBox.Show("Please select a product to edit");
            }
        }
        public NewProductWindow(Product selectedItem, ProductWindow productWindow, DatabaseContext context) : this(context)
        {
            nameTextField.Text        = selectedItem.Name;
            descriptionTextField.Text = selectedItem.Description;
            priceTextField.Text       = selectedItem.Price.ToString();
            amountTextField.Text      = selectedItem.Amount.ToString();
            unitTextField.Text        = selectedItem.Unit;
            discountTextField.Text    = selectedItem.Discount.ToString();
            addTaxButton.Content      = selectedItem.Tax.Name + ", Amount: " + selectedItem.Tax.TaxAmount;

            this.productWindow = productWindow;
            product            = selectedItem;
            tax          = selectedItem.Tax;
            isUpdateFlag = true;
        }
Beispiel #21
0
        void Create(int n)
        {
            bool flag = false;

            switch (n)
            {
            case 0:
                BillWindow bw = new BillWindow(db);
                flag = bw.ShowDialog();
                break;

            case 1:
                EntryWindow ew = new EntryWindow(db);
                flag = ew.ShowDialog();
                break;

            case 2:
                ProductWindow pw = new ProductWindow(db);
                flag = pw.ShowDialog();
                break;

            case 3:
                ServiceWindow sw = new ServiceWindow(db);
                flag = sw.ShowDialog();
                break;

            case 4:
                ClientWindow cw = new ClientWindow(db);
                flag = cw.ShowDialog();
                break;

            case 5:
                CarWashWindow cww = new CarWashWindow(db);
                flag = cww.ShowDialog();
                break;
            }
            if (flag)
            {
                Refresh(n);
            }
        }
Beispiel #22
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Product product = (Product)ProductsDataGrid.SelectedItem;

                ProductWindow productWindow = new ProductWindow();

                productWindow.ProductNameTextBox.Text       = product.ProductName;
                productWindow.ProductNameTextBox.IsEnabled  = false;
                productWindow.AmountTextBox.Text            = product.Amount.ToString();
                productWindow.UnitComboBox.Text             = product.Unit;
                productWindow.PriceTextBox.Text             = product.Price.ToString();
                productWindow.DepartamentNamesComboBox.Text = product.Departament.DepartamentName;
                productWindow.EnterButton.Content           = "Сохранить";

                productWindow.Show();
            }
            catch
            { }
        }
Beispiel #23
0
        /// <summary>
        /// 产品管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbProduct_Click(object sender, EventArgs e)
        {
            if (null == productWindow || productWindow.IsDisposed)
            {
                productWindow            = new ProductWindow();
                productWindow.MdiParent  = this;
                productWindow.StartLoad += (obj, ev) =>
                {
                    StartLoad(obj);
                };
                productWindow.StopLoad += (obj, ev) =>
                {
                    StopLoad(obj);
                };


                productWindow.Show();
            }

            SetSelect(tsbProduct, tsmiProduct);
            productWindow.Activate();
        }
 public NewProductWindow(ProductWindow productWindow, DatabaseContext context) : this(context)
 {
     this.productWindow = productWindow;
 }
Beispiel #25
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            ProductWindow p1 = new ProductWindow();

            p1.Show();
        }
        public MainViewModel()
        {
            ImportWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (_UserIDRole != 1)
                {
                    LoadDialogErrorNotPermission();
                    return;
                }
                ImportWindow wd = new ImportWindow();
                wd.ShowDialog();
            });
            SellWindow     = new RelayCommand <Window>((p) => { return(true); }, (p) => { SellWindow wd = new SellWindow(); wd.ShowDialog(); });
            CustomerWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); });
            ProductWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                         {
                                                                                             LoadDialogErrorNotPermission(); return;
                                                                                         }
                                                                                         ProductWindow wd = new ProductWindow(); wd.ShowDialog(); });
            SupplierWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); });
            StatisticalWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                             {
                                                                                                 LoadDialogErrorNotPermission(); return;
                                                                                             }
                                                                                             StatisticalWindow wd = new StatisticalWindow(); wd.ShowDialog(); });
            UnitWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      UnitWindow wd = new UnitWindow(); wd.ShowDialog(); });
            UserListWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          UserListWindow wd = new UserListWindow(); wd.ShowDialog(); });
            AccountCreateWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                               {
                                                                                                   LoadDialogErrorNotPermission(); return;
                                                                                               }
                                                                                               AccountCreateWindow wd = new AccountCreateWindow(); wd.ShowDialog(); });
            BillWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      BillWindow wd = new BillWindow(); wd.ShowDialog(); });
            LoadMainWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (!isLoaded)
                {
                    isLoaded = true;
                    if (p == null)
                    {
                        return;
                    }

                    p.Hide();
                    LoginWindow wd = new LoginWindow();
                    wd.ShowDialog();
                    var loginViewModel = wd.DataContext as LoginViewModel;
                    if (loginViewModel == null)
                    {
                        return;
                    }
                    if (loginViewModel.isLogin)
                    {
                        loadUserCurrentLogin();
                        p.Show();
                    }
                    else
                    {
                        p.Close();
                    }
                }
            });

            LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); });
        }
Beispiel #27
0
        void product_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var productWindow = new ProductWindow();

            productWindow.Show();
        }
Beispiel #28
0
        public void OpenProduct()
        {
            ProductWindow pw = new ProductWindow();

            pw.Show();
        }
Beispiel #29
0
        //Метод откряти окна справочника продукции
        private void OpenProdWindow()
        {
            ProductWindow window = new ProductWindow();

            window.Show();
        }
Beispiel #30
0
        private void ProductButton_Click(object sender, RoutedEventArgs e)
        {
            ProductWindow pw = new ProductWindow();

            pw.Show();
        }