private async Task ExecuteOnAddVisite() { if (!Contact.potential.Exists(i => i.network == Token.network) & !DataStore.GetEditContactsToUpload().ToList().Exists(i => i.Contact_Id == Contact._id)) { if (await DependencyService.Get <IDialog>().AlertAsync("", "Le Contact n'a pas de potentiel , Vouler vous le modifier ?", "Oui", "Non")) { var lazem_nelgalha_hal = new ContactPage_ViewModel(Navigation); await Navigation.PushModalAsync(new EditContact_View(Token, lazem_nelgalha_hal.Wilaya, lazem_nelgalha_hal.All_Commune, lazem_nelgalha_hal.Speciality, Contact)); } } else { await Navigation.PushModalAsync(new Visite_View(Source, Contact, IsFreeMission, Global_Id, Mission_Id), true); } }
private async Task ExecuteOnUnvailibility() { if (!Contact.potential.Exists(i => i.network == Token.network) & !DataStore.GetEditContactsToUpload().ToList().Exists(i => i.Contact_Id == Contact._id)) { if (await DependencyService.Get <IDialog>().AlertAsync("", "Le Contact n'a pas de potentiel , Vouler vous le modifier ?", "Oui", "Non")) { var lazem_nelgalha_hal = new ContactPage_ViewModel(Navigation); await Navigation.PushModalAsync(new EditContact_View(Token, lazem_nelgalha_hal.Wilaya, lazem_nelgalha_hal.All_Commune, lazem_nelgalha_hal.Speciality, Contact)); } } else { if (await DependencyService.Get <IDialog>().AlertAsync("", "Voulez Vous Ajouter le rapport ?", "Oui", "Non")) { var compareLocation = new CompareLocation(); var Result = compareLocation.CompareLocationFunction(DataStore, Contact); string json; if (IsFreeMission) { var Respone_Free = new Free_Unvailability(); Respone_Free.client = Contact._id; Respone_Free.duration = Result.Item2; if (Result.Item1) { Respone_Free.coords.Add(Result.Item3.lat); Respone_Free.coords.Add(Result.Item3.lng); } Respone_Free.unavailability_reason = "Indisponible"; Respone_Free.valid = Result.Item1; Respone_Free.visited = true; Respone_Free.visit_time = Result.Item4; json = JsonConvert.SerializeObject(Respone_Free, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } else { var Respone = new Unvailability(); if (Result.Item1) { Respone.coords.Add(Result.Item3.lat); Respone.coords.Add(Result.Item3.lng); } Respone.duration = Result.Item2; Respone.unavailability_reason = "Indisponible"; Respone.valid = Result.Item1; Respone.visited = true; Respone.visit_time = Result.Item4; json = JsonConvert.SerializeObject(Respone, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } var data = new UnvailibilityToUpload_Model { Client_name = Contact.lastname + " " + Contact.firstname, Contact_id = Contact._id, Date = DateTime.Now, Global_id = Global_Id, IsFreeMission = IsFreeMission, Json = json, Mission_id = Mission_Id }; DataStore.AddUnvailibilityToUpload(data); MessagingCenter.Send(this, "UploadContactsTableModified"); await Navigation.PopModalAsync(); } } }
public Contact_Page_View() { NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); BindingContext = new ContactPage_ViewModel(Navigation); }