private void ShopListView_Refreshing(object sender, EventArgs e)
        {
            ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);

            shopListView.BindingContext = model;
            shopListView.EndRefresh();
        }
Пример #2
0
        public ShopListDialogView(int shop)
        {
            InitializeComponent();
            BindingContext = viewModel = new ShopListViewModel(DialogNotifier, shop);

            viewModel.LoadItems.Execute(null);
        }
Пример #3
0
        public async Task <ActionResult> Index()
        {
            string userId = User.Identity.GetUserId();

            client = new HttpClient()
            {
                BaseAddress = new System.Uri(url + "/" + userId)
            };
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage message = await client.GetAsync(url + "/" + userId);

            var id = User.Identity.GetUserId <string>();

            if (message.IsSuccessStatusCode)
            {
                var responseData = message.Content.ReadAsStringAsync().Result;
                var shopListData = JsonConvert.DeserializeObject <List <IngredientDto> >(responseData);

                var shopList = new ShopListViewModel()
                {
                    list = shopListData
                };

                return(View(shopList));
            }
            return(View());
        }
Пример #4
0
        public async Task <ActionResult> Index()
        {
            var adminShopService = serviceLocator.GetService <IAdminShopService>();
            var model            = new ShopListViewModel();

            model.shops = await adminShopService.GetAll();

            return(View("Views/Shop/ShopListView.cshtml", model));
        }
        public IActionResult Edit(ShopListViewModel shopListViewModel, int id)
        {
            var shopList = _shopListRepository.GetById <ShopList>(id);

            shopList.Name = shopListViewModel.Name;

            _shopListRepository.Update(shopList);

            return(RedirectToAction("Details", new { id = shopList.ShopListId }));
        }
        private async void Address_Tapped(object sender, EventArgs e)
        {
            //SearchShopPopup searchShopPopup = new SearchShopPopup();
            //searchShopPopup.Disappearing += SearchShopPopup_Disappearing;
            //await App.Current.MainPage.Navigation.PushPopupAsync(searchShopPopup);

            ShopListService.loaderCheck = true;
            ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);

            shopListView.BindingContext = model;
        }
        public IActionResult Edit(int id)
        {
            var shopList = _shopListRepository.GetById <ShopList>(id);

            ShopListViewModel shopListViewModel = new ShopListViewModel
            {
                ShopListId = shopList.ShopListId,
                Name       = shopList.Name,
            };

            return(View(shopListViewModel));
        }
        public IActionResult Details(int id)
        {
            var shopList = _shopListRepository.GetShopListWithRecipes(id);

            ShopListViewModel shopListViewModel = new ShopListViewModel
            {
                ShopListId = shopList.ShopListId,
                Name       = shopList.Name,
                ListItems  = shopList.ListItems
            };

            return(View(shopListViewModel));
        }
        private void SearchShopPopup_Disappearing(object sender, EventArgs e)
        {
            if (SearchShopPopup.loading == false)
            {
                ShopListService.loaderCheck = true;
                ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);
                shopListView.BindingContext = model;

                //  HomePageProductViewModel modelOffer = new HomePageProductViewModel("");
                // productListView.BindingContext = modelOffer;

                // adsLbl.Text = Address;
            }
            SearchShopPopup.loading = false;
        }
Пример #10
0
        public ActionResult Table()
        {
            ViewBag.ShopMenuActive = "active open";
            ViewBag.ShopActive     = "active open";
            ViewBag.Title          = "Shops";

            var model = new ShopListViewModel();

            //model.AddNewForm = new AddEditShopForm();
            //model.AddNewForm.AddOrEditUrl = Url.Action("New");
            model.ControllerName = "Shop";
            //model.Editable = true;

            return(View("~/Views/Shared/Table.cshtml", model));
        }
        public IActionResult Details(int recipeId, int shopListId)
        {
            _listItemService.RemoveRecipeFromShopList(recipeId, shopListId);

            var shopList = _shopListRepository.GetShopListWithRecipes(shopListId);

            ShopListViewModel shopListViewModel = new ShopListViewModel
            {
                ShopListId = shopList.ShopListId,
                Name       = shopList.Name,
                ListItems  = shopList.ListItems
            };

            return(View(shopListViewModel));
        }
        public IActionResult Create(ShopListViewModel shopListViewModel)
        {
            if (ModelState.IsValid)
            {
                ShopList shopList = new ShopList
                {
                    ShopListId  = shopListViewModel.ShopListId,
                    Name        = shopListViewModel.Name,
                    CreatedDate = DateTime.Now,
                };

                _shopListRepository.Add(shopList);

                return(RedirectToAction("Index"));
            }

            return(View(shopListViewModel));
        }
        public async void loadLatLng()
        {
            try
            {
cleanup:
                var timeout = TimeSpan.FromSeconds(1);
                var locator = CrossGeolocator.Current;
                // if (locator.IsGeolocationEnabled)
                {
                    locator.DesiredAccuracy = 50;
                    int tm = 1000;
                    if (Device.OS == TargetPlatform.Android)
                    {
                        tm = 100000;
                    }
                    var position = await locator.GetPositionAsync(tm);

                    if (position != null)
                    {
                        Lat = position.Latitude.ToString();
                        Lng = position.Longitude.ToString();



                        if (!string.IsNullOrEmpty(Lat) && !string.IsNullOrEmpty(Lat))
                        {
                            ShopListService.loaderCheck = true;
                            ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);
                            shopListView.BindingContext = model;
                        }

                        // HomePageProductViewModel modelOffer = new HomePageProductViewModel("");
                        // productListView.BindingContext = modelOffer;
                    }
                }
                if (string.IsNullOrEmpty(Lat) && string.IsNullOrEmpty(Lat))
                {
                    goto cleanup;
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #14
0
 public ShopListPage()
 {
     BindingContext = new ShopListViewModel();
     InitializeComponent();
 }
        private void SearchTxt_TextChanged(object sender, TextChangedEventArgs e)
        {
            ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);

            shopListView.BindingContext = model;
        }
Пример #16
0
 public ShopListPage()
 {
     InitializeComponent();
     BindingContext = new ShopListViewModel(Navigation);
 }
        private void LblClose_tgr_Tapped(object sender, EventArgs e)
        {
            string ID    = "";
            var    s     = sender as StackLayout;
            var    aa    = s.Children;
            int    count = 1;

            foreach (var item in aa)
            {
                if (count > 2)
                {
                    break;
                }
                else
                {
                    var cn = item as Label;
                    ID = cn.Text;
                    count++;
                }
            }


            string OFFER   = "";
            var    sOFFER  = sender as StackLayout;
            var    aaOFFER = sOFFER.Children;

            foreach (var item in aaOFFER)
            {
                var cn = item as Label;
                OFFER = cn.Text;
                break;
            }



            try
            {
                _categoryLyt.Children.Clear();

                foreach (var item in homeCategories)
                {
                    if (ID == item.id)
                    {
                        catId = item.id;
                        ShopProducts.shopOffer = OFFER;
                        //
                        Label idlbl = new Label()
                        {
                            Text      = item.id,
                            IsVisible = false
                        };
                        Label offerlbl = new Label()
                        {
                            Text      = string.IsNullOrEmpty(item.is_offer) ? "" : item.is_offer,
                            IsVisible = false
                        };


                        CachedImage img = new CachedImage()
                        {
                            Source             = CommonLib.img_MainUrl + item.logo,
                            HorizontalOptions  = LayoutOptions.Center,
                            HeightRequest      = 80,
                            WidthRequest       = 80,
                            Aspect             = Aspect.AspectFit,
                            LoadingPlaceholder = "product_Placeholder.png",
                            Transformations    = new List <ITransformation>()
                            {
                                new FFImageLoading.Transformations.CircleTransformation()
                                {
                                    BorderSize = 20, BorderHexColor = "#FE1F78"
                                }
                            },
                        };
                        Label namelbl = new Label()
                        {
                            Text                    = item.name,
                            TextColor               = Color.FromHex("#FE1F78"),
                            FontSize                = 14,
                            FontAttributes          = FontAttributes.Bold,
                            HorizontalTextAlignment = TextAlignment.Center,
                            FontFamily              = "CALIBRI",
                            StyleId                 = "CALIBRI",
                        };
                        StackLayout _imglayout = new StackLayout()
                        {
                            Orientation = StackOrientation.Vertical,
                            // HeightRequest = 150,
                            Spacing         = 0,
                            BackgroundColor = Color.Transparent,
                            // Padding = new Thickness(5, 5, 5, 5),
                            Children =
                            {
                                offerlbl, idlbl, img, namelbl
                            }
                        };
                        var lblClose_tgr = new TapGestureRecognizer();
                        lblClose_tgr.Tapped += LblClose_tgr_Tapped;
                        _imglayout.GestureRecognizers.Add(lblClose_tgr);
                        _categoryLyt.Children.Add(_imglayout);
                        //
                    }
                    else
                    {
                        //
                        Label idlbl = new Label()
                        {
                            Text      = item.id,
                            IsVisible = false
                        };
                        Label offerlbl = new Label()
                        {
                            Text      = string.IsNullOrEmpty(item.is_offer) ? "" : item.is_offer,
                            IsVisible = false
                        };
                        CachedImage img = new CachedImage()
                        {
                            Source             = CommonLib.img_MainUrl + item.logo,
                            HorizontalOptions  = LayoutOptions.Center,
                            HeightRequest      = 80,
                            WidthRequest       = 80,
                            Aspect             = Aspect.AspectFit,
                            LoadingPlaceholder = "product_Placeholder.png",
                            Transformations    = new List <ITransformation>()
                            {
                                new FFImageLoading.Transformations.CircleTransformation()
                                {
                                    BorderSize = 20, BorderHexColor = "#68696b"
                                }
                            },
                        };
                        Label namelbl = new Label()
                        {
                            Text                    = item.name,
                            TextColor               = Color.FromHex("#68696b"),
                            FontSize                = 14,
                            FontAttributes          = FontAttributes.Bold,
                            HorizontalTextAlignment = TextAlignment.Center,
                            FontFamily              = "CALIBRI",
                            StyleId                 = "CALIBRI",
                        };
                        StackLayout _imglayout = new StackLayout()
                        {
                            Orientation = StackOrientation.Vertical,
                            //  HeightRequest = 150,
                            Spacing         = 0,
                            BackgroundColor = Color.Transparent,
                            // Padding = new Thickness(5, 5, 5, 5),
                            Children =
                            {
                                offerlbl, idlbl, img, namelbl
                            }
                        };
                        var lblClose_tgr = new TapGestureRecognizer();
                        lblClose_tgr.Tapped += LblClose_tgr_Tapped;
                        _imglayout.GestureRecognizers.Add(lblClose_tgr);
                        _categoryLyt.Children.Add(_imglayout);
                        //
                    }
                }

                if (OFFER == "1")
                {
                    productListView.IsVisible = true;
                    shopListView.IsVisible    = false;
                }
                else
                {
                    productListView.IsVisible = false;
                    shopListView.IsVisible    = true;
                }

                // HomePageProductViewModel modelOffer = new HomePageProductViewModel("");
                //productListView.BindingContext = modelOffer;

                ShopListService.loaderCheck = true;
                ShopListViewModel model = new ShopListViewModel(SearchTxt.Text);
                shopListView.BindingContext = model;
            }
            catch (Exception)
            {
            }
        }
Пример #18
0
 public ShopListView()
 {
     InitializeComponent();
     this.shopListViewModel = new ShopListViewModel(this);
 }