public PlanList(string user)
 {
     _user = user;
     InitializeComponent();
     countServices  = new CountServices();
     BindingContext = new CountViewModel(null, user);
 }
Example #2
0
        private async void ListCount_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            CountViewModel viewModel = sender as CountViewModel;

            if (e.SelectedItem == null)
            {
                return;
            }
            var x = (CountPlan)e.SelectedItem;


            var result = await countServices.GetById(x.Id);

            if (result.Any(a => a.TotalProduct > 0))
            {
                var answer = await DisplayAlert("TSHIRT", x.Name + " ya tiene SubConteos, Desea Continuar un nuevo SubConteo?", "SI", "NO");

                if (answer)
                {
                    Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new Plan(x.Id));
                }
            }
            else
            {
                Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new Plan(x.Id));
            }
        }
Example #3
0
        public count ToEntity(CountViewModel countViewModel)
        {
            var countViewModels = new List <CountViewModel>()
            {
                countViewModel
            };

            var result = ToEntities(countViewModels).SingleOrDefault();

            return(result);
        }
        private async void ListCount_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            CountViewModel viewModel = sender as CountViewModel;

            if (e.SelectedItem == null)
            {
                return;
            }
            var x = (CountPlan)e.SelectedItem;


            await Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new Plan(x.Id, _user));
        }
Example #5
0
        public ActionResult Index()
        {
            var vm = new CountViewModel()
            {
                Meals          = _countService.GetCountMeals().TotalCount,
                Ingredients    = _countService.GetCountIngredients().TotalCount,
                NutritionFacts = _countService.GetCountNutritionFacts().TotalCount,
                Users          = _countService.GetCountUsers().TotalCount,

                MealBreakfast = _countService.GetCountMealType(MealType.Breakfast).TotalCount,
                MealLunch     = _countService.GetCountMealType(MealType.Lunch).TotalCount,
                MealDinner    = _countService.GetCountMealType(MealType.Dinner).TotalCount,
                MealSnack     = _countService.GetCountMealType(MealType.Snack).TotalCount,
                MealOther     = _countService.GetCountMealType(MealType.Other).TotalCount,

                IngredientMeat      = _countService.GetCountIngredientType(IngredientType.Meat).TotalCount,
                IngredientVegetable = _countService.GetCountIngredientType(IngredientType.Vegetable).TotalCount,
                IngredientFruit     = _countService.GetCountIngredientType(IngredientType.Fruit).TotalCount,
                IngredientDrink     = _countService.GetCountIngredientType(IngredientType.Drink).TotalCount,
                IngredientOther     = _countService.GetCountIngredientType(IngredientType.Other).TotalCount,

                MealToday     = _countService.GetCountMeals(Clock.Now.Date).TotalCount,
                MealYesterday = _countService.GetCountMeals(Clock.Now.Date.AddDays(-1)).TotalCount,
                MealLastWeek  = _countService.GetCountMeals(Clock.Now.Date.AddDays(-7)).TotalCount,
                MealLastMonth = _countService.GetCountMeals(Clock.Now.Date.AddMonths(-1)).TotalCount,

                TotalCalories = _countService.GetCountNutritionFactType(Nutrient.Calories).TotalCount,
                TotalCarbs    = _countService.GetCountNutritionFactType(Nutrient.Carbohydrates).TotalCount,
                TotalFat      = _countService.GetCountNutritionFactType(Nutrient.Fat).TotalCount,
                TotalProtein  = _countService.GetCountNutritionFactType(Nutrient.Protein).TotalCount,

                MostUsedIngredients = _countService.GetMostUsedIngredients(6).Items
            };

            vm.MealYesterday -= vm.MealToday; // fixed bug

            // get percentages
            vm.MealBreakfast = (int)(vm.MealBreakfast * 100f / vm.Meals);
            vm.MealLunch     = (int)(vm.MealLunch * 100f / vm.Meals);
            vm.MealDinner    = (int)(vm.MealDinner * 100f / vm.Meals);
            vm.MealSnack     = (int)(vm.MealSnack * 100f / vm.Meals);
            vm.MealOther     = (int)(vm.MealOther * 100f / vm.Meals);

            return(View(vm));
        }
Example #6
0
 public Plan(int id)
 {
     InitializeComponent();
     BindingContext = new CountViewModel(id);
 }
Example #7
0
 public PlantList()
 {
     InitializeComponent();
     countServices  = new CountServices();
     BindingContext = new CountViewModel(null);
 }
 public MediaTestView(CountViewModel model) : base(model)
 {
     InitializeComponent();
     model.ViewCommand = new Command(ForcePause);
 }
Example #9
0
 public SizeAllocatedView(CountViewModel viewModel)
 {
     Visual         = VisualMarker.MatchParent;
     BindingContext = viewModel;
 }
Example #10
0
 public SizeAllocatedView()
 {
     Visual         = VisualMarker.MatchParent;
     BindingContext = new CountViewModel();
 }
 private void GetPlan()
 {
     BindingContext = new CountViewModel(_id);
 }
 public WebTestView(CountViewModel model) : base(model)
 {
     InitializeComponent();
 }
 void GetPlan()
 {
     BindingContext = new CountViewModel(_id, _user);
 }