public ProductPage(string Type)
        {
            InitializeComponent();
            Thread thread = new Thread(delegate()
            {
                Manage_Product dbProduct = new Manage_Product();

                int Arrangeindex = 0;
                Dispatcher.Invoke(() => { Arrangeindex = comboProductArrange.SelectedIndex; });
                this.products = dbProduct.FilterProduct(Type);

                Dispatcher.Invoke(() =>
                {
                    if (products.Count == 0)
                    {
                        lbsp.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        lbsp.Visibility = Visibility.Hidden;
                    }
                    listviewShowProduct.ItemsSource = products;
                    ProgressBar.IsEnabled           = false;
                    ProgressBar.Visibility          = Visibility.Hidden;
                });
            });

            thread.Start();
        }
        void LoadMenuItemType(bool data)
        {
            Manage_Product manage = new Manage_Product();

            ObservableCollection <string> a = new ObservableCollection <string>();

            a = manage.getListTypeName();
            for (int i = 0; i < a.Count; i++)
            {
                MenuItem t = new MenuItem();
                t.Header = a[i];
                t.Click += T_Click;
                typeMenu.Items.Add(t);
            }
        }
Beispiel #3
0
        void Refresh(bool data)
        {
            Thread thread = new Thread(delegate()
            {
                var db      = new Manage_Product();
                producttype = new ObservableCollection <Type_product>(db.Load_ProductType());


                Dispatcher.Invoke(() =>
                {
                    listProductType.ItemsSource = producttype;
                });
            });

            thread.Start();
        }
Beispiel #4
0
        public SupplierPage()
        {
            InitializeComponent();
            setTextBox(false);
            btnDelete.IsEnabled    = false;
            btnEdit.IsEnabled      = false;
            listSupplier.IsEnabled = true;
            btnAdd.IsEnabled       = true;
            Thread thread = new Thread(delegate()
            {
                var db      = new Manage_Product();
                var suplier = new ObservableCollection <Supplier>(db.LoadData_Supplier());

                Dispatcher.Invoke(() =>
                {
                    listSupplier.ItemsSource = suplier;
                });
            });

            thread.Start();
        }
        private void ComboProductArrange_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Thread thread = new Thread(delegate()
            {
                Manage_Product dbProduct = new Manage_Product();
                products = new ObservableCollection <Detail_Product>(dbProduct.LoadData_Product());

                int Arrangeindex = 0;
                Dispatcher.Invoke(() => { Arrangeindex = comboProductArrange.SelectedIndex; });
                products = dbProduct.Arrange_Product(Arrangeindex);

                Dispatcher.Invoke(() =>
                {
                    listviewShowProduct.ItemsSource = products;
                    ProgressBar.IsEnabled           = false;
                    ProgressBar.Visibility          = Visibility.Hidden;
                });
            });

            thread.Start();
        }
Beispiel #6
0
        public ProductTypePage()
        {
            InitializeComponent();
            TextboxSet(false);

            btnDelete.IsEnabled      = false;
            btnEditProduct.IsEnabled = false;
            Thread thread = new Thread(delegate()
            {
                var db          = new Manage_Product();
                var producttype = new ObservableCollection <Type_product>(db.Load_ProductType());


                Dispatcher.Invoke(() =>
                {
                    listProductType.ItemsSource = producttype;
                });
            });

            thread.Start();
        }
        bool CheckBill()
        {
            if (editCustomerName.Text.Length == 0 || // Nếu tên khách hàng trống
                editCustomerEmail.Text.Length == 0 ||
                editCustomerPhone.Text.Length == 0 ||
                birthdate.Text.Length == 0 ||
                imgProduct.Source == null || // Nếu sản phẩm mua trống
                editNumberBuy.Text.Length == 0 ||                                     // Nếu số lượng mua trống
                (rdoGoToShop.IsChecked == true && editMoneyTaken.Text.Length == 0) || // Nếu thanh toán trực tiếp mà chưa đưa tiền
                (rdoShip.IsChecked == true && editAddress.Text.Length == 0) ||        // Nếu thanh toán giao hàng mà không đưa địa chỉ
                (rdoShip.IsChecked == true && editMoneyWillGet.Text.Length == 0))     // Nếu thanh toán giao hàng mà không biết số tiền sẽ thu
            {
                var dialog = new Dialog()
                {
                    Message = "Vui lòng nhập đầy đủ thông tin"
                };
                dialog.Owner = Window.GetWindow(this);
                dialog.ShowDialog();
                return(false);
            }

            // Kiểm tra còn đủ hàng hay không

            int number = 0;                                         // Số lượng mua

            int.TryParse(editNumberBuy.Text, out number);
            Manage_Product manage = new Manage_Product();

            if (manage.CheckCurrentAmount(product.ID_Product, number) == false)  // Nếu số lượng không đủ thì thông báo
            {
                var dialog = new Dialog()
                {
                    Message = "Sản phẩm không đủ số lượng"
                };
                dialog.Owner = Window.GetWindow(this);
                dialog.ShowDialog();
                return(false);
            }
            return(true);
        }
Beispiel #8
0
        public StatisticViewModel()
        {
            manage = new Manage_Product();
            ListInstanceStatistic = new ObservableCollection <InstanceStatistic>();
            ListTypeProduct       = new ObservableCollection <Type_product>();
            //listInstanceStatistic = new ObservableCollection<InstanceStatistic>();
            //LoadInstanceStatistic();
            //LoadInstanceStatistic();
            #region GetData forItemStock
            // ItemStock = new ObservableCollection<StoreStock>();
            //LoadStoreStock();
            #endregion


            listSpecificOptionView = new ObservableCollection <string>();
            listSpecificOptionView = listSpecificYear;  //List Binding to View

            // listTypeProduct = new ObservableCollection<Type_product>(DataProvider.Ins.DB.Type_product);

            Thread threadTmp = new Thread(delegate()
            {
                LoadInstanceStatistic();
            });
            threadTmp.Start();
            UpdateStatitis = new RelayCommand <UserControl>((p) => { return(true); }, (p) =>
            {
                getDuration();

                // Thread thread = new Thread(delegate ()
                // {
                LoadInstanceStatistic();
                //  });

                #region GetCombobox
                //  thread.Start();

                #endregion
                //  MessageBox.Show(ListInstanceStatistic.Count + "   " + ListTypeProduct.Count);
            });
        }
        public ProductPage()
        {
            InitializeComponent();
            Thread thread = new Thread(delegate()
            {
                Manage_Product dbProduct = new Manage_Product();
                products = new ObservableCollection <Detail_Product>(dbProduct.LoadData_Product());

                int Arrangeindex = 0;
                Dispatcher.Invoke(() => { Arrangeindex = comboProductArrange.SelectedIndex; });
                products = dbProduct.Arrange_Product(Arrangeindex);

                Dispatcher.Invoke(() =>
                {
                    listviewShowProduct.ItemsSource = products;
                    ProgressBar.IsEnabled           = false;
                    ProgressBar.Visibility          = Visibility.Hidden;
                });
            });

            thread.Start();
        }
        private void ComboFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            listBill.ItemsSource   = null;
            ProgressBar.IsEnabled  = true;
            ProgressBar.Visibility = Visibility.Visible;
            Thread thread = new Thread(delegate()
            {
                Manage_Product dbProduct = new Manage_Product();

                int Arrangeindex = 0;
                Dispatcher.Invoke(() => { Arrangeindex = comboFilter.SelectedIndex; });
                Bills = dbProduct.Arrange_ListBill(Arrangeindex);

                Dispatcher.Invoke(() =>
                {
                    listBill.ItemsSource   = Bills;
                    ProgressBar.IsEnabled  = false;
                    ProgressBar.Visibility = Visibility.Hidden;
                });
            });

            thread.Start();
        }