Пример #1
0
        private void Button_Auth_Click(object sender, RoutedEventArgs e)
        {
            string login    = textBox_Login.Text.Trim();
            string password = passwordBox_Password.Password.Trim();

            if (login.Length < 4)
            {
                textBox_Login.ToolTip    = "Поле введено не корректно!";
                textBox_Login.Background = Brushes.DarkGreen;
            }
            else if (password.Length < 3)
            {
                passwordBox_Password.ToolTip    = "Поле введено не корректно!";
                passwordBox_Password.Background = Brushes.DarkGreen;
            }
            else
            {
                textBox_Login.ToolTip           = "";
                textBox_Login.Background        = Brushes.Transparent;
                passwordBox_Password.ToolTip    = "";
                passwordBox_Password.Background = Brushes.Transparent;

                MenuWindow menu = new MenuWindow();
                menu.Show();
                this.Close();
            }
        }
        private void ChangeProductButton_Click(object sender, RoutedEventArgs e)
        {
            //AccessoriesStoreDB db = new AccessoriesStoreDB();
            AccessoriesEntitiesBD db   = new AccessoriesEntitiesBD();
            MenuWindow            menu = new MenuWindow();
            var change = from c in db.Products where c.ID == menu.changedId select c;

            foreach (var item in change)
            {
                item.ProductName  = textBox_Name.Text;
                item.ProductPrice = textBox_Price.Text;
                item.ArrivalDate  = arrivalDate.DisplayDate;
                item.ProductType  = comboBox_Product.Text;
            }

            db.SaveChanges();

            (this.Parent as Grid).Children.Remove(this);
        }