예제 #1
0
        /// <summary>
        /// Regsiters the lotted lunch menu.
        /// </summary>
        /// <param name="selectedItem">Selected item.</param>
        private void regsiterLottedLunchMenu(LunchMenuPickerItem selectedItem)
        {
            var newMenuLog = new MenuLog(selectedItem.id, selectedItem.calory, selectedItem.cost);

            // Dismiss dialog on succeeding insert.
            if (LunchMenuDao.getInstance().insertMenuLog((newMenuLog)))
            {
                // TODO

                /*
                 * string successText = String.Format(Resources.GetString (Resource.String.success_add_log), name);
                 * Toast.MakeText(Activity ,successText , ToastLength.Short).Show();
                 */
            }
            else
            {
                // TODO
                // Show failure Toast and Highlight invalid field.

                /*
                 * string successText = String.Format(Resources.GetString (Resource.String.fail_add_menu), name);
                 * Toast.MakeText(Activity ,successText , ToastLength.Short).Show();
                 */
            }
            Dismiss();
        }
예제 #2
0
 /// <summary>
 /// Gets singleton instance of LunchMenuDao.
 /// </summary>
 /// <returns>Singleton instance</returns>
 public static LunchMenuDao getInstance()
 {
     lock (locker) {
         if (instance == null)
         {
             instance = new LunchMenuDao();
         }
         return(instance);
     }
 }
예제 #3
0
        private List <LunchMenuListItem> getMenuItems()
        {
            IEnumerable <LunchMenu>  menus     = LunchMenuDao.getInstance().getLunchMenus();
            List <LunchMenuListItem> menuItems = new List <LunchMenuListItem> ();

            foreach (var menu in menus)
            {
                // TODO
                // Fetch count from db
                menuItems.Add(new LunchMenuListItem(menu.id, menu.name, menu.calory, menu.cost, 0,
                                                    GetDrawable(Resource.Drawable.ic_media_route_on_0_mono_dark)));
            }
            return(menuItems);
        }
예제 #4
0
        /// <summary>
        /// Get the menu candidates.
        /// </summary>
        /// <returns>The menu items.</returns>
        private LunchMenuPickerItem[] getMenuItems()
        {
            IEnumerable <LunchMenu> menus = LunchMenuDao.getInstance().getLunchMenus();
            var menuItems = new List <LunchMenuPickerItem> ();

            foreach (var menu in menus)
            {
                // TODO
                // Fetch count from db
                // Fetch image from db
                menuItems.Add(new LunchMenuPickerItem(menu, 0,
                                                      activity.GetDrawable(Resource.Drawable.ic_media_route_on_0_mono_dark)));
            }
            return(menuItems.ToArray());
        }
예제 #5
0
        /**
         * Add new lunch menu.
         */
        private void addLunchMenu(String name, float calory, float cost)
        {
            var newMenu = new LunchMenu(name, calory, cost);

            // Dismiss dialog on succeeding insert.
            if (LunchMenuDao.getInstance().insertMenu(newMenu))
            {
                Dismiss();
                string successText = String.Format(Resources.GetString(Resource.String.success_add_menu), name);
                Toast.MakeText(Activity, successText, ToastLength.Short).Show();
            }
            else
            {
                // TODO
                // Show failure Toast and Highlight invalid field.
                string successText = String.Format(Resources.GetString(Resource.String.fail_add_menu), name);
                Toast.MakeText(Activity, successText, ToastLength.Short).Show();
            }
        }