public async void DiscardEncounter(EncounterTemplate encounterTemplate) { try { var result = await _dialogService.ConfirmAction("Are you sure ?", "Delete this Encounter"); if (result) { if (_dashboardService.CanRemoveEncounter(encounterTemplate.Id, Client.Id, encounterTemplate.EncounterTypeId)) { // validate Encounter _dashboardService.RemoveEncounter(encounterTemplate.Id); Parent.Modules = _dashboardService.LoadModules(); } else { if (Terms.PreTest == encounterTemplate.EncounterTypeId) { _dialogService.Alert("Please Delete Testing Encounters first", "Encounter"); } if (Terms.Testing == encounterTemplate.EncounterTypeId) { _dialogService.Alert("Please Delete Referral and Linkage Encounters first", "Encounter"); } } } } catch (Exception e) { MvxTrace.Error(e.Message); _dialogService.Alert(e.Message, "Delete this Encounter"); } }
protected virtual async void Save() { if (!Validate()) { return; } var ok = await OnSave(Offer); if (ok) { DialogService.Alert( Constants.DialogSaveSuccess, Constants.DialogTitleSuccess, "ОК", () => Close(this)); } else { DialogService.Alert( Constants.DialogSaveFailed, Constants.DialogTitleError, "ОК"); } }
public async Task Initialize() { try { Videos.ReplaceRange(await _videoService.GetVideoItems()); } catch (Exception ex) { await _dialogService.Alert(ex.Message); } }
private void OpenRemoteRegistery() { if (_deviceSetupService.HasPulledData()) { ShowViewModel <RemoteRegistryViewModel>(); } else { _dialogService.Alert("Please Pull Data before accessing the registry !"); } }
private async void SearchClients() { IsBusy = true; _dialogService.ShowWait("Searching,Please wait..."); var remoteData = await _clientSyncService.SearchClients(Address, Search, AppPracticeId); if (null == remoteData) { _dialogService.Alert("Could not connect to remote registry!"); } else { if (remoteData.Count > 0) { Clients = remoteData.Select(x => x.Client).ToList(); } else { Clients = new List <Client>(); _dialogService.HideWait(); _dialogService.ShowToast("No clients found!"); IsBusy = false; return; } } _dialogService.HideWait(); IsBusy = false; }
private async Task calendarDayTapped(ReportsCalendarDayViewModel tappedDay) { if (startOfSelection == null) { var date = tappedDay.DateTimeOffset; var dateRange = ReportsDateRangeParameter .WithDates(date, date) .WithSource(ReportsSource.Calendar); startOfSelection = tappedDay; highlightDateRange(dateRange); } else { var startDate = startOfSelection.DateTimeOffset; var endDate = tappedDay.DateTimeOffset; if (System.Math.Abs((endDate - startDate).Days) > 365) { await dialogService.Alert( Resources.ReportTooLongTitle, Resources.ReportTooLongDescription, Resources.Ok ); } else { var dateRange = ReportsDateRangeParameter .WithDates(startDate, endDate) .WithSource(ReportsSource.Calendar); startOfSelection = null; changeDateRange(dateRange); } } }
private async Task <Practice> GetPractice() { var practice = await _activationService.GetLocal(Address); if (null == practice) { IsBusy = false; CurrentStatus = $"connection failed !!"; CurrentStatusSummary = "Could not connect to server"; _dialogService.Alert("Could not connect to server"); return(null); } return(practice); }
public async void DoLoginCommand() { var toCheck = new List <Tuple <string, string, ValidationType> > { new Tuple <string, string, ValidationType>(Login, "Login", ValidationType.Login), new Tuple <string, string, ValidationType>(Password, "Password", ValidationType.Password) }; var validated = ValidatorHelper.Validate(toCheck, ref _errors); if (!validated) { return; } IsLoading = true; var ok = await _authService.Login(Login, Password); IsLoading = false; if (ok) { ShowViewModel <MainViewModel>(); Close(this); } else { _dialogService.Alert( Constants.OperationFailed, Constants.DialogTitleError, Constants.DialogButtonOk); Errors["Login"] = Constants.LoginOrPasswordWarning; Errors["Password"] = Constants.LoginOrPasswordWarning; } }
public async Task WithDrawComandAsync() { var result = await _dialogService.Alert("Please confirm you wish to withdraw your application?", "All related information will be removed from system", "Confirm Withdraw", "Cancel"); if (result) { var pop = await _dialogService.OpenLoadingPopup(); Dictionary <string, object> obj = await _candidateJobService.WithDrawVacancy(_vacancyID); try { if (obj["Success"].ToString() == "true") //success { CandidateMainViewModel.Current.IsJobPageRendered = false; await _dialogService.PopupMessage("WithDraw Successefully", "#52CD9F", "#FFFFFF"); WithDrawIsVisible = false; ApplyIsVisible = true; } else if (obj["Success"].ToString() == "false") { await _dialogService.PopupMessage("An error has occurred, please try again!!", "#CF6069", "#FFFFFF"); } } catch { await _dialogService.PopupMessage("An error has occurred, please try again!!", "#CF6069", "#FFFFFF"); await _dialogService.CloseLoadingPopup(pop); } await _dialogService.CloseLoadingPopup(pop); } }
private async Task submitFeedback() { var version = userAgent.ToString(); var phone = platformConstants.PhoneModel; var os = platformConstants.OperatingSystem; var messageBuilder = new StringBuilder(); messageBuilder.Append("\n\n"); // 2 leading newlines, so user user can type something above this info messageBuilder.Append($"Version: {version}\n"); if (phone != null) { messageBuilder.Append($"Phone: {phone}\n"); } messageBuilder.Append($"OS: {os}"); var mailResult = await mailService.Send( feedbackRecipient, platformConstants.FeedbackEmailSubject, messageBuilder.ToString() ); if (mailResult.Success || string.IsNullOrEmpty(mailResult.ErrorTitle)) { return; } await dialogService.Alert( mailResult.ErrorTitle, mailResult.ErrorMessage, Resources.Ok ); }
private async Task LoadUser() { User = await _userService.GetCurrentUser(); if (User == null) { var mtDispatcher = Mvx.Resolve <IMvxMainThreadDispatcher>(); mtDispatcher.RequestMainThreadAction(() => { _dialogService.Alert( Constants.DialogNoNetwork, Constants.DialogTitleError, Constants.DialogButtonOk, () => Close(this)); }); } }
public async void RemoveRelationship(RelationshipTemplate template) { try { var result = await _dialogService.ConfirmAction("Are you sure ?", "Remove Relationship"); if (result) { _dashboardService.RemoveRelationShip(template.Id); Client = _dashboardService.LoadClient(Client.Id); } } catch (Exception e) { MvxTrace.Error(e.Message); _dialogService.Alert(e.Message, "Remove Relationship"); } }
private async Task BtnBackAsync() { var result = await _dialogService.Alert("You have unsaved change", "Do you want discard your changes?", "Discard", "Cancel"); if (result) { await PopupNavigation.Instance.PopAllAsync(); } }
private void RegisterNew() { IsBusy = true; if (_deviceSetupService.HasPulledData()) { ClearCache(_settings); IsBusy = false; ShowViewModel <ClientRegistrationViewModel>(new { mode = "new" }); } else { IsBusy = false; _dialogService.Alert("Please Pull Data before proceeding !"); } //ShowViewModel<ClientRegistrationViewModel>(); }
public void Handle(ApplicationLoadedCommand command) { if (!_applicationState.IsDataLoaded) { _applicationState.IsDataLoading = true; _storageManager.LoadData(); } _uiThreadInvoker.Invoke(() => _dialogService.Alert("By running this application you agree to not use it while driving and we are not responsible for what happens to you while running this application.")); }
private async void SelectClient(Client selectedClient) { // _dialogService.Alert("Downloads are currently not enabled !"); if (null == selectedClient) { return; } IsBusy = true; _dialogService.ShowWait($"Downloading,Please wait..."); RemoteClientDTO remoteData = null; try { remoteData = await _clientSyncService.DownloadClient(Address, selectedClient.Id); } catch (Exception e) { _dialogService.Alert($"Could not download! {e.Message}"); } if (null != remoteData) { SelectedClient = remoteData.Client; var encounters = remoteData.Encounters; try { await _registryService.Download(SelectedClient, encounters); } catch (Exception e) { _dialogService.Alert($"Could not save! {e.Message}"); } } _dialogService.HideWait(); IsBusy = false; if (null != remoteData) { ShowViewModel <DashboardViewModel>(new { id = SelectedClient.Id }); } }
private async void VerifyCentral() { _dialogService.ShowWait("Verifying,Please wait..."); Central = new ServerConfig("hapi.central"); var practice = await _activationService.GetCentral(CentralAddress); _dialogService.HideWait(); if (null != practice) { //Activate Device Central = ServerConfig.CreateCentral(practice, CentralAddress); } else { _dialogService.Alert("Address could not be verified"); } CentralName = Central.Name; }
private void AttemptLogin() { if (_loginService.Login(Username, Password)) { ShowViewModel <MainViewModel>(); } else { _dialogService.Alert("We were unable to log you in!", "Login Failed", "OK"); } }
private async void DoSignupCommand() { var toCheck = new List <Tuple <string, string, ValidationType> > { new Tuple <string, string, ValidationType> (Login, "Login", ValidationType.Login), new Tuple <string, string, ValidationType> (Password, "Password", ValidationType.Password), new Tuple <string, string, ValidationType> (Name, "Name", ValidationType.Common), new Tuple <string, string, ValidationType> (Surname, "Surname", ValidationType.Common), new Tuple <string, string, ValidationType>(Phone, "Phone", ValidationType.Phone), new Tuple <string, string, ValidationType>(Email, "Email", ValidationType.Email), new Tuple <string, string, ValidationType>(VkLink, "Vk", ValidationType.Vk) }; var validated = ValidatorHelper.Validate(toCheck, ref _errors); if (!validated) { return; } IsLoading = true; var user = new UserModel { email = Email, login = Login, name = Name, surname = Surname, password = Password, phone = Phone, vkLink = VkLink }; var ok = await _userService.CreateUser(user); IsLoading = false; if (ok) { ShowViewModel <MainViewModel>(); Close(this); } else { _dialogService.Alert( Constants.OperationFailed, Constants.DialogTitleError, Constants.DialogButtonOk); } }
private async void AttemptLogin() { IsLoading = true; await Task.Delay(500); if (_loginService.Login(Username, Password)) { ShowViewModel <MainViewModel>(); } else { _dialogService.Alert("We were unable to log you in!", "Login Failed", "OK"); } IsLoading = false; }
private void AttemptLogin() { if (_loginService.Login(Username, Password)) { //_dialogService.Alert("Logged in successfully!", "Logged in!", "OK"); var presentationBundle = new MvxBundle(new Dictionary <string, string> { { "NavigationMode", "ClearStack" } }); ShowViewModel <FirstViewModel>(presentationBundle: presentationBundle); ChangePresentation(new ClearBackStackHint()); } else { _dialogService.Alert("We were unable to log you in!", "Login Failed", "OK"); } }
private void ScreenSelected(ScreenType screenType) { if (_currentRace == null) { _dialogService.Alert(DialogEvent.NoRaceInProgress); return; } switch (screenType) { case ScreenType.CurrentResult: _navigationService.Navigate <CurrentResultViewModel>(); break; case ScreenType.CurrentSkier: _navigationService.Navigate <CurrentSkierViewModel>(); break; } }
private void AttemptSignIn() { IsBusy = true; // _dialogService.ShowWait("Please wait..."); try { User = _authService.SignIn(Username, Password); _settings.AddOrUpdateValue("livehts.userid", User.Id.ToString()); _settings.AddOrUpdateValue("livehts.username", User.UserName); IsBusy = false; ShowViewModel <AppDashboardViewModel>(new { username = User.UserName }); } catch (Exception e) { IsBusy = false; _dialogService.Alert($"{e.Message}", "Sign In Failed", "OK"); } IsBusy = false; }
private async void SearchPractice() { _dialogService.ShowWait("Searching..."); var practice = await _activationService.SearchLocal(Local.Address, Code); if (null == practice) { practice = await _activationService.SearchCentral(Central.Address, Code); } _dialogService.HideWait(); if (null == practice) { _dialogService.Alert("Could not Find facility"); } else { Practice = practice; Name = practice.Name; _dialogService.ShowToast($"Facility Found {Practice}"); } }
public async Task WithDrawJob() { if (SwipedJobItem.VacancyID.HasValue) { var result = await _dialogService.Alert("Please confirm you wish to withdraw your application?", "All related information will be removed from system", "Confirm Withdraw", "Cancel"); if (result) { var pop = await _dialogService.OpenLoadingPopup(); Dictionary <string, object> obj = await _candidateJobService.WithDrawVacancy(SwipedJobItem.VacancyID); try { if (obj["Success"].ToString() == "true") //success { CandidateMainViewModel.Current.IsJobPageRendered = false; await _dialogService.PopupMessage("WithDraw Successefully", "#52CD9F", "#FFFFFF"); Vacancies.FirstOrDefault(x => x.VacancyID == SwipedJobItem.VacancyID).Status = null; } else if (obj["Success"].ToString() == "false") { await _dialogService.PopupMessage("An error has occurred, please try again!!", "#CF6069", "#FFFFFF"); } } catch { await _dialogService.PopupMessage("An error has occurred, please try again!!", "#CF6069", "#FFFFFF"); await _dialogService.CloseLoadingPopup(pop); } await _dialogService.CloseLoadingPopup(pop); } } }
private async void PushData() { IsBusy = true; CurrentStatus = $"connecting..."; var practice = await _activationService.GetLocal(Address); if (null != practice) { bool completed = true; try { var response = await _activationService.AttempCheckVersion(Address); if (string.IsNullOrWhiteSpace(response)) { _dialogService.Alert($"you are using an old version of LiveHAPI"); IsBusy = false; CurrentStatus = $"send failed! updated LiveHAPI "; return; } int.TryParse(response, out var version); if (version != _hapiVersion) { _dialogService.Alert($"you are using an old version of LiveHAPI"); IsBusy = false; CurrentStatus = $"send failed! update LiveHAPI to v{_hapiVersion}"; return; } var pracs = _practiceSetupService.GetAll(); await _activationService.AttemptEnrollPractice(Address, pracs); } catch (Exception e) { _dialogService.Alert($"connetion Error {e.Message}"); IsBusy = false; return; } var ids = _clientReaderService.LoadClientIds(); var count = ids.Count; int n = 0; var clientIdsDelete = new List <ClientToDeleteDTO>(); var encountersDelete = new List <EnconterToDeleteDTO>(); var practicses = _practiceSetupService.GetAll(); foreach (var id in ids) { var clientToDeleteDto = new ClientToDeleteDTO(); n++; var client = _clientReaderService.LoadClient(id); if (null != client) { var clientInfo = new SyncClientDTO(client); clientInfo.PracticeCode = GetCode(clientInfo.PracticeId, practicses); CurrentStatus = showPerc("Clients", n, count); var status = await _clientSyncService.AttempSendClients(Address, clientInfo); if (status) { clientToDeleteDto = new ClientToDeleteDTO(client.Id, client.PersonId); } else { completed = false; } } if (!clientToDeleteDto.NotSent) { var encounters = _clientReaderService.LoadEncounters(id); if (null != encounters && encounters.Count > 0) { var syncEncounters = SyncClientEncounterDTO.Create(encounters, client); var status = await _clientSyncService.AttempSendClientEncounters(Address, syncEncounters); if (status) { foreach (var encounter in encounters) { clientToDeleteDto.AddEnounter(new EnconterToDeleteDTO(encounter.Id, encounter.EncounterType)); } } else { completed = false; } } var shrs = _clientReaderService.LoadPSmartStores(id); if (null != shrs && shrs.Count > 0) { await _clientSyncService.SendClientShrs(Address, shrs); } clientIdsDelete.Add(clientToDeleteDto); foreach (var toDeleteDto in clientIdsDelete) { //TODO: ALLOW DELETE [] if (deleteOnPush) { _clientReaderService.Purge(toDeleteDto); } } } } // send CurrentStatus = $"done! sent {clientIdsDelete.Count} of {count} "; if (completed) { _dialogService.ShowToast("completed successfully"); } else { CurrentStatus = $"{CurrentStatus} with some Errors, Please check server logs"; _dialogService.Alert("send completed with errors"); } } else { IsBusy = false; CurrentStatus = $"connection failed !!"; _dialogService.Alert("Could not connect to server"); } IsBusy = false; }
private async void PullData() { int total = 16; int current = 0; IsBusy = true; CurrentStatus = $"connecting..."; var practice = await _activationService.GetLocal(Address); if (null != practice) { try { var devicePrefix = await _activationService.AttemptEnrollDevice(Address, RegisteredDevice); if (!string.IsNullOrEmpty(devicePrefix)) { _deviceSetupService.UpdateCode(devicePrefix); _settings.AddOrUpdateValue("livehts.devicecode", devicePrefix); } } catch (Exception e) { } current++; CurrentStatus = showPerc("Metas", current, total); var meta = await _metaSyncService.GetMetaData(Address); _syncDataService.UpdateMeta(meta); current++; CurrentStatus = showPerc("Counties", current, total); var counties = await _metaSyncService.GetCounties(Address); _syncDataService.Update(counties); current++; CurrentStatus = showPerc("Categories", current, total); var categories = await _metaSyncService.GetCategories(Address); _syncDataService.Update(categories); current++; CurrentStatus = showPerc("Items", current, total); var items = await _metaSyncService.GetItems(Address); _syncDataService.Update(items); current++; CurrentStatus = showPerc("Category Items", current, total); var catitems = await _metaSyncService.GetCatItems(Address); _syncDataService.Update(catitems); current++; CurrentStatus = showPerc("Modules", current, total); var modules = await _formsSyncService.GetModules(Address); _syncDataService.UpdateModules(modules); current++; CurrentStatus = showPerc("Forms", current, total); var forms = await _formsSyncService.GetForms(Address); _syncDataService.UpdateForms(forms); current++; CurrentStatus = showPerc("Concepts", current, total); var concepts = await _formsSyncService.GetConcepts(Address); _syncDataService.UpdateConcepts(concepts); current++; CurrentStatus = showPerc("Questions", current, total); var questions = await _formsSyncService.GetQuestions(Address); _syncDataService.UpdateQuestions(questions); current++; current++; current++; CurrentStatus = showPerc("Users", current, total); var users = await _emrService.GetUsers(Address); _deviceSetupService.SaveUsers(users); current++; CurrentStatus = showPerc("cohort lists", current, total); var cohorts = await _cohortSyncService.GetCohorts(Address); _syncDataService.Update(cohorts); CurrentStatus = "done!"; _dialogService.ShowToast("completed successfully"); } else { IsBusy = false; CurrentStatus = $"connection failed !!"; _dialogService.Alert("Could not connect to server"); } IsBusy = false; }
protected void Alert(string message, string title = "Information") { _dialogService.Alert(message, title); }
private async void SetupDevice() { Loading = true; _dialogService.ShowWait("Verifying,Please wait..."); //save device info Device.Serial = Serial; Device.Name = Name; _deviceSetupService.Register(Device); Device = _deviceSetupService.GetDefault(Device.Id); if (null != Device) { _settings.AddOrUpdateValue("device.id", JsonConvert.SerializeObject(Device)); } //get fac var practices = new List <Practice>(); try { practices = await _emrService.GetAllDefault(Url); } catch (Exception ex) { _dialogService.Alert("Server error please check with System Admin"); _dialogService.HideWait(); return; } Practices = practices; if (null != practices && practices.Any()) { foreach (var practice in practices) { //save fac _deviceSetupService.SavePractce(practice); } } else { _dialogService.Alert("Address could not be verified"); _dialogService.HideWait(); return; } //get users var users = new List <User>(); try { users = await _emrService.GetUsers(Url); } catch (Exception ex) { _dialogService.Alert("Server error please check with System Admin"); _dialogService.HideWait(); return; } _deviceSetupService.SaveUsers(users); Loading = false; _dialogService.HideWait(); if (Local.IsSetupComplete()) { _dialogService.ShowToast("Device setup successfully,Select Facility"); } else { _dialogService.Alert("Please select Facility before proceeding"); } }