public static async Task <bool> Logging() { var user = UserOptions.GetUser(); if (string.IsNullOrEmpty(user)) { return(false); } var model = new LoginModel { email = user, password = UserOptions.GetPassword(), }; UIFunc.ShowLoading(U.StandartLoggingText); var result = await WebServiceFunc.SubmitLogin(model); UIFunc.HideLoading(); if (!result.Item1) { return(false); } var aspxauth = result.Item4; UserOptions.SetAspxauth(aspxauth); return(true); }
//private void PropertyChangedAction(object sender, PropertyChangedEventArgs e) //{ // if (e.PropertyName == nameof()) //} async Task <bool> LoadData() { UIFunc.ShowLoading(); var task1 = WebServiceFunc.GetOrder(OrderRowId); var task2 = WebServiceFunc.GetInstitutionsForSchedule(); var task3 = WebServiceFunc.GetStates(1); await Task.WhenAll(task1, task2, task3); if (task1.Result == null || task2.Result == null || task3.Result == null) { await UIFunc.AlertError(U.StandartErrorUpdateText); return(false); } Order = task1.Result; DdlInstitutions = task2.Result.OrderBy(q => q.CompanyName).ToObservableCollection(); DdlStates = task3.Result.OrderBy(q => q.Name).ToArray(); var institutionRowIds = DdlInstitutions.Select(q => q.RowId).ToArray(); var slotTasks = institutionRowIds.Select(q => WebServiceFunc.GetBookingSlots(q)).ToArray(); await Task.WhenAll(slotTasks); if (slotTasks.Any(q => q.Result == null)) { await UIFunc.AlertError(U.StandartErrorUpdateText); return(false); } AllBookingSlots = new Dictionary <Guid, ScheduleItemSlot[]>(); for (int i = 0; i < institutionRowIds.Length; i++) { AllBookingSlots.Add(institutionRowIds[i], slotTasks[i].Result); } Model = Order.UserProfile; PatientOrderItems = Order.Pois.OrderBy(q => q.Patient?.FullPatientName).ToObservableCollection(); SetupPatientOrderItems(PatientOrderItems); PatientOrderItemsJson0 = JsonConvert.SerializeObject(PatientOrderItems); if (IsShowFromMode) { SelectedPatientOrderItem = PatientOrderItems.SingleOrDefault(q => q.RowId == InitSelectedPatientOrderItemRowId); if (SelectedPatientOrderItem == null) { IsNewRow = true; await InitNewPatient(); } PatientHeaderModels[General].IsExpanded = true; } UIFunc.HideLoading(); return(true); }
public async Task Commit() { UIFunc.ShowLoading(U.StandartUpdatingText); var result = await WebServiceFunc.UpdatePassword(Model); UIFunc.HideLoading(); if (!result.Item1) { await UIFunc.AlertError(U.GetErrorUpdateText(result.Item2)); return; } await NavFunc.RestartApp(); }
async Task <bool> LoadData() { UserProfileRowId = UserOptions.GetUserProfileRowId(); IsNewRow = (UserProfileRowId == default(Guid)); UIFunc.ShowLoading(); var newModel = new UserProfile { IsNewRow = true, Type = 1, }; if (U.IsDebug) { newModel.FirstName = "Test1"; newModel.LastName = "Test1"; newModel.AddressLine1 = "AddressLine1"; newModel.City = "City1"; newModel.ProvinceOrStateRowId = new Guid("75D55A3F-FD2E-4EBA-A597-53E5A5BE532C"); newModel.Postcode = "Postcode1"; newModel.Phone = "123-45-67"; newModel.Email = "*****@*****.**"; newModel.Password = "******"; newModel.PasswordRepeat = "123456"; } var task1 = !IsNewRow?WebServiceFunc.GetProfile(UserProfileRowId) : Task.FromResult(newModel); var task3 = WebServiceFunc.GetStates(1); await Task.WhenAll(task1, task3); if (task1.Result == null || task3.Result == null) { await UIFunc.AlertError(U.StandartErrorUpdateText); return(false); } DdlStates = task3.Result.OrderBy(q => q.Name).ToArray(); Model = task1.Result; SetupModel(Model); UIFunc.HideLoading(); return(true); }
public async Task Commit() { if (IsNewRow) { var order = new Order { IsNew = true, UserProfile = Model, Pois = new List <PatientOrderItem>(), }; UIFunc.ShowLoading(U.StandartUpdatingText); var result = await WebServiceFunc.SubmitRegister(order); UIFunc.HideLoading(); if (!result.Item1) { await UIFunc.AlertError(U.GetErrorUpdateText(result.Item2)); return; } var userProfileRowId = result.Item3.UserProfileRowId; UserOptions.SetUsernamePassword(Model.Email, Model.Password, userProfileRowId); //NavFunc.RemovePages<Views.ProfileView>(); //var viewmodel = new UserOrderListViewModel(); //await NavFunc.NavigateToAsync(viewmodel); await NavFunc.RestartApp(); } else { var userProfileRowId = await WebServiceFunc.CreateOrUpdateProfile(Model); UIFunc.HideLoading(); if (userProfileRowId == default(Guid)) { await UIFunc.AlertError(U.StandartErrorUpdateText); return; } await NavFunc.Pop(); } }
async Task Delete() { UIFunc.ShowLoading(U.StandartUpdatingText); var result = await WebServiceFunc.RemovePatientOrderItem(SelectedPatientOrderItem); UIFunc.HideLoading(); if (!result.Item1) { await UIFunc.AlertError(U.StandartErrorUpdateText); return; } IsCommit = true; await NavFunc.Pop(forceClose : true); }
async Task <Order[]> LoadOrders() { var task1 = WebServiceFunc.GetUserOrders(UserProfileRowId); await Task.WhenAll(task1); if (task1.Result == null) { await UIFunc.AlertError(U.StandartErrorUpdateText); return(null); } var items = task1.Result; SetupItems(items); return(items); }
async public static Task <bool> SendErrorServer() { var dir = GetErrorDir(); if (Directory.Exists(dir)) { var files = Directory.EnumerateFiles(dir).Where(q => !q.Contains(GetLastErrorFile())).OrderBy(q => q).ToArray(); if (files.Length > 0) { var arg = new PushErrorLogArgument { UserRowId = UserOptions.GetUserRowId(), UserName = UserOptions.GetUser(), LogFiles = new List <PushErrorLogArgumentFile>(), BusinessRowId = UserOptions.GetBusinessRowId(), }; foreach (var file in files) { var errtext = File.ReadAllText(file); arg.LogFiles.Add(new PushErrorLogArgumentFile { ErrorFile = file, ErrorText = errtext }); } UIFunc.ShowLoading("Send error log..."); var ret = await WebServiceFunc.PushErrorLog(arg); if (!string.IsNullOrEmpty(ret)) { UIFunc.HideLoading(); return(false); } foreach (var file in files) { File.Delete(file); } } } UIFunc.HideLoading(); return(true); }
public async Task Commit() { UIFunc.ShowLoading(U.StandartLoggingText); var result = await WebServiceFunc.SubmitLogin(Model); UIFunc.HideLoading(); if (!result.Item1) { var errtext = (string.IsNullOrEmpty(result.Item3) ? Globalization.T("(!)LoginError") : result.Item3); await UIFunc.AlertError(errtext); return; } var userProfileRowId = result.Item2.Value; var aspxauth = result.Item4; UserOptions.SetUsernamePassword(Model.email, Model.password, userProfileRowId); UserOptions.SetAspxauth(aspxauth); await NavFunc.RestartApp(); }
public async Task Commit() { var norder = JsonConvert.DeserializeObject <Order>(JsonConvert.SerializeObject(Order)); norder.Pois = PatientOrderItems.ToList(); UIFunc.ShowLoading(U.StandartUpdatingText); var result = await WebServiceFunc.SaveOrder(norder); UIFunc.HideLoading(); if (!result.Item1) { await UIFunc.AlertError(U.StandartErrorUpdateText); return; } var newOrder = result.Item2; IsCommit = true; await NavFunc.Pop(forceClose : true); }