Exemplo n.º 1
0
        private async Task ExecuteOnAbscence()
        {
            if (Selected_Item != null)
            {
                PopUpVisible = false;
                IsBusy       = true;
                if (Selected_Item == "Focus")
                {
                    var lazem_nelgalha_hal = new ContactPage_ViewModel(Navigation);
                    await Navigation.PushAsync(new Focus_View(Token, lazem_nelgalha_hal.Wilaya, lazem_nelgalha_hal.All_Commune, lazem_nelgalha_hal.Speciality), true);

                    IsBusy = false;
                }
                else
                {
                    var _restService = new RESTService();
                    var abscence     = new Absence_mission();
                    abscence.absence = Selected_Item;
                    var json = JsonConvert.SerializeObject(abscence, Formatting.None,
                                                           new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                    var Result = await _restService.Post_absence(json, IsFreeMission, null, null, null);

                    if (Result.Item1)
                    {
                        DependencyService.Get <IMessage>().ShortAlert("Absence Syncroniser Avec Succes !");
                    }
                    else
                    {
                        DependencyService.Get <IMessage>().ShortAlert(Result.Item2);
                    }
                    IsBusy = false;
                }
            }
            else
            {
                DependencyService.Get <IMessage>().ShortAlert("Veuillez Selectionner un Motif !");
            }
        }