public void AddReportToUpload(ReportToUpload_Model data) { if (_connection != null) { _connection.Insert(data); } }
private async Task ExecuteOnAddVisite() { if (!Focus) { List <KeyValuePair <string, string> > Result = new List <KeyValuePair <string, string> >(); if (IsFreeMission) { Result = SerializeFreeMissionVisiteJson(); } else { Result = SerializeVisiteJson(); } if (Result != null) { if (await DependencyService.Get <IDialog>().AlertAsync("", "Voulez Vous Ajouter le Rapport ?", "Oui", "Non")) { IsBusy = true; string questionnaireJson = SerializeQuestionnaire(); if (questionnaireJson != null) { var questionnaire = new QuastionnairesToUpload_Model { Date = DateTime.Now, Json = questionnaireJson, Name = Contact.Name, }; DataStore.AddQuastionnairesToUpload(questionnaire); } var report = new ReportToUpload_Model { Client_name = Contact.Name, Date = DateTime.Now, report = Result, Contact_id = Contact._id, Global_id = Global_Id, IsFreeMission = IsFreeMission, Mission_id = Mission_Id, }; DataStore.AddReportToUpload(report); MessagingCenter.Send(this, "UploadContactsTableModified"); await Navigation.PopModalAsync(); IsBusy = false; } } } else { if (FocusContacts != null & FocusContacts.Count > 0) { if (await DependencyService.Get <IDialog>().AlertAsync("", "Voulez Vous Ajouter le Rapport Focus ?", "Oui", "Non")) { IsBusy = true; foreach (var contact in FocusContacts) { List <KeyValuePair <string, string> > Result = new List <KeyValuePair <string, string> >(); Result = SerializeFreeMissionVisiteJson(); if (Result != null) { var report = new ReportToUpload_Model { Client_name = contact.Name, Date = DateTime.Now, report = Result, Contact_id = contact._id, Global_id = Global_Id, IsFreeMission = true, Mission_id = Mission_Id, }; DataStore.AddReportToUpload(report); MessagingCenter.Send(this, "UploadContactsTableModified"); } } await Navigation.PopModalAsync(); MessagingCenter.Send(this, "PopModalAsync"); IsBusy = false; } } } }