コード例 #1
0
 // Ajouter, lire, modifier, supprimer
 public void Ajouter(Exploitant e)
 {
     liste.Add(e);
 }
コード例 #2
0
        public void InitializeDummyData()
        {
            const int nbExploitants = 3; //30
            const int nbParcelles = 5; //20
            const int nbTraitements = 2; //50
            const int nbPulverisations = 2;

            int cptExploitants = 0, cptParcelles = 0, cptTraitements = 0, cptPulverisations = 0;
            // Remplissage avec des valeurs quelconques
            for (int i = 1; i <= nbExploitants; i++)
            {
                cptExploitants++;
                Exploitant e = new Exploitant(cptExploitants, "Dupont_" + cptExploitants);
                e.Telephone = "046700000" + cptExploitants;
                e.Mail = "Dupont_" + cptExploitants + "@foo.bar";

                for (int j = 1; j <= nbParcelles; j++)
                {
                    cptParcelles++;
                    Parcelle p = new Parcelle(cptParcelles, j*10, e);
                    p.Description = "PAR Desc" + j + "_" + i;
                    p.Emplacement = "PAR Emp" + j + "_" + i;
                    for (int k = 1; k <= nbTraitements; k++)
                    {
                        cptTraitements++;
                        TraitementEnChamp t = new TraitementEnChamp(cptTraitements);
                        t.Description = "TRAIT Desc" + j + "_" + i + "_" + k;
                        t.Parcelle = p;

                        for (int l = 1; l <= nbPulverisations; l++)
                        {
                            cptPulverisations++;
                            Pulverisation pl = new Pulverisation(cptPulverisations);
                            pl.Dosage = i * 14;
                            pl.Description = "PUL Desc" + j + "_" + i + "_" + k;
                            pl.Traitement = t;

                            t.AjouterPulverisation(pl);
                        }
                        p.AjouterTraitement(t);
                    }
                    cptTraitements++;
                    TraitementSemence ts = new TraitementSemence(cptTraitements);
                    ts.Description = "TRAIT Desc" + j + "_" + i + "_" + (nbPulverisations+1);
                    ts.Dosage = 10;
                    ts.Parcelle = p;
                    p.AjouterTraitement(ts);

                    e.AjouterParcelle(p);
                }
                liste.Add(e);
            }
        }