示例#1
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            //[Take Row]
            MealTWCell cell = tableView.CellAt(indexPath) as MealTWCell;

            if (cell != null && cell.m_bWasChanged)
            {
                BasketMealsRecord bmr;
                if (cell.m_bChecked)
                {
                    bmr = new BasketMealsRecord();
                    bmr.RecipeMealsID = m_tableItems[indexPath.Row].m_RecMealID;
                    BasketManager.SaveBasketRecord(bmr);
                }
                else
                {
                    bmr = BasketManager.GetBasketRecipeRecord(m_tableItems[indexPath.Row].m_RecMealID);
                    if (bmr != null)
                    {
                        BasketManager.DeleteBasketRecord(bmr.ID);
                    }
                }
                cell.m_bWasChanged = false;
            }
            tableView.DeselectRow(indexPath, false);
        }
示例#2
0
 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);
             }
         }
     }
 }