public void CommandTestEdit()
        {
            LocationListModel currentLocation = new LocationListModel(1, "Tool Crib");
            LocationDetails   location        = new LocationDetails(currentLocation, new DataRepository());

            Assert.IsTrue(location.Edit.CanExecute(null));
        }
Пример #2
0
        public LocationListModel FindLocationsListModel(int companyId, int index, int pageNo, int pageSize, string search)
        {
            var model = new LocationListModel();

            // Do a case sensitive search
            model.GridIndex = index;
            var allItems = db.FindLocations(companyId, true)
                           .Where(l => l.CompanyId == companyId &&
                                  (string.IsNullOrEmpty(search) ||
                                   (l.LocationIdentification != null && l.LocationIdentification.ToLower().Contains(search.ToLower())) ||
                                   (l.LocationName != null && l.LocationName.ToLower().Contains(search.ToLower())) ||
                                   (l.Street != null && l.Street.ToLower().Contains(search.ToLower())) ||
                                   (l.City != null && l.City.ToLower().Contains(search.ToLower())) ||
                                   (l.State != null && l.State.ToLower().Contains(search.ToLower())) ||
                                   (l.PostCode != null && l.PostCode.ToLower().Contains(search.ToLower())) ||
                                   (l.Country != null && l.Country.ToLower().Contains(search.ToLower())) ||
                                   (l.Contact != null && l.Contact.ToLower().Contains(search.ToLower())) ||
                                   (l.ContactPhone != null && l.ContactPhone.ToLower().Contains(search.ToLower()))));

            model.TotalRecords = allItems.Count();
            foreach (var item in allItems.Skip((pageNo - 1) * pageSize)
                     .Take(pageSize))
            {
                model.Items.Add(MapToModel(item));
            }
            return(model);
        }
Пример #3
0
        private void InitializeOptionsModel(LocationListModel model)
        {
            OptionsModel = _service.GetLocationInventoryListOptionModel(model.LocationId);

            OptionsModel.OptionChanged += ClearItems;

            OptionsModel.SetDefaultOptions();
        }
Пример #4
0
        public LocationInventoryListViewModel(LocationListModel model,
                                              IWorkspaceManager workspaceManager,
                                              ILocationInventoryListService service)
        {
            WorkspaceManager = workspaceManager;
            _service         = service;

            Initialize(model);
        }
        public void LocationDetailsTest()
        {
            LocationListModel currentLocation = new LocationListModel(1, "Tool Crib");
            LocationDetails   location        = new LocationDetails(currentLocation, new DataRepository());

            Assert.IsNotNull(location.CurrentLocation.Availability);
            Assert.IsNotNull(location.CurrentLocation.Id);
            Assert.IsNotNull(location.CurrentLocation.Name);
            Assert.IsNotNull(location.CurrentLocation.CostRate);
        }
Пример #6
0
        private async Task ShowDetailPage()
        {
            var university = await _httpClient.GetUniversitiesByRegionIdAsync(
                Application.Current.Properties["token"].ToString(),
                _regions.First(x => x.Name == _locationsSelectedItem.Region).Id);

            await Navigation.PushAsync(new UniversityPage(university, _locationsSelectedItem.Region), true);

            LocationsSelectedItem = null;
        }
Пример #7
0
        private void Initialize(LocationListModel model)
        {
            DisplayName = $"{model.LocationName} laoseis";

            SelectedItemChanged += (p) => LoadProductDeliveriesModel();

            InitializeOptionsModel(model);

            Refresh();
        }
Пример #8
0
        public IActionResult LocationList()
        {
            var model = new LocationListModel()
            {
                Locations = _LocationService.GetAll()
            };


            return(View(model));
        }
Пример #9
0
        public ActionResult Delete(int index, int id)
        {
            var model = new LocationListModel();

            model.GridIndex = index;
            try {
                LookupService.DeleteLocation(id);
            } catch (Exception e1) {
                model.Error.SetError(e1);
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
 public LocationDetails(Object selectedItem, IDataRepository productService)
 {
     dataRepository = productService;
     if (selectedItem != null)
     {
         this.Edit = new Binding(EditLocation);
         LocationListModel item     = (LocationListModel)selectedItem;
         int             locationID = item.Id;
         LocationWrapper location   = dataRepository.GetLocation(locationID);
         currentLocation = new LocationListDetailModel(location.LocationID, location.Name, location.CostRate, location.Availability, location.ModifiedDate);
     }
 }
Пример #11
0
        public async Task <LocationListModel> PrepareShelfLocationFormatListModel(LocationSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var shelfLocationFormats = await _locationService.GetAllShelfLocationFormatsAsync();

            if (shelfLocationFormats == null)
            {
                throw new ArgumentNullException(nameof(shelfLocationFormats));
            }

            var model = new LocationListModel
            {
                //Data = shelfLocationFormats.Select(shelfLocationFormat =>
                //{
                //    var shelfLocationFormatsModel = shelfLocationFormat.ToModel<LocationModel>();
                //    return shelfLocationFormatsModel;
                //}),
                Data = shelfLocationFormats.PaginationByRequestModel(searchModel).Select(shelfLocationFormat =>
                {
                    var shelfLocationFormatsModel = shelfLocationFormat.ToModel <LocationModel>();
                    return(shelfLocationFormatsModel);
                }),
                Total = shelfLocationFormats.Count
            };

            // sort
            if (searchModel.Sort != null && searchModel.Sort.Any())
            {
                foreach (var s in searchModel.Sort)
                {
                    model.Data = await model.Data.Sort(s.Field, s.Dir);
                }
            }

            // filter
            if (searchModel.Filter != null && searchModel.Filter.Filters != null && searchModel.Filter.Filters.Any())
            {
                var filter = searchModel.Filter;
                model.Data = await model.Data.Filter(filter);

                model.Total = model.Data.Count();
            }

            return(model);
        }