コード例 #1
0
        public AddDiscount()
        {
            InitializeComponent();

            DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

            technicComboBox.ItemsSource         = dataBase.OutputAllTechnic();
            currentDiscountComboBox.ItemsSource = dataBase.OutputAllDiscount();

            dataBase.OutputTableDiscount(discountDataGrid);
        }
コード例 #2
0
        private void DeleteDiscountButton_Click(object sender, RoutedEventArgs e)
        {
            if (CheckFullProductDelete())
            {
                DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

                dataBase.DeleteDiscount(currentDiscountComboBox.SelectedItem.ToString());

                currentDiscountComboBox.SelectedIndex = -1;
                discountDataGrid.Items.Clear();
                currentDiscountComboBox.ItemsSource = null;

                currentDiscountComboBox.ItemsSource = dataBase.OutputAllDiscount();
                dataBase.OutputTableDiscount(discountDataGrid);

                MessageBox.Show("        Удаление прошло успешно");
            }
        }
コード例 #3
0
        private void AddDiscountButton_Click(object sender, RoutedEventArgs e)
        {
            if (CheckFullDiscount())
            {
                DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

                if (dataBase.AddDiscount(technicComboBox.SelectedItem.ToString(), discountTextBox.Text))
                {
                    Tuple <string, int> tuple = new Tuple <string, int>
                                                    (technicComboBox.SelectedItem.ToString(), Convert.ToInt32(discountTextBox.Text));

                    currentDiscountComboBox.SelectedIndex = -1;
                    discountDataGrid.Items.Clear();
                    currentDiscountComboBox.ItemsSource = null;

                    dataBase.OutputTableDiscount(discountDataGrid);
                    currentDiscountComboBox.ItemsSource = dataBase.OutputAllDiscount();

                    technicComboBox.SelectedIndex = -1;
                    discountTextBox.Text          = "";
                }
                else
                {
                    bool isMessageResultAgree = MessageBox.Show
                                                    ("Скидка на этот товар существует. Изменить существующую скидку?", "Изменнение скидки",
                                                    MessageBoxButton.YesNo) == MessageBoxResult.Yes;

                    if (isMessageResultAgree)
                    {
                        dataBase.UpdateDiscount(technicComboBox.SelectedItem.ToString(), discountTextBox.Text);

                        discountDataGrid.Items.Clear();
                        dataBase.OutputTableDiscount(discountDataGrid);
                    }

                    technicComboBox.SelectedIndex = -1;
                    discountTextBox.Text          = "";
                }
            }
        }
コード例 #4
0
        private void DeleteAllDiscountButton_Click(object sender, RoutedEventArgs e)
        {
            bool isMessageResultAgree = MessageBox.Show
                                            ("                    Удалить всё?", "Подтверждение операции",
                                            MessageBoxButton.YesNo) == MessageBoxResult.Yes;

            if (isMessageResultAgree)
            {
                DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

                dataBase.DeleteDiscount();

                currentDiscountComboBox.SelectedIndex = -1;
                currentDiscountComboBox.ItemsSource   = null;
                discountDataGrid.Items.Clear();

                currentDiscountComboBox.ItemsSource = dataBase.OutputAllDiscount();
                dataBase.OutputTableDiscount(discountDataGrid);

                MessageBox.Show("        Удаление прошло успешно");
            }
        }