Example #1
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);
        }
        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);
        }