Example #1
0
        private void AddProductButton_Click(object sender, RoutedEventArgs e)
        {
            if (CheckFullData())
            {
                DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

                bool isSuccessfulAdd = dataBase.CreateNewTechnic(nameProductTextBox.Text, typeProductTextBox.Text,
                                                                 priceProductTextBox.Text, nameFabricatorTextBox.Text);

                if (isSuccessfulAdd)
                {
                    MessageBox.Show("Товар создан");
                    dataBase.OutputTableProduct(listProductDataGrid);

                    nameProductTextBox.Clear();
                    nameFabricatorTextBox.Clear();
                    typeProductTextBox.Clear();
                    priceProductTextBox.Clear();
                }

                else
                {
                    MessageBox.Show("Такой товар уже существует");

                    nameProductTextBox.Clear();
                    nameFabricatorTextBox.Clear();
                    typeProductTextBox.Clear();
                    priceProductTextBox.Clear();
                }
            }
        }
Example #2
0
        public AddProduct()
        {
            InitializeComponent();

            DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);
            dataBase.OutputTableProduct(listProductDataGrid);
        }