public SupplierDetailPage(SupplierDetailViewModel viewModel)
 {
     InitializeComponent();
     BindingContext = this.viewModel = viewModel;
     Children.Add(new SupplierServicesPage(viewModel));
     Children.Add(new SupplierMenuPage());
     Children.Add(new SupplierContactPage(viewModel));
 }
        public SupplierDetailPage(Supplier supplier)
        {
            InitializeComponent();
            var supplierViewModel = new SupplierDetailViewModel(Navigation);

            supplierViewModel.Supplier = supplier;
            BindingContext             = supplierViewModel;
        }
        public SupplierDetailView(SupplierDetailViewModel model)
        {
            InitializeComponent();
            DataContext = model;

            _supVewModel         = new SupplierDetailViewModel(regionManager, eventAggregator);
            dataSource           = _supVewModel.AutoFillCountry();
            dataSourceState      = _supVewModel.AutoFillState();
            dataSourceCity       = _supVewModel.AutoFillCity();
            dataSourcePostalCode = _supVewModel.AutoFillPostalCode();
            dataSourceShiping.AddRange(dataSource);
            dataSourceStateShiping.AddRange(dataSourceState);
            dataSourceCityShiping.AddRange(dataSourceCity);
        }
        public SupplierContactPage(SupplierDetailViewModel viewModel)
        {
            InitializeComponent();

            TiffinMap.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(
                        viewModel.Supplier.Latitude,
                        viewModel.Supplier.Longitude
                        ),
                    Distance.FromKilometers(3)
                    )
                );
        }
Exemplo n.º 5
0
        public async Task <ActionResultResponse <SupplierDetailViewModel> > GetDetail(string tenantId, string id, ContactType type)
        {
            var supplierInfo = await _supplierRepository.GetInfo(id, tenantId);

            var contacts = await _contactRepository.GetAll(id, type);

            var result = new SupplierDetailViewModel()
            {
                Address          = supplierInfo.Address,
                Id               = supplierInfo.Id,
                IsActive         = supplierInfo.IsActive,
                Name             = supplierInfo.Name,
                ConcurrencyStamp = supplierInfo.ConcurrencyStamp,
                Description      = supplierInfo.Description,
                Contacts         = contacts
            };

            return(new ActionResultResponse <SupplierDetailViewModel>
            {
                Code = 1,
                Data = result
            });
        }
        public SupplierServicesPage(SupplierDetailViewModel viewModel)
        {
            InitializeComponent();

            //Service Type
            var lunchLabel = new Label {
                Text = "Lunch"
            };

            lunchLabel.Style = viewModel.Supplier.Services.Lunch ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            ServiceTypeStackLayout.Children.Add(lunchLabel);

            var dinnerLabel = new Label {
                Text = "Dinner"
            };

            dinnerLabel.Style = viewModel.Supplier.Services.Dinner ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            ServiceTypeStackLayout.Children.Add(dinnerLabel);

            //FoodCategory
            var vegeterianLabel = new Label {
                Text = "Vegeterian"
            };

            vegeterianLabel.Style = viewModel.Supplier.Services.Vegeterian ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            FoodCategoryStackLayout.Children.Add(vegeterianLabel);

            var nonVegeterianLabel = new Label {
                Text = "Non-Vegeterian"
            };

            nonVegeterianLabel.Style = viewModel.Supplier.Services.NonVegeterian ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            FoodCategoryStackLayout.Children.Add(nonVegeterianLabel);

            //Delivery Details
            var homeDeliveryLabel = new Label {
                Text = "Home Delivery"
            };

            homeDeliveryLabel.Style = viewModel.Supplier.Services.HomeDelivery ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            DeliveryStackLayout.Children.Add(homeDeliveryLabel);

            var takeAwayLabel = new Label {
                Text = "Take Away"
            };

            takeAwayLabel.Style = viewModel.Supplier.Services.TakeAway ? (Style)Application.Current.Resources["LabelGreenText"] : (Style)Application.Current.Resources["LabelGrayText"];
            DeliveryStackLayout.Children.Add(takeAwayLabel);

            //Cuisine
            if (viewModel.Supplier.Services.Cuisine.ToString() != "")
            {
                string[] cusines = viewModel.Supplier.Services.Cuisine.ToString().Split(',').Select(sValue => sValue.Trim()).ToArray();
                foreach (string cusineName in cusines)
                {
                    var cuisineLabel = new Label {
                        Text = cusineName, Style = (Style)Application.Current.Resources["LabelGreenText"],
                    };
                    CuisineLayout.Children.Add(cuisineLabel);
                }
            }
        }