//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);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        async public Task <Boolean> Run(string businessCode, string username, string password)
        {
            //var rezz = await WebServiceFunc.Login(businessCode, username, password);

            UIFunc.ShowLoading("Authorization...");
            var url0 = "Authenticate?businessCode=" + Uri.EscapeDataString(businessCode)
                       + "&username="******"&password="******"Error in authorization procedure");

                return(false);
            }

            var result = WebServiceFunc.DeserializeObjectFromStream <AuthenticateReturn>(rez.Value);

            if (!String.IsNullOrEmpty(result.Error))
            {
                UIFunc.HideLoading();
                await UIFunc.AlertError(result.Error);

                return(false);
            }

            var optrow = UserOptions.GetCurrent();

            optrow.Username      = username;
            optrow.Password      = password;
            optrow.UserRowId     = result.UserRowId;
            optrow.BusinessRowId = result.BusinessRowId;
            optrow.BusinessCode  = result.BusinessCode;
            DB.Update(optrow);

            UIFunc.HideLoading();
            return(true);
        }
Ejemplo n.º 8
0
        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);
        }