1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| public Dictionary<Ingredient, int> remplirListView2(Cocktail obj)
{
int p = 0;
obj = this.C;
cockDAO = new CocktailDAO();
dIng = cockDAO.chargerRecetteCock(C);
comparaison(dIng);
foreach (KeyValuePair<Ingredient, int> k in dIng)
{
ingDAO = new IngredientDAO();
I = ingDAO.trouver(Convert.ToInt16(k.Key.getId()));
lv2.Items.Add(I.getNom());
lv2.Items[p].SubItems.Add(k.Value.ToString());
lv2.Items[p].Tag = Convert.ToInt16(k.Key.getId());
p++;
}
return dIng;
}
public void comparaison(Dictionary<Ingredient, int> dic)
{
int p = 0;
mesIng = ingDAO.charger();
foreach (KeyValuePair<Ingredient, int> d in dic)
{
foreach (Ingredient I in mesIng)
{
if (d.Key.getId() == I.getId())
{
lv1.Items.RemoveAt(p);
lv1.Items.Add(I.getNom());
//lv1.Items[p].Tag = I.getId();
}
p++;
}
}
} |
Partager