示例#1
0
        private async void Button_Clicked_1(object sender, System.EventArgs e)
        {
            await PopupNavigation.PopAllAsync();

            await fullPhotoTruckVM.Navigation.PushAsync(new ScanCamera(fullPhotoTruckVM, "truck"));
        }
 private async void ClosePopup()
 {
     await PopupNavigation.PopAllAsync();
 }
示例#3
0
 private async void Close(object s, EventArgs e)
 {
     await PopupNavigation.PopAllAsync();
 }
示例#4
0
        public async void EmailVerified()
        {
            await PopupNavigation.PushAsync(new LoadingPopupPage());

            UserRestClient       userRC    = new UserRestClient();
            RestClient <Address> addressRC = new RestClient <Address>();
            Address address = new Address()
            {
                ID      = Int32.Parse(Address.ClassId),
                Number  = Int32.Parse(Number.Text),
                Street  = Street.Text,
                City    = City.Text,
                State   = State.Text,
                Country = Country.Text,
                ZipCode = Int32.Parse(ZipCode.Text)
            };

            if (!(await addressRC.PutAsync(address.ID, address)))
            {
                return;
            }

            User user = new User()
            {
                ID         = this.user.ID,
                Name       = Name.Text.ToLower(),
                LastName   = LastName.Text.ToLower(),
                Email      = Email.Text.ToLower(),
                Password   = Password.Text,
                Address_FK = address.ID
            };

            if (!(await userRC.PutAsync(user.ID, user)))
            {
                return;
            }
            RestClient <PhoneNumber> phoneNumberRestClient = new RestClient <PhoneNumber>();

            foreach (var removedPhoneNumber in removedPhoneNumbers)
            {
                if (!(await phoneNumberRestClient.DeleteAsync(removedPhoneNumber.ID)))
                {
                    return;
                }
            }
            foreach (var phoneNumberStackLayout in PhoneNumberStackLayouts)
            {
                Entry phoneNumberEntry = (phoneNumberStackLayout.Children[0] as Entry);
                if (phoneNumberEntry.Text != "")
                {
                    PhoneNumber p = new PhoneNumber()
                    {
                        Number             = phoneNumberEntry.Text,
                        PhoneNumberType_FK = (phoneNumberTypes.ElementAt((phoneNumberStackLayout.Children[1] as Picker).SelectedIndex)).ID,
                    };
                    if (phoneNumberEntry.ClassId != "")
                    {
                        int phoneNumberID = Int32.Parse(phoneNumberEntry.ClassId);
                        p.ID = phoneNumberID;
                        if (!(await phoneNumberRestClient.PutAsync(p.ID, p)))
                        {
                            return;
                        }
                    }
                    else
                    {
                        p.User = user;
                        if (await phoneNumberRestClient.PostAsync(p) == null)
                        {
                            return;
                        }
                    }
                }
            }
            await DisplayAlert("Succées", "Votre profil à été mis à jour!", "Ok");

            await PopupNavigation.PopAllAsync();

            await Navigation.PopAsync();
        }
示例#5
0
 public async void Close()
 {
     await PopupNavigation.PopAllAsync();
 }
示例#6
0
 private async Task EventBack()
 {
     await PopupNavigation.PopAllAsync();
 }
        void SetTotalDiscount()
        {
            DiscountModel currentDiscount = new DiscountModel();

            if (TotalDiscount1)
            {
                currentDiscount = new DiscountModel {
                    DiscountName = Discounts[0].DiscountName, Amount = Discounts[0].Amount, IsPercentage = Discounts[0].IsPercentage
                }
            }
            ;
            else if (TotalDiscount2)
            {
                currentDiscount = new DiscountModel {
                    DiscountName = Discounts[1].DiscountName, Amount = Discounts[1].Amount, IsPercentage = Discounts[1].IsPercentage
                }
            }
            ;
            else if (TotalDiscount3)
            {
                currentDiscount = new DiscountModel {
                    DiscountName = Discounts[2].DiscountName, Amount = Discounts[2].Amount, IsPercentage = Discounts[2].IsPercentage
                }
            }
            ;
            else if (TotalDiscount4)
            {
                currentDiscount = new DiscountModel {
                    DiscountName = Discounts[3].DiscountName, Amount = Discounts[3].Amount, IsPercentage = Discounts[3].IsPercentage
                }
            }
            ;
            CurrentTotalDiscount = currentDiscount;
        }

        void OpenOption(ItemModel item)
        {
            CurrentItem   = item;
            CurrentOption = new List <string>();
            OptionList    = new List <ItemOptionModel>();

            if (!string.IsNullOrEmpty(item.Option1))
            {
                OptionList.Add(new ItemOptionModel()
                {
                    OptionName = item.Option1, Price = item.Option1Price
                });
            }

            if (!string.IsNullOrEmpty(item.Option2))
            {
                OptionList.Add(new ItemOptionModel()
                {
                    OptionName = item.Option2, Price = item.Option2Price
                });
            }

            if (!string.IsNullOrEmpty(item.Option3))
            {
                OptionList.Add(new ItemOptionModel()
                {
                    OptionName = item.Option3, Price = item.Option3Price
                });
            }

            if (!string.IsNullOrEmpty(item.Option4))
            {
                OptionList.Add(new ItemOptionModel()
                {
                    OptionName = item.Option4, Price = item.Option4Price
                });
            }

            foreach (var option in OptionList)
            {
                CurrentOption.Add(option.OptionName + "  ( +" + option.Price.ToString("#,0.00") + " )");
            }

            CurrentItemPrice = item.Price;

            if (item.Option2 == null && item.Option3 == null && item.Option4 == null)
            {
                if (!string.IsNullOrEmpty(item.Option1))
                {
                    OptionList.Add(new ItemOptionModel()
                    {
                        OptionName = item.Option1, Price = item.Option1Price
                    });
                }
                CurrentSelectedOptionIndex = 0;
                CurrentItemPrice           = item.Price;
                SaveItemToTicket();
            }
            else
            {
                PopupNavigation.PushAsync(new ItemPopup(this));
            }
        }

        void SetItemMenu()
        {
            if (App.ListCategoryModels == null)
            {
                var getCate = _service.GetAllCategories();

                if (!getCate.Result.IsError)
                {
                    CategoriesList         = getCate.Result.Categories;
                    App.ListCategoryModels = CategoriesList;
                }
            }
            else
            {
                CategoriesList = App.ListCategoryModels;
            }
            if (CategoriesList == null)
            {
                CategoriesList = new List <CategoryModel>();

                foreach (var category in CategoriesList)
                {
                    AllMenu.Add(new MenuModel()
                    {
                        CategoryName = category.Name,
                        Items        = new ObservableCollection <ItemModel>()
                    });
                }
            }
            ItemsViewModel items;

            if (App.ItemsManuViewModel == null || App.ItemsManuViewModel.Items.Count == 0)
            {
                items = _service.GetItems();
                App.ItemsManuViewModel = items;
            }
            else
            {
                items = App.ItemsManuViewModel;
            }
            if (items.Items == null || items.Items.Count == 0)
            {
                //Application.Current.MainPage.DisplayAlert("", "ไม่พบรายการอาหารในระบบ", "OK");
                //PopupNavigation.PushAsync(new Error(new ErrorViewModel("ไม่พบรายการอาหารในระบบ")));
                return;
            }

            foreach (var item in items.Items)
            {
                var isCatExist = AllMenu.Where(a => a.CategoryName == item.CategoryName).FirstOrDefault();
                if (isCatExist == null)
                {
                    AllMenu.Add(new MenuModel()
                    {
                        CategoryName = item.CategoryName,
                        Items        = new ObservableCollection <ItemModel>()
                    });;
                }
                if (item.Color == null)
                {
                    item.Color = "DDDDDD";
                }
                AllMenu.Where(a => a.CategoryName == item.CategoryName).FirstOrDefault().Items.Add(item);
            }
        }

        void SaveTicket()
        {
            var maxNumber = 0;

            try
            {
                maxNumber = App.TicketList.Max(t => t.TicketNumber);
            }
            catch (Exception e)
            {
            }
            ReceiptViewModel receipt = new ReceiptViewModel()
            {
                ItemList       = CurrentTicket.ToList(),
                Total          = TotalPrice,
                TicketNumber   = maxNumber + 1,
                CreateDateTime = DateTime.Now,
            };

            App.TicketList.Add(receipt);
            ClearTicket();
        }

        void OpenTicketList()
        {
            ClearTicket();
            PopupNavigation.PushAsync(new OpenTicketsPopup(this));
            TicketList = App.TicketList;
        }

        void ClearTicket()
        {
            CurrentTicket         = new ObservableCollection <OrderItemModel>();
            Quantity              = 1;
            QuantityChangeCommand = new Command <string>((change) => QuantityChange(change));
            SaveItemCommand       = new Command(SaveItemToTicket);
            CurrentTicket         = new ObservableCollection <OrderItemModel>();
            CurrentTotalDiscount  = new DiscountModel();
            CurrentDiscountAmount = 0;
            TotalPrice            = 0;
            ShowOpenButton        = true;
        }

        void OpenTicket(int ticketNumber)
        {
            var ticket = App.TicketList.Where(t => t.TicketNumber == ticketNumber).FirstOrDefault();

            if (ticket.ItemList == null || ticket.ItemList.Count == 0)
            {
                return;
            }
            foreach (var item in ticket.ItemList)
            {
                CurrentTicket.Add(item);
                TotalPrice += item.DiscountedPrice;
            }
            App.TicketList.Remove(ticket);
            PopupNavigation.PopAllAsync();
        }

        void Charge()
        {
            if (CurrentTicket == null || CurrentTicket.Count == 0)
            {
                PopupNavigation.PushAsync(new Error(new ErrorViewModel("Please add item to ticket before proceeding")));
                return;
            }
            decimal totalDiscount = 0;

            foreach (var item in CurrentTicket)
            {
                totalDiscount += item.ItemDiscount;
            }
            ReceiptViewModel receipt = new ReceiptViewModel()
            {
                ItemList       = CurrentTicket.ToList(),
                Total          = TotalPrice,
                CreateDateTime = DateTime.Now,
                TotalDiscount  = totalDiscount + CurrentDiscountAmount,
                Discount       = CurrentDiscountAmount,
            };

            Application.Current.MainPage.Navigation.PushAsync(new ChargePage(receipt));
        }

        void GetDiscount()
        {
            var discountVM = _service.GetDiscounts();

            Discounts = discountVM.Discounts;
            if (Discounts.Count > 0)
            {
                DiscountName1 = Discounts[0].DiscountName;
                HasDiscount1  = true;
                Discount1     = false;
            }

            if (Discounts.Count > 1)
            {
                DiscountName2 = Discounts[1].DiscountName;
                HasDiscount2  = true;
                Discount2     = false;
            }

            if (Discounts.Count > 2)
            {
                DiscountName3 = Discounts[2].DiscountName;
                HasDiscount3  = true;
                Discount3     = false;
            }

            if (Discounts.Count > 3)
            {
                DiscountName4 = Discounts[3].DiscountName;
                HasDiscount4  = true;
                Discount4     = false;
            }
        }

        void DeleteItem(OrderItemModel model)
        {
            CurrentTicket.Remove(model);
            CalculateTotalAmount();
        }

        void CloudsyncClick()
        {
            IsLoadding = true;
            var getCate = _service.GetAllCategories();

            if (!getCate.Result.IsError)
            {
                CategoriesList         = getCate.Result.Categories;
                App.ListCategoryModels = CategoriesList;
            }


            var items = _service.GetItems();


            if (items.Items == null || items.Items.Count == 0)
            {
                //Application.Current.MainPage.DisplayAlert("", "ไม่พบรายการอาหารในระบบ", "OK");
                //PopupNavigation.PushAsync(new Error(new ErrorViewModel("ไม่พบรายการอาหารในระบบ")));
                return;
            }
            App.ItemsManuViewModel       = items;
            Application.Current.MainPage = new NavigationPage(new Views.SaleView());
        }
示例#8
0
 private void Setting_Tapped(object sender, EventArgs e)
 {
     Navigation.PushAsync(new SettingPage());
     PopupNavigation.PopAllAsync();
 }
示例#9
0
 private void LockButton_Clicked(object sender, EventArgs e)
 {
     Application.Current.MainPage = new NavigationPage(new EnterPin());
     PopupNavigation.PopAllAsync();
 }
示例#10
0
 private void Shift_Tapped(object sender, EventArgs e)
 {
     Navigation.PushAsync(new ShiftPage(new ViewModels.ShiftPageViewModel()));
     PopupNavigation.PopAllAsync();
 }
示例#11
0
 private void Item_Tapped(object sender, EventArgs e)
 {
     Navigation.PushAsync(new ItemPage());
     PopupNavigation.PopAllAsync();
 }
示例#12
0
 private void Receipt_Tapped(object sender, EventArgs e)
 {
     Navigation.PushAsync(new ReceiptsPage());
     PopupNavigation.PopAllAsync();
 }
示例#13
0
 private void Sale_Tapped(object sender, EventArgs e)
 {
     Navigation.PushAsync(new SaleView());
     PopupNavigation.PopAllAsync();
 }
示例#14
0
 public async void VoltarPagina()
 {
     PopupNavigation.PopAllAsync(true);
     App.Current.MainPage = new MainTabbed(2);
 }
 private async void ExitImageTapped(object sender, EventArgs e)
 {
     await PopupNavigation.PopAllAsync();
 }
示例#16
0
 public void PopPopuopToRoot()
 {
     PopupNavigation.PopAllAsync();
 }
示例#17
0
 private Task ClosePopupAsync()
 {
     return(PopupNavigation.PopAllAsync());
 }
示例#18
0
        async void save_ClickedAsync(object sender, System.EventArgs e)
        {
            DateTime startdateTime;
            DateTime stopdateTime;

            // DisplayAlert("Alert", start_datepicker.Date.ToString(), "Ok");

            String startdatestring = String.Format("{0:MM-dd-yyyy HH:mm:ss}", start_datepicker.Date);

            startdateTime = DateTime.ParseExact(startdatestring, "MM-dd-yyyy HH:mm:ss", CultureInfo.InvariantCulture);


            string start_datestring = startdateTime.ToString("yyyy-MM-dd");


            String stopdatestring = String.Format("{0:MM-dd-yyyy HH:mm:ss}", end_datepicker.Date);

            stopdateTime = DateTime.ParseExact(stopdatestring, "MM-dd-yyyy HH:mm:ss", CultureInfo.InvariantCulture);

            string end_datestring = stopdateTime.ToString("yyyy-MM-dd");


            string combinestring = start_datestring + " " + end_datestring;

            DateTime startDate = DateTime.ParseExact(start_datestring, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            DateTime endDate   = DateTime.ParseExact(end_datestring, "yyyy-MM-dd", CultureInfo.InvariantCulture);

            //if (endDate.Date <= startDate.Date)
            //{
            //    date_alert.IsVisible = true;
            //    date_box.IsVisible = true;
            //    // DisplayAlert("Alert", "Please fill meeting subject", "Ok");
            //    mainlayout.HeightRequest = 380;
            //}

            if (App.filterstring != "Days" && App.filterstring != "Month")
            {
                App.filterdict["range"] = combinestring;
                App.filterdict["days"]  = "False";
                App.filterdict["month"] = "False";

                if (endDate.Date <= startDate.Date)
                {
                    date_alert.IsVisible = true;
                    date_box.IsVisible   = true;
                    // DisplayAlert("Alert", "Please fill meeting subject", "Ok");
                    mainlayout.HeightRequest = 380;
                    //  await Navigation.PopAsync();
                }
                else
                {
                    var currentpage = new LoadingAlert();
                    await PopupNavigation.PushAsync(currentpage);

                    List <CRMLead> crmLeadData = Controller.InstanceCreation().crmFilterData();

                    App.Current.MainPage = new MasterPage(new CrmTabbedPage(tab_string));

                    await Navigation.PopAllPopupAsync();
                }
            }

            else
            {
                if (App.filterstring == "Days")
                {
                    App.filterdict["range"] = "False";
                    App.filterdict["days"]  = "True";
                    App.filterdict["month"] = "False";
                }

                else
                {
                    App.filterdict["range"] = "False";
                    App.filterdict["days"]  = "False";
                    App.filterdict["month"] = "True";
                }

                var currentpage = new LoadingAlert();
                await PopupNavigation.PushAsync(currentpage);

                List <CRMLead> crmLeadData = Controller.InstanceCreation().crmFilterData();

                App.Current.MainPage = new MasterPage(new CrmTabbedPage(tab_string));


                //await Navigation.PopAllPopupAsync();

                Loadingalertcall();
            }
            //  MessagingCenter.Send<Dictionary<string,dynamic>, string>(vals, "NotifyMsg", "test");

            async void Loadingalertcall()
            {
                await PopupNavigation.PopAllAsync();
            }
        }
        public void SaveItemToTicket()
        {
            ShowOpenButton = false;
            try
            {
                decimal       optionPrice     = OptionList[CurrentSelectedOptionIndex].Price;
                bool          isDiscount      = true;
                DiscountModel currentDiscount = new DiscountModel();
                if (Discount1)
                {
                    currentDiscount = new DiscountModel {
                        DiscountName = Discounts[0].DiscountName, Amount = Discounts[0].Amount, IsPercentage = Discounts[0].IsPercentage
                    }
                }
                ;
                else if (Discount2)
                {
                    currentDiscount = new DiscountModel {
                        DiscountName = Discounts[1].DiscountName, Amount = Discounts[1].Amount, IsPercentage = Discounts[1].IsPercentage
                    }
                }
                ;
                else if (Discount3)
                {
                    currentDiscount = new DiscountModel {
                        DiscountName = Discounts[2].DiscountName, Amount = Discounts[2].Amount, IsPercentage = Discounts[2].IsPercentage
                    }
                }
                ;
                else if (Discount4)
                {
                    currentDiscount = new DiscountModel {
                        DiscountName = Discounts[3].DiscountName, Amount = Discounts[3].Amount, IsPercentage = Discounts[3].IsPercentage
                    }
                }
                ;
                else
                {
                    isDiscount = false;
                }
                decimal discountedAmount = (currentDiscount.IsPercentage) ?
                                           (currentDiscount.Amount / 100 * (CurrentItem.Price + optionPrice) * Quantity)
                    : ((currentDiscount.Amount < (CurrentItem.Price + optionPrice) * Quantity) ? currentDiscount.Amount : (CurrentItem.Price + optionPrice) * Quantity);

                CurrentTicket.Add(new OrderItemModel
                {
                    ItemName             = CurrentItem.Name,
                    IsDiscounted         = isDiscount,
                    ItemPrice            = (CurrentItem.Price + optionPrice) * Quantity,
                    Quantity             = Quantity,
                    OptionName           = OptionList[CurrentSelectedOptionIndex].OptionName,
                    OptionPrice          = OptionList[CurrentSelectedOptionIndex].Price,
                    DiscountName         = CurrentTotalDiscount.DiscountName,
                    DiscountedPrice      = (CurrentItem.Price + optionPrice) * Quantity - discountedAmount,
                    IsDiscountPercentage = currentDiscount.IsPercentage,
                    ItemDiscount         = currentDiscount.Amount
                });

                CalculateTotalAmount();

                Discount1 = false;
                Discount2 = false;
                Discount3 = false;
                Discount4 = false;
            }
            catch (Exception e)
            {
                Application.Current.MainPage.DisplayAlert("Error", "Cannot add item to ticket", "Ok");
            }

            CurrentTicket = CurrentTicket;
            if (PopupNavigation.Instance.PopupStack.Any())
            {
                PopupNavigation.PopAllAsync();
            }
            CurrentItem   = new ItemModel();
            CurrentOption = new List <string>();
            CurrentSelectedOptionIndex = 0;
            Quantity = 1;
        }
示例#20
0
 private async void Cancel()
 {
     await PopupNavigation.PopAllAsync();
 }
示例#21
0
 public async Task PopAll()
 {
     await PopupNavigation.PopAllAsync();
 }
示例#22
0
        private async void Entry_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (CrossSettings.Current.GetValueOrDefault("Password", "") == e.NewTextValue)
            {
                if (!payBlockSelectPatment.IsVisible)
                {
                    if (Paymmant != null)
                    {
                        isAsk2 = Paymmant.IsAskPaymmant;
                    }
                    if (isSignatureAsk && isAsk2)
                    {
                        liabilityAndInsuranceMV.SaveSigAndMethodPay();
                        if (liabilityAndInsuranceMV.What_form_of_payment_are_you_using_to_pay_for_transportation == "COD" || liabilityAndInsuranceMV.What_form_of_payment_are_you_using_to_pay_for_transportation == "COP" || liabilityAndInsuranceMV.What_form_of_payment_are_you_using_to_pay_for_transportation == "Biling")
                        {
                            liabilityAndInsuranceMV.GoToContinue();
                            //await PopupNavigation.PopAllAsync(true);
                        }
                        else
                        {
                            await PopupNavigation.PopAllAsync(true);

                            await PopupNavigation.PushAsync(new TempPageHint4());

                            if (liabilityAndInsuranceMV.What_form_of_payment_are_you_using_to_pay_for_transportation == "Cash")
                            {
                                await Navigation.PushAsync(new VideoCameraPage(liabilityAndInsuranceMV, ""));
                            }
                            else if (liabilityAndInsuranceMV.What_form_of_payment_are_you_using_to_pay_for_transportation == "Check")
                            {
                                await Navigation.PushAsync(new CameraPaymmant(liabilityAndInsuranceMV, "", "CheckPaymment.png"));
                            }
                            else
                            {
                                await Navigation.PushAsync(new Ask2Page(liabilityAndInsuranceMV.managerDispatchMob, liabilityAndInsuranceMV.IdVech, liabilityAndInsuranceMV.IdShip, liabilityAndInsuranceMV.initDasbordDelegate));
                            }
                        }
                    }
                    else
                    {
                        ((Entry)sender).Text  = "";
                        blockAskPay.IsVisible = false;
                        await PopupNavigation.PushAsync(new Errror("You did not fill in all the required fields, you can continue the inspection only when filling in the required fields !!", null));

                        CheckAsk();
                    }
                }
                else
                {
                    ((Entry)sender).TextColor = Color.Default;
                    //btnConntinue.IsVisible = true;
                    blockAskPay.IsVisible = true;
                }
            }
            else
            {
                ((Entry)sender).TextColor = Color.Red;
                //btnConntinue.IsVisible = false;
                blockAskPay.IsVisible = false;
            }
        }
 private async Task ClosePopupAsync()
 {
     await PopupNavigation.PopAllAsync(true);
 }
示例#24
0
 public void Cerrar()
 {
     PopupNavigation.PopAllAsync();
 }
示例#25
0
        public async void Close()
        {
            //    PopupPage page = new CheckinPage();

            await PopupNavigation.PopAllAsync();
        }
示例#26
0
        private async void Button_Clicked_1(object sender, EventArgs e)
        {
            await PopupNavigation.PopAllAsync();

            await App.Navigator.PushAsync(new Views.ItemView(proNo));
        }
示例#27
0
 public void ClosePopUp()
 {
     // Close the modal page
     PopupNavigation.PopAllAsync();
 }
示例#28
0
 private async void VoltarPagina(string nome)
 {
     Navigation.PushModalAsync(new EditorMateria(nome));
     PopupNavigation.PopAllAsync();
 }
示例#29
0
 async void Loadingalertcall()
 {
     await PopupNavigation.PopAllAsync();
 }
示例#30
0
        private async void TapGestureRecognizer_Tapped(object sender, System.EventArgs e)
        {
            await PopupNavigation.PopAllAsync();

            fullPhotoTruckVM.BackToRootPage();
        }