Ejemplo n.º 1
0
        public CategoryPageViewModel(INavigationService navigationService, ISqLiteService sqLiteService)
            : base(navigationService: navigationService, sqliteService: sqLiteService)
        {
            IsSearchCommand         = new DelegateCommand(IsSearchChangeExcute);
            SelectedCategoryCommand = new DelegateCommand(SelectedCategoryExcute);

            var list = SqLiteService.GetList <Category>(x => x.Id != -1).ToList();

            if (list.Count > 0)
            {
                CategoryList = new ObservableCollection <Category>(list);
            }
            else
            {
                CategoryList = new ObservableCollection <Category>()
                {
                    new Category()
                    {
                        Id           = 1,
                        CategoryName = TranslateExtension.Get("ElectronicsAndGadgets"),
                        Image        = "ic_history",
                    },
                    new Category()
                    {
                        Id           = 2,
                        CategoryName = TranslateExtension.Get("HomeAndFurniture"),
                        Image        = "ic_history",
                    }, new Category()
                    {
                        Id           = 3,
                        CategoryName = TranslateExtension.Get("SportAndHealth"),
                        Image        = "ic_history",
                    }, new Category()
                    {
                        Id           = 4,
                        CategoryName = TranslateExtension.Get("Fashion"),
                        Image        = "ic_history",
                    }, new Category()
                    {
                        Id           = 5,
                        CategoryName = TranslateExtension.Get("OfficeAndIndustry"),
                        Image        = "ic_history",
                    }
                };
                foreach (var item in CategoryList)
                {
                    SqLiteService.Insert(item);
                }
            }
        }
Ejemplo n.º 2
0
 public ShowCardPageViewModel(INavigationService navigationService, ISqLiteService sqLiteService, IHttpRequest httpRequest)
     : base(navigationService: navigationService, sqliteService: sqLiteService, httpRequest: httpRequest)
 {
     if (!IsNullCart)
     {
         var listItemOfCartTemp = SqLiteService.GetList <OrderDetails>(x => x.Id != "");
         ItemOfOrder = new ObservableCollection <OrderDetails>();
         if (listItemOfCartTemp != null)
         {
             ItemOfOrder = new ObservableCollection <OrderDetails>(listItemOfCartTemp);
             foreach (var item in ItemOfOrder)
             {
                 Total += item.Amount * item.Price;
             }
         }
     }
     NavigateToCheckoutCommand = new DelegateCommand(NavigateToCheckoutExcute);
 }
Ejemplo n.º 3
0
        public ProceedToCheckoutPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService, ISqLiteService sqLiteService, IHttpRequest httpRequest)
            : base(navigationService: navigationService, dialogService: pageDialogService, sqliteService: sqLiteService, httpRequest: httpRequest)
        {
            NavigateToWalletCommand = new DelegateCommand(NavigateToWalletExcute);
            if (!IsNullCart)
            {
                var listItemOfCartTemp = SqLiteService.GetList <OrderDetails>(x => x.Id != "");
                ItemOfOrder = new ObservableCollection <OrderDetails>();
                if (listItemOfCartTemp != null)
                {
                    ItemOfOrder = new ObservableCollection <OrderDetails>(listItemOfCartTemp);
                    foreach (var item in ItemOfOrder)
                    {
                        Total += item.Amount * item.Price;
                    }
                }
            }
            ChooseShippingList = new ObservableCollection <string>()
            {
                TranslateExtension.Get("FreeShip"),
                TranslateExtension.Get("Standard"),
                TranslateExtension.Get("Express"),
            };

            ChooseScheduleWay = new ObservableCollection <string>()
            {
                TranslateExtension.Get("Once"),
                TranslateExtension.Get("Twice"),
                TranslateExtension.Get("Third"),
            };

            CheckoutCommand = new DelegateCommand(CheckoutExcute);

            if (App.Settings.IsLogin)
            {
                UserInfo = SqLiteService.Get <UserModel>(x => x.Id != -1);
            }
        }