コード例 #1
0
        private void Supprimier_Click(object sender, RoutedEventArgs e)
        {
            if (name == "Engrais")
            {
                foreach (var item in listID)
                {
                    engrai p = new engrai()
                    {
                        id = item
                    };
                    db.engrais.Attach(p);
                    db.engrais.Remove(p);
                }

                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.engrais select s).ToList();
                return;
            }
            if (name == "Irrigation")
            {
                foreach (var item in listID)
                {
                    Irrigation p = new Irrigation()
                    {
                        id = item
                    };
                    db.Irrigations.Attach(p);
                    db.Irrigations.Remove(p);
                }

                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.Irrigations select s).ToList();
                return;
            }
            if (name == "Pesticides")
            {
                foreach (var item in listID)
                {
                    Pesticide p = new Pesticide()
                    {
                        id = item
                    };
                    db.Pesticides.Attach(p);
                    db.Pesticides.Remove(p);
                }

                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.Pesticides select s).ToList();
                return;
            }
        }
コード例 #2
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            DBagricultureEntities db = new DBagricultureEntities();

            if (AllDataBases.name == "Engrais")
            {
                engrai p = new engrai()
                {
                    id = idGlobal
                };
                db.engrais.Attach(p);
                db.engrais.Remove(p);
                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.engrais select s).ToList();
                this.Close();
                return;
            }
            if (AllDataBases.name == "Irrigation")
            {
                Irrigation p = new Irrigation()
                {
                    id = idGlobal
                };
                db.Irrigations.Attach(p);
                db.Irrigations.Remove(p);
                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.Irrigations select s).ToList();
                this.Close();
                return;
            }
            if (AllDataBases.name == "Pesticides")
            {
                Pesticide p = new Pesticide()
                {
                    id = idGlobal
                };
                db.Pesticides.Attach(p);
                db.Pesticides.Remove(p);
                db.SaveChanges();
                AllDataBases.AlldataGrid.ItemsSource = (from s in db.Pesticides select s).ToList();
                this.Close();
                return;
            }
        }
コード例 #3
0
 private void Delete_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (name == "Engrais")
     {
         engrai      p  = myDataGrid.SelectedItem as engrai;
         DeleteAlert da = new DeleteAlert(p.id, p.nom);
         da.ShowDialog();
         return;
     }
     if (name == "Irrigation")
     {
         Irrigation  p  = myDataGrid.SelectedItem as Irrigation;
         DeleteAlert da = new DeleteAlert(p.id, p.nom);
         da.ShowDialog();
         return;
     }
     if (name == "Pesticides")
     {
         Pesticide   p  = myDataGrid.SelectedItem as Pesticide;
         DeleteAlert da = new DeleteAlert(p.id, p.nom);
         da.ShowDialog();
         return;
     }
 }
コード例 #4
0
 private void Check_Unchecked(object sender, RoutedEventArgs e)
 {
     if (name == "Engrais")
     {
         engrai p = myDataGrid.SelectedItem as engrai;
         listID.Remove(p.id);
         ittirate = 0;
         return;
     }
     if (name == "Irrigation")
     {
         Irrigation p = myDataGrid.SelectedItem as Irrigation;
         listID.Remove(p.id);
         ittirate = 0;
         return;
     }
     if (name == "Pesticides")
     {
         Pesticide p = myDataGrid.SelectedItem as Pesticide;
         listID.Remove(p.id);
         ittirate = 0;
         return;
     }
 }
コード例 #5
0
 private void Check_Checked(object sender, RoutedEventArgs e)
 {
     if (name == "Engrais")
     {
         engrai p = myDataGrid.SelectedItem as engrai;
         p = p == null ? myDataGrid.SelectedItems[ittirate++] as engrai : p;
         listID.Add(p.id);
         return;
     }
     if (name == "Irrigation")
     {
         Irrigation p = myDataGrid.SelectedItem as Irrigation;
         p = p == null ? myDataGrid.SelectedItems[ittirate++] as Irrigation : p;
         listID.Add(p.id);
         return;
     }
     if (name == "Pesticides")
     {
         Pesticide p = myDataGrid.SelectedItem as Pesticide;
         p = p == null ? myDataGrid.SelectedItems[ittirate++] as Pesticide : p;
         listID.Add(p.id);
         return;
     }
 }
コード例 #6
0
 private void Edit_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (name == "Engrais")
     {
         engrai p = myDataGrid.SelectedItem as engrai;
         edite  d = new edite(p.id);
         d.Show();
         return;
     }
     if (name == "Irrigation")
     {
         Irrigation p = myDataGrid.SelectedItem as Irrigation;
         edite      d = new edite(p.id);
         d.Show();
         return;
     }
     if (name == "Pesticides")
     {
         Pesticide p = myDataGrid.SelectedItem as Pesticide;
         edite     d = new edite(p.id);
         d.Show();
         return;
     }
 }