Esempio n. 1
0
        public ClientiWindow()
        {
            InitializeComponent();

            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            var lista = (from x in db.Clienti select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Clienti>(lista);
        }
Esempio n. 2
0
        public ProduseWindow()
        {
            InitializeComponent();
            DataContext = this;

            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            var lista = (from x in db.Produse select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Produse>(lista);
        }
Esempio n. 3
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            Clienti c = new Clienti() :
                            c.Nume = Nume.Text;

            db.Clienti.Add(c);

            db.SaveChanges();

            var lista = (from x in db.Clienti select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Clienti>(lista);
        }
Esempio n. 4
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            Produse p = new Produse();

            p.Nume = Nume.Text;
            p.Pret = int.Parse(Pret.Text);
            p.Stoc = int.Parse(Stoc.Text);

            db.Produse.Add(p);
            db.SaveChanges();

            var lista = (from x in db.Produse select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Produse>(lista);
        }
Esempio n. 5
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            Angajati a = new Angajati();

            a.Nume    = Nume.Text;
            a.Salariu = int.Parse(Salariu.Text);

            db.Angajati.Add(a);

            db.SaveChanges();

            var lista = (from x in db.Angajati select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Angajati>(lista);
        }
Esempio n. 6
0
        private void RemoveButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            var query = from x in db.Produse
                        where x.Nume == Nume.Text || x.Pret == int.Parse(Pret.Text) || x.Stoc == int.Parse(Stoc.Text)
                        select x;

            foreach (var i in query)
            {
                db.Produse.Remove(i);
            }
            db.SaveChanges();

            var lista = (from x in db.Produse select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Produse>(lista);
        }
Esempio n. 7
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            Vanzari v = new Vanzari();

            v.ProdusId  = int.Parse(ProdusId.Text);
            v.ClientId  = int.Parse(ClientId.Text);
            v.AngajatId = int.Parse(AngajatId.Text);

            db.Vanzari.Add(v);

            db.SaveChanges();

            var lista = (from x in db.Vanzari select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Vanzari>(lista);
        }
Esempio n. 8
0
        private void RemoveButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            var query = from x in db.Clienti
                        where x.Nume == Nume.Text
                        select x;

            foreach (var i in query)
            {
                db.Clienti.Remove(i);
            }

            db.SaveChanges();

            var lista = (from x in db.Clienti select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Clienti>(lista);
        }
Esempio n. 9
0
        private void RemoveButton(object sender, RoutedEventArgs e)
        {
            MagazinDatabaseEntities db = new MagazinDatabaseEntities();

            var query = from x in db.Vanzari
                        where x.ProdusId == int.Parse(ProdusId.Text) || x.ClientId == int.Parse(ClientId.Text) || x.AngajatId == int.Parse(AngajatId.Text)
                        select x;

            foreach (var i in query)
            {
                db.Vanzari.Remove(i);
            }

            db.SaveChanges();

            var lista = (from x in db.Vanzari select x).ToList();

            dataGrid.ItemsSource = new ObservableCollection <Vanzari>(lista);
        }