Ejemplo n.º 1
0
        private async Task ExecuteOnEndMission()
        {
            if (TodayChecked | WeekChecked)
            {
                TodayChecked = (WeekChecked == true) ? true : TodayChecked;
                IsBusy       = true;
                PopUpVisible = false;
                var _restService   = new RESTService();
                var Global_mission = Missions.Where(i => i.global_mission_start.Date <= DateTime.Now.Date & i.global_mission_deadline.Date >= DateTime.Now.Date & i.missions.Exists(j => j.mission_deadline.Date == DateTime.Now.Date)).ToList();
                foreach (var global in Global_mission)
                {
                    var missions = global.missions.Where(i => i.mission_deadline.Date == DateTime.Now.Date).ToList();
                    foreach (var mission in missions)
                    {
                        var Result = await _restService.Post_mission_completed(mission._id, global._id, WeekChecked, TodayChecked);

                        if (!Result.Item1)
                        {
                            DependencyService.Get <IMessage>().ShortAlert(Result.Item2);
                            break;
                        }
                    }
                }
                IsBusy = false;
            }
            else
            {
                DependencyService.Get <IMessage>().ShortAlert("Veuillez Selectioner un type de Tournée à Terminer !");
            }
        }