Exemplo n.º 1
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            if (goodsCodeTextBox.Text == "" || goodsNameTextBox.Text == "" || colorCmb.SelectedIndex == -1 || brandCmb.SelectedIndex == -1 || sizeCmb.SelectedIndex == -1 ||
                typeCmb.SelectedIndex == -1 || numberTextBox.Text == "" || importDateDatePicker.Text == "" || priceTextBox.Text == "")
            {
                var AnnouncementWindowScreen = new AnnouncementWindow("THE INFORMATION IS INVALID. PLEASE CHECK AGAIN...");

                if (AnnouncementWindowScreen.ShowDialog() == true)
                {
                    return;
                }
                else
                {
                    return;
                }
            }

            if (busGoods.IsGoodsCodeValid(goodsCodeTextBox.Text) == false)
            {
                var AnnouncementWindowScreen = new AnnouncementWindow("GOODSCODE IS INVALID");

                if (AnnouncementWindowScreen.ShowDialog() == true)
                {
                    return;
                }
                else
                {
                    return;
                }
            }

            Good newGoods = new Good()
            {
                GoodsCode   = goodsCodeTextBox.Text,
                GoodsName   = goodsNameTextBox.Text,
                ID_Color    = colorCmb.SelectedIndex + 1,
                ID_Brand    = brandCmb.SelectedIndex + 1,
                ID_Size     = sizeCmb.SelectedIndex + 1,
                ID_Type     = typeCmb.SelectedIndex + 1,
                Number      = int.Parse(numberTextBox.Text),
                Import_Date = importDateDatePicker.SelectedDate,
                Price       = double.Parse(priceTextBox.Text),
                Picture     = addedPicture.Source.ToString(),
                ID_Sale     = 1
            };

            var ValidationWindowScreen = new ValidationWindow("ADD NEW");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                busGoods.AddGoods(newGoods);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
Exemplo n.º 2
0
        private void searchButton3_Click(object sender, RoutedEventArgs e)
        {
            if (searchTextBox3.Text.Length == 0)
            {
                return;
            }

            Good goods = busGoods.GetGoodsByGoodsCode(searchTextBox3.Text);

            if (goods.GoodsCode == searchTextBox3.Text)
            {
                var SaleGoodsInfoWindowScreen = new SaleGoodsInfoWindow(goods);

                if (SaleGoodsInfoWindowScreen.ShowDialog() == true)
                {
                    return;
                }
                else
                {
                    return;
                }
            }

            //MessageBox.Show("Không tìm thấy...Vui lòng nhập lại Code!");
            var AnnouncementWindowScreen = new AnnouncementWindow("DON'T FIND THIS CODE...PLEASE TYPE AGAIN!");

            if (AnnouncementWindowScreen.ShowDialog() == true)
            {
                return;
            }
            else
            {
                return;
            }
        }
        private void searchButton_Click(object sender, RoutedEventArgs e)
        {
            if (searchTextBox.Text == "")
            {
                return;
            }

            List <Bill> bills = billListView.ItemsSource as List <Bill>;

            for (int i = 0; i < bills.Count; i++)
            {
                if (bills[i].BillCode == searchTextBox.Text)
                {
                    List <Good> goodsOfSelectedBill = new List <Good>();

                    for (int j = 0; j < busBill.GetID_GoodsByBillCode(bills[i].BillCode).Count; j++)
                    {
                        goodsOfSelectedBill.Add(busGoods.GetGoodsById(busBill.GetID_GoodsByBillCode(bills[i].BillCode)[j]));
                    }

                    var PaymentWindowScreen = new PaymentWindow(1, bills[i].BillCode, bills[i].CustomerName, bills[i].CustomerPhoneNumber, bills[i].CustomerAddress,
                                                                userConverter.Convert(bills[i].ID_Staff.Value, null, null, null) as string, goodsOfSelectedBill, bills[i].Total.ToString());

                    if (PaymentWindowScreen.ShowDialog() == true)
                    {
                        return;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            var AnnouncementWindowScreen = new AnnouncementWindow("DON'T FIND THIS CODE... PLEASE TYPE AGAIN!");

            if (AnnouncementWindowScreen.ShowDialog() == true)
            {
                return;
            }
            else
            {
                return;
            }
        }
Exemplo n.º 4
0
        private void searchButton_Click(object sender, RoutedEventArgs e)
        {
            if (searchTextBox.Text.Length == 0)
            {
                return;
            }

            Good goods = busGoods.GetGoodsByGoodsCode(searchTextBox.Text);

            if (goods.GoodsCode == searchTextBox.Text)
            {
                var AddItemsToCartWindowScreen = new AddItemsToCartWindow(goods);

                if (AddItemsToCartWindowScreen.ShowDialog() == true)
                {
                    for (int i = 1; i <= AddItemsToCartWindowScreen.Number; i++)
                    {
                        _goodsList.Add(goods);
                        PlusCurrentTotal((float)goods.Price, (int)goods.ID_Sale);
                    }

                    return;
                }
                else
                {
                    return;
                }
            }

            //MessageBox.Show("Không tìm thấy...Vui lòng nhập lại Code!");
            var AnnouncementWindowScreen = new AnnouncementWindow("DON'T FIND THIS CODE...PLEASE TYPE AGAIN!");

            if (AnnouncementWindowScreen.ShowDialog() == true)
            {
                return;
            }
            else
            {
                return;
            }
        }