Beispiel #1
0
        private void LoadAllCountries()
        {
            /* There are at most 200 countries in the world today.
             * So no incremental loading is needed. Perforance test showed up that the grid freezed
             * after 1000 items.
             */
            _loader    = new HelperLoader <CountryDto, Country>(DataServices);
            CountryDto = _loader.HelperView;
            _loader.LoadAll();
            var list = from country in _loader.HelperView
                       from province in HelperView
                       where province.Country == country.Code
                       select new ProvinciaDto()
            {
                Name         = province.Name,
                Code         = province.Code,
                Country      = province.Country,
                Capital      = province.Capital,
                Prefix       = province.Prefix,
                CountryValue = new CountryDto()
                {
                    Code        = country.Code,
                    CountryName = country.CountryName
                }
            };

            HelperView = new IncrementalList <ProvinciaDto>(LoadMoreItems);
            HelperView.LoadItems(list);
        }
Beispiel #2
0
        /// <summary>
        ///
        ///  ProvinceViewModel
        /// </summary>
        /// <param name="dataServices">DataServices testing</param>
        /// <param name="region">Region </param>
        /// <param name="manager"> event manager to send and put messages.</param>
        public ProvinceViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService service) : base(string.Empty, dataServices, region, manager, service)
        {
            LoadAllCountries();
            _provinceLoader      = new HelperLoader <ProvinciaDto, PROVINCIA>(dataServices);
            AssistCountryCommand = new DelegateCommand <object>(OnAssistCountryCommand);
            GridIdentifier       = KarveCommon.Generic.GridIdentifiers.HelperProvince;
            _provinceLoader.LoadAll();

            HelperView = _provinceLoader.HelperView;
        }
 public ResellersViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService, IConfigurationService config) : base(string.Empty, dataServices, region, manager, dialogService, config)
 {
     HelperDto       = new ResellerViewObject();
     _dataServices   = dataServices;
     _resellerLoader = new HelperLoader <ResellerViewObject, VENDEDOR>(dataServices);
     _cityLoader     = new HelperLoader <CityViewObject, POBLACIONES>(dataServices);
     _countryLoader  = new HelperLoader <CountryViewObject, Country>(dataServices);
     _provinceLoader = new HelperLoader <ProvinceViewObject, PROVINCIA>(dataServices);
     GridIdentifier  = KarveCommon.Generic.GridIdentifiers.HelperReseller;
 }
 private void InitLoader(IDataServices dataServices, string query)
 {
     _loader = new HelperLoader <Dto, Entity>(dataServices);
     if (query == string.Empty)
     {
         _loader.LoadAll();
         if (_loader.HelperView != null)
         {
             HelperView = _loader.HelperView;
             HelperDto  = _loader.HelperView.FirstOrDefault();
         }
     }
     else
     {
         _loader.Load(query);
         if (_loader.HelperView != null)
         {
             HelperView = _loader.HelperView;
             HelperDto  = _loader.HelperView.FirstOrDefault();
         }
     }
 }
        /// <summary>
        /// Constructor for the vehicleviewextra view model.
        /// </summary>
        /// <param name="dataServices">DataServices to be used</param>
        /// <param name="region">Region manager to be used</param>
        /// <param name="manager">Event manager to be used</param>

        public VehicleExtraViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService, IConfigurationService config) : base(string.Empty, dataServices, region, manager, dialogService, config)
        {
            _vehicleTypeLoader = new HelperLoader <VehicleTypeViewObject, CATEGO>(dataServices);
            InitLoad();
        }
        /// <summary>
        /// Constructor for the vehicleviewextra view model.
        /// </summary>
        /// <param name="dataServices">DataServices to be used</param>
        /// <param name="region">Region manager to be used</param>
        /// <param name="manager">Event manager to be used</param>

        public VehicleExtraViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(string.Empty, dataServices, region, manager, dialogService)
        {
            _vehicleTypeLoader = new HelperLoader <VehicleTypeDto, CATEGO>(dataServices);
            InitLoad();
        }