コード例 #1
0
        private void updateButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("UPDATE");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                tempUpdatedGoods.GoodsCode   = goodsCodeTextBox.Text;
                tempUpdatedGoods.GoodsName   = goodsNameTextBox.Text;
                tempUpdatedGoods.ID_Color    = colorCmb.SelectedIndex + 1;
                tempUpdatedGoods.ID_Brand    = brandCmb.SelectedIndex + 1;
                tempUpdatedGoods.ID_Size     = sizeCmb.SelectedIndex + 1;
                tempUpdatedGoods.ID_Type     = typeCmb.SelectedIndex + 1;
                tempUpdatedGoods.Number      = int.Parse(numberTextBox.Text);
                tempUpdatedGoods.Import_Date = importDateDatePicker.SelectedDate;
                tempUpdatedGoods.Price       = double.Parse(priceTextBox.Text);
                tempUpdatedGoods.Picture     = addedPicture.Source.ToString();

                busGoods.UpdateGoods(tempUpdatedGoods);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("SAVE");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                Expens newExpenses = new Expens()
                {
                    Electric      = float.Parse(electricTextBox.Text),
                    Water         = float.Parse(waterTextBox.Text),
                    Rent_Premises = float.Parse(premisesTextBox.Text),
                    DateTime      = date.SelectedDate,
                    SalaryStaff   = float.Parse(salaryTextBox.Text),
                    Goods         = float.Parse(goodsTextBox.Text),
                    Total         = float.Parse(totalTextBlock.Text),
                };

                busExpenses.AddExpenses(newExpenses);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #4
0
        private void cancelButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("CANCEL");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #5
0
        private void exitButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("EXIT");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                this.DialogResult = false;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #6
0
        private void paynowButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("PAY NOW THIS BILL");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #7
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("DELETE");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                busGoods.DeleteGoods(tempUpdatedGoods);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #8
0
        private void updateButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("UPDATE THIS SALE");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                tempUpdateSaleGoods.ID_Sale = saleCmb.SelectedIndex + 1;

                busGoods.UpdateSaleGoods(tempUpdateSaleGoods);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #9
0
        private void cancelbillButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("CANCEL THIS BILL");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                customernameTextBox.Text = "";
                phonenumberTextBox.Text  = "";
                addressTextBox.Text      = "";
                totalTextBlock.Text      = "0";
                cashTextBox.Text         = "0";
                _goodsList.Clear();

                return;
            }
            else
            {
                return;
            }
        }
コード例 #10
0
        private void removeMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var removedGoodsIndex = goodsListView.SelectedIndex;

            if (removedGoodsIndex == -1)
            {
                return;
            }

            var ValidationWindowScreen = new ValidationWindow("REMOVE THIS ITEM");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                SubstractCurrentTotal((float)_goodsList[removedGoodsIndex].Price, (int)_goodsList[removedGoodsIndex].ID_Sale);
                _goodsList.RemoveAt(removedGoodsIndex);
            }
            else
            {
                return;
            }
        }
コード例 #11
0
        private void refreshButton2_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("REFRESH");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                goodsListView2.ItemsSource = busGoods.GetAllGoods();

                searchTextBox1.Text      = "";
                cmbColors2.SelectedIndex = -1;
                cmbBrands2.SelectedIndex = -1;
                minimumPrice2.Text       = "minimum";
                maximumPrice2.Text       = "maximum";
                cmbTypes2.SelectedIndex  = -1;
                cmbSizes2.SelectedIndex  = -1;
            }
            else
            {
                return;
            }
        }
コード例 #12
0
        private void updateButton_Click(object sender, RoutedEventArgs e)
        {
            var ValidationWindowScreen = new ValidationWindow("UPDATE");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                tempSaveUpdateExpenses.Electric      = float.Parse(electricTextBox.Text);
                tempSaveUpdateExpenses.Water         = float.Parse(waterTextBox.Text);
                tempSaveUpdateExpenses.Rent_Premises = float.Parse(premisesTextBox.Text);
                tempSaveUpdateExpenses.DateTime      = date.SelectedDate;
                tempSaveUpdateExpenses.SalaryStaff   = float.Parse(salaryTextBox.Text);
                tempSaveUpdateExpenses.Goods         = float.Parse(goodsTextBox.Text);
                tempSaveUpdateExpenses.Total         = float.Parse(totalTextBlock.Text);

                busExpenses.UpdateExpenses(tempSaveUpdateExpenses);

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                return;
            }
        }
コード例 #13
0
        private void deleteMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var deletedGoodsIndex = goodsListView4.SelectedIndex;

            if (deletedGoodsIndex == -1)
            {
                return;
            }

            var ValidationWindowScreen = new ValidationWindow("DELETE THIS ITEM");

            if (ValidationWindowScreen.ShowDialog() == true)
            {
                busExpenses.DeleteExpenses((Expens)goodsListView4.SelectedItem);

                goodsListView4.ItemsSource = busExpenses.GetAllExpenses();

                return;
            }
            else
            {
                return;
            }
        }