private void button_Click(object sender, RoutedEventArgs e)
        {
            if (tbCategory.Text != " ")
            {
                using (ShopAutoEntities db1 = new ShopAutoEntities())
                {
                    try
                    {
                        ProductCategorry ProCa = (new ProductCategorry()
                        {
                            CategoryExtra = tbCategory.Text
                        });
                        db1.ProductCategorry.Add(ProCa);
                        db1.SaveChanges();
                        ShowCategory();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                tbCategory.Text = " ";
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            using (ShopAutoEntities db = new ShopAutoEntities())
            {
                //  Binding binding = new Binding();
                try
                {
                    Products Prod = (new Products()
                    {
                        Name = tbName.Text,
                        Brand = AllBrand,
                        Category = ComboBoxCategory.Text,
                        ART = tbArt.Text,
                        Catalogue_num = tbCatalogNum.Text,
                        Manufacturer = tbManufacturer.Text,
                        Price_first = Convert.ToDecimal(tbPriceFirst.Text),
                        Price_sale = Convert.ToDecimal(tbPriceFirst.Text),
                        Color = tbColor.Text,
                        Product_rest = Convert.ToInt32(tbProductRest.Text)
                    });
                    db.Products.Add(Prod);
                    db.SaveChanges();

                    this.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
 private void ButAdd_Click(object sender, RoutedEventArgs e)
 {
     using (ShopAutoEntities db = new ShopAutoEntities())
     {
         try
         {
             Employee emp = (new Employee()
             {
                 Post = tbPosition.Text,
                 FIO = tbName.Text + " " + tbfamile.Text + " " + tbochesvo.Text,
                 Date_start = Convert.ToDateTime(DateStart.Text),
                 Birthday = Convert.ToDateTime(tbbirdDay.Text),
                 Passport_data = tbPassportData.Text,
                 Phone1 = tbPhone.Text,
                 Phone2 = tbPhone2.Text
             });
             db.Employee.Add(emp);
             db.SaveChanges();
             Users us = (new Users()
             {
                 Login = tbLogin.Text,
                 Password = tbPassword.Text
             });
             db.Users.Add(us);
             db.SaveChanges();
             this.Hide();
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
         }
     }
 }
Beispiel #4
0
 private void _renewControlls()
 {
     using (ShopAutoEntities db = new ShopAutoEntities())
     {
         List <Employee> list = db.Employee.Where(c => c.Date_end == null).ToList();
         listBox.ItemsSource = list;
     }
 }
Beispiel #5
0
 public void _renewControlls()
 {
     using (ShopAutoEntities db = new ShopAutoEntities())
     {
         List <Products> list = db.Products.ToList();
         dataGriPriduct.ItemsSource = list;
     }
 }
 public void ShowCategory()
 {
     using (ShopAutoEntities db = new ShopAutoEntities())
     {
         List <ProductCategorry> list = db.ProductCategorry.ToList();
         foreach (var item in list)
         {
             ComboBoxCategory.Items.Add(item.CategoryExtra);
         }
     }
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Employee ct = (Employee)DataContext;

            // Используем LINQ to Entities для обновления базы данных
            ShopAutoEntities db = new ShopAutoEntities();

            Employee ct1 = db.Employee
                           .Where(p => p.Id == ct.Id)
                           .Single <Employee>();

            //обновление
            ct1.Date_end = Calendar1.DisplayDate;
            db.SaveChanges();
            this.Hide();
        }
        //public List<string> Categore()
        //     {
        //       return   CategoreList1;
        //     }

        public void ShowCategory()
        {
            using (ShopAutoEntities db = new ShopAutoEntities())
            {
                List <ProductCategorry> list = db.ProductCategorry.ToList();
                DataGridCategory.ItemsSource = list;
            }

            //        CategoreList1.Add("Двигатель");
            //CategoreList1.Add("ВЫХЛОПНАЯ СИСТЕМА"); ;
            //CategoreList1.Add("ДЕТАЛИ ДЛЯ СЕРВИСА, ТО, УХОДА");
            //CategoreList1.Add("ДОПОЛНИТЕЛЬНЫЕ УДОБСТВА");
            //CategoreList1.Add("КОЛЁСА, КОМПЛЕКТУЮЩИ");
            //CategoreList1.Add("ПОДВЕСКА, АМОРТИЗАЦИ");
            //CategoreList1.Add("РУЛЕВОЕ УПРАВЛЕН");
            //CategoreListBox.ItemsSource = CategoreList1;
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (DataGridCategory.SelectedItem != null)
            {
                ProductCategorry CategoreProd = DataGridCategory.SelectedItem as ProductCategorry;


                // Используем LINQ to Entities для обновления базы данных
                ShopAutoEntities db = new ShopAutoEntities();

                ProductCategorry pro = db.ProductCategorry
                                       .Where(p => p.Id == CategoreProd.Id)
                                       .Single <ProductCategorry>();
                //обновление
                db.ProductCategorry.Remove(pro);
                db.SaveChanges();
                ShowCategory();
            }
        }
Beispiel #10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShopAutoEntities db = new ShopAutoEntities();
            var list            = db.Users.ToList();

            foreach (var item in list)
            {
                if (UsernameLabel.Text == item.Login && PasswordLabel.Password == item.Password)
                {
                    Window r1 = new AdminWindow();
                    r1.Show();
                    this.Close();
                    Console.WriteLine(UsernameLabel.Text + " " + item.Login);
                }
                else
                {
                    Console.WriteLine("текст :" + "   " + UsernameLabel.Text + "     " + "бд:" + "    " + item.Login);
                }
            }
        }
Beispiel #11
0
        private void ButAdd_Click(object sender, RoutedEventArgs e)
        {
            Employee ct = (Employee)DataContext;

            // Используем LINQ to Entities для обновления базы данных
            ShopAutoEntities db = new ShopAutoEntities();

            Employee ct1 = db.Employee
                           .Where(p => p.Id == ct.Id)
                           .Single <Employee>();

            //обновление
            ct1.FIO           = ct.FIO;
            ct1.Birthday      = ct.Birthday;
            ct1.Date_start    = ct.Date_start;
            ct1.Passport_data = ct.Passport_data;
            ct1.Phone1        = ct.Phone1;
            ct1.Phone2        = ct.Phone2;
            ct1.Post          = ct.Post;
            db.SaveChanges();
            this.Hide();
        }