public void repopulateSource(BasketMealsRecord[] items) { m_mealDict = new Dictionary <int, BasketTableItem>(); m_selectedItems = new List <NSIndexPath>(); foreach (BasketMealsRecord bmr in items) { //create new table item //BasketTableItem bti = new BasketTableItem(); // get recipe record for meal RecipeMealsRecord rmr = RecipeManager.GetRecipeMealRecord(bmr.RecipeMealsID); // record fo each meal id BasketTableItem bti; string unit = ""; m_mealDict.TryGetValue(rmr.MealID, out bti); if (bti == null) { bti = new BasketTableItem(); MealRecord mr = MealManager.GetMeal(rmr.MealID); bti.m_meal_name = mr.Name; //save units first bti.m_unit = mr.MealDesc; } bti.m_weight += rmr.Qty; bti.m_bmIDs.Add(bmr.ID); m_mealDict[rmr.MealID] = bti; } m_tableItems = new BasketTableItem[m_mealDict.Count]; m_mealDict.Values.CopyTo(m_tableItems, 0); }
public static IEnumerable <RecipeRecord> GetRecipesForMeal(MealRecord meal) { List <RecipeMealsRecord> r_m = (List <RecipeMealsRecord>)(instance.db.GetItemsWParam <RecipeMealsRecord>("RecipeMealsRecord", "MealID", meal.ID.ToString())); List <RecipeRecord> res = new List <RecipeRecord>(); foreach (RecipeMealsRecord rm in r_m) { res.Add(instance.db.GetItem <RecipeRecord>(rm.RecipeID)); } return(res); }
public MealTableSrc(RecipeMealsRecord[] items) { m_tableItems = new List <MealTableItem>(); if (items.Length != 0) { m_recipeID = items[0].RecipeID; foreach (RecipeMealsRecord rmr in items) { MealRecord meal = MealManager.GetMeal(rmr.MealID); BasketMealsRecord bmr = BasketManager.GetBasketRecipeRecord(rmr.ID); if (meal != null) { MealTableItem mti = new MealTableItem(); mti.m_meal = meal; mti.m_qty = rmr.Qty; mti.m_bInBasket = bmr == null ? false : true; mti.m_RecMealID = rmr.ID; m_tableItems.Add(mti); } } } }
public static int SaveMealRecord(MealRecord item) { return(instance.db.SaveItem <MealRecord>(item)); }
public static List <RecipeRecord> GetRecipesForMeal(MealRecord meal) { return((List <RecipeRecord>)DukappCore.DAL.DukappRepository.GetRecipesForMeal(meal)); }