Beispiel #1
0
        /// <summary>
        ///  Assist data services. All the services needed to manage the assist.
        /// </summary>
        /// <returns></returns>
        public IAssistDataService GetAssistDataServices()
        {
            // this is  pretty intesting that it is eveytime a new one.

            _assistDataService = new AssistDataService(this);
            return(_assistDataService);
        }
Beispiel #2
0
        /// <summary>
        ///  Constructor
        /// </summary>
        /// <param name="configurationService">This is the configurartion service</param>
        /// <param name="eventManager"> The event manager for sending/recieving messages from the view model</param>
        /// <param name="dialogService"></param>
        /// <param name="services">Data access layer interface</param>
        public VehicleInfoViewModel(IConfigurationService configurationService, IEventManager eventManager,
                                    IDialogService dialogService,
                                    IDataServices services, IRegionManager regionManager, IInteractionRequestController requestController) :
            base(eventManager, configurationService, services, dialogService, regionManager, requestController)
        {
            // by default is not initialized until it comes to Init completed.
            IsViewModelInitialized = false;
            SubSystem             = DataSubSystem.VehicleSubsystem;
            MailBoxHandler       += MessageHandler;
            _vehicleDataServices  = services.GetVehicleDataServices();
            _assistDataService    = services.GetAssistDataServices();
            ItemChangedCommand    = new DelegateCommand <object>(ChangeUnpack);
            MetaDataObject        = InitAssuranceObject();
            DataFieldCollection   = InitDataField();
            RevisionObject        = InitRevisionComposedFieldObjects();
            MaintenanceCollection = _maintenaince;
            _regionManager        = regionManager;
            _deleteEventHandler  += DeleteEventHandler;
            EventManager.RegisterObserverSubsystem(MasterModuleConstants.VehiclesSystemName, this);
            AssistCommand      = new DelegateCommand <object>(AssistCommandHelper);
            _queryStoreFactory = new QueryStoreFactory();
            _saveCommand       = new DelegateCommand <object>(OnSaveCommand);
            var gid = Guid.NewGuid();

            ViewModelUri = new Uri("karve://vehicle/viewmodel?id=" + gid.ToString());

            ActiveSubSystem();
        }
        /// <summary>
        ///  Constructor.
        /// </summary>
        /// <param name="services">Data service for data retrieving</param>
        /// <param name="controller">Interaction controller for showing popup</param>
        /// <param name="dialogService">Error message dialog controller</param>
        /// <param name="unityContainer"></param>
        /// <param name="eventManager"></param>
        /// <param name="navigation"></param>
        /// <param name="configurationService"></param>
        /// <param name="regionManager"></param>
        public BookingIncidentInfoViewModel(IDataServices services, IInteractionRequestController controller,
                                            IDialogService dialogService,
                                            IUnityContainer unityContainer,
                                            IEventManager eventManager,
                                            IKarveNavigator navigation,
                                            IConfigurationService configurationService,
                                            IRegionManager regionManager) : base(services, controller, dialogService, eventManager, regionManager, configurationService)
        {
            AssistCommand      = new DelegateCommand <object>(OnAssistCommand);
            ItemChangedCommand = new DelegateCommand <object>(OnChangedField);

            SubSystem = DataSubSystem.BookingSubsystem;

            ViewModelUri            = new Uri("karve://booking/incident/show/viewmodel?id=" + Guid.ToString());
            _unityContainer         = unityContainer;
            _navigator              = navigation;
            _userSettings           = configurationService.UserSettings;
            _deleteCommand          = new DelegateCommand <object>(DeleteViewCommand);
            _saveCommand            = new DelegateCommand <object>(SaveViewCommand);
            _newCommand             = new DelegateCommand <object>(NewViewCommand);
            _dataIncidentService    = services.GetBookingIncidentDataService();
            _assistDataService      = services.GetAssistDataServices();
            _unityContainer         = unityContainer;
            CompositeCommandOnly    = true;
            VehicleColumns          = "Code,Brand,Model,Matricula,VehicleGroup,Situation,Office,Places,CubeMeters,Activity,Owner";
            ClientsConductorColumns = "Code,Name,Nif,Phone,Movil,Email,Card,ReplacementCar,Zip,City,CreditCardType,NumberCreditCard, PaymentForm,AccountableAccount,Sector,Zona,Origin,Office,Falta,BirthDate,DrivingLicence";
            AssistMapper            = _assistDataService.Mapper;
            EventManager.RegisterObserverSubsystem(BookingModule.GroupBookingIncident, this);
            EventManager.RegisterObserverSubsystem(BookingModule.BookingSubSystem, this);
        }
Beispiel #4
0
        public ReservationRequestsViewModel(IDataServices services, IInteractionRequestController controller, IDialogService dialogService, IEventManager eventManager, IKarveNavigator navigation, IConfigurationService configurationService, IRegionManager regionManager) : base(services, controller, dialogService, eventManager, regionManager)
        {
            AssistCommand          = new DelegateCommand <object>(OnAssistCommand);
            ItemChangedCommand     = new DelegateCommand <object>(OnChangedField);
            CreateNewClient        = new DelegateCommand(NewClient);
            CreateNewGroup         = new DelegateCommand(NewGroup);
            CreateNewRequestReason = new DelegateCommand(NewRequestReason);
            CreateNewReseller      = new DelegateCommand(NewReseller);
            CreateNewFare          = new DelegateCommand(NewFare);
            CreateNewVehicle       = new DelegateCommand(NewVehicle);
            CreateNewOrigen        = new DelegateCommand(NewOrigin);
            SubSystem = DataSubSystem.BookingSubsystem;

            ViewModelUri            = new Uri("karve://booking/request/viewmodel?id=" + Guid.ToString());
            _navigator              = navigation;
            _helperViewFactory      = _navigator.GetHelperViewFactory();
            _userSettings           = configurationService.GetUserSettings();
            _deleteCommand          = new DelegateCommand <object>(this.DeleteViewCommand);
            _saveCommand            = new DelegateCommand <object>(SaveViewCommand);
            _dataReservationService = services.GetReservationRequestDataService();
            _assistDataService      = services.GetAssistDataServices();
            AssistMapper            = _assistDataService.Mapper;
            CompositeCommandOnly    = true;
            VehicleGridColumns      = _userSettings.FindSetting <string>(UserSettingConstants.VehicleSummaryGridColumnsKey);
            EventManager.RegisterObserverSubsystem("ReservationRequests", this);
        }
Beispiel #5
0
 public DirectionBaseViewModel(string query, IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(query, dataServices, region, manager, dialogService)
 {
     _assistDataService            = dataServices.GetAssistDataServices();
     AssistMapper                  = _assistDataService.Mapper;
     AssistCommand                 = new DelegateCommand <object>(OnAssistAsync);
     AssistCompletionEventHandler += AssistComplete;
 }
Beispiel #6
0
 /// <summary>
 ///  CitiesViewModel
 /// </summary>
 /// <param name="dataServices">DataService</param>
 /// <param name="region">Region</param>
 /// <param name="manager">EventManager</param>
 public CitiesViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService service, IConfigurationService config) : base(String.Empty, dataServices, region, manager, service, config)
 {
     AssistCommand = new DelegateCommand <object>(OnAssistRequest);
     if (_gridIdentifier == 0)
     {
         _gridIdentifier = GenerateGridId();
     }
     _assistDataService = dataServices.GetAssistDataServices();
     GridIdentifier     = _gridIdentifier;
 }
Beispiel #7
0
 protected HeaderedLineViewModelBase(IDataServices dataServices,
                                     IDialogService dialogServices,
                                     IEventManager manager,
                                     IRegionManager regionManager,
                                     IIdentifier identifier,
                                     IInteractionRequestController controller) : base(dataServices, controller, dialogServices, manager)
 {
     RegionManager       = regionManager;
     IdentifierGenerator = identifier;
     AssistDataService   = DataServices.GetAssistDataServices();
     LineVisible         = true;
     FooterVisible       = true;
 }
 /// <summary>
 /// ProviderInfoViewModel.
 /// </summary>
 /// <param name="eventManager"></param>
 /// <param name="configurationService"></param>
 /// <param name="dataServices"></param>
 /// <param name="dialogService"></param>
 /// <param name="manager"></param>
 /// <param name="controller"></param>
 public ProviderInfoViewModel(IEventManager eventManager, IConfigurationService configurationService,
                              IDataServices dataServices, IDialogService dialogService,
                              IRegionManager manager, IInteractionRequestController controller) : base(eventManager, configurationService, dataServices, dialogService, manager, controller)
 {
     ConfigurationService = configurationService;
     MailBoxHandler      += MessageHandler;
     AccountAssistQuery   = _accountAssistQuery;
     EventManager.RegisterObserverSubsystem(MasterModuleConstants.ProviderSubsystemName, this);
     // TODO: all the mapping shall be isolated.
     mapper = MapperField.GetMapper();
     _onBranchesPrimaryKey += ProviderInfoViewModel__onBranchesPrimaryKey;
     _onContactsPrimaryKey += ProviderInfoViewModel__onContactsPrimaryKey;
     _uniqueCounter++;
     _assistDataService = dataServices.GetAssistDataServices();
     SubSystem          = DataSubSystem.SupplierSubsystem;
     ViewModelUri       = new Uri("karve://supplier/viewmodel?id=" + Guid.ToString());
     InitVmCommands();
 }
Beispiel #9
0
 /// <summary>
 ///  Reitinialize the sql executor and all the services provided by this interface with
 ///  a new connection string.
 /// </summary>
 /// <param name="sqlExecutor">Executor to be used.</param>
 /// <param name="connectionValue">Connection value.</param>
 private void InitServices(ISqlExecutor sqlExecutor, string connectionValue = "")
 {
     if (!string.IsNullOrEmpty(connectionValue))
     {
         sqlExecutor.ConnectionString = connectionValue;
     }
     _executor                    = sqlExecutor;
     _supplierDataServices        = new SupplierDataAccessLayer(sqlExecutor);
     _helperDataServices          = new HelperDataAccessLayer(sqlExecutor);
     _commissionAgentDataServices = new CommissionAgentAccessLayer(sqlExecutor);
     _vehicleDataServices         = new VehiclesDataAccessLayer(sqlExecutor);
     _settingsDataService         = new SettingsDataService(sqlExecutor);
     _clientDataServices          = new ClientDataAccessLayer(sqlExecutor);
     _officeDataService           = new OfficeDataService(sqlExecutor);
     _companyDataService          = new CompanyDataServices(sqlExecutor);
     _contractDataService         = new ContractDataServices(sqlExecutor);
     _invoiceDataService          = new InvoiceDataServices(sqlExecutor);
     _assistDataService           = new AssistDataService(this);
 }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginViewModel"/> class.
        ///  Login view model.
        /// </summary>
        /// <param name="configurationService">
        /// System configuration service
        /// </param>
        /// <param name="services">
        /// Data services
        /// </param>
        /// <param name="assistService">
        /// Magnifier request answer
        /// </param>
        /// <param name="interactionRequestController">
        /// Interaction controller.
        /// </param>
        /// <param name="service">
        /// Authentication service
        /// </param>

        public LoginViewModel(IConfigurationService configurationService,
                              IDataServices services,
                              IAssistDataService assistService,
                              IInteractionRequestController interactionRequestController,
                              IAuthorizationService service)
        {
            InitializeViewModel();
            LoginCommand              = new DelegateCommand <object>(this.OnLogin);
            MagnifierCommand          = new DelegateCommand <object>(this.OnAssistCommand);
            ItemChangedCommand        = new DelegateCommand <object>(this.OnChanged);
            this.dataServices         = services;
            this.authService          = service;
            this.assistService        = assistService;
            this.AssistMapper         = assistService.Mapper;
            this.configurationService = configurationService;
            Salutation = string.Empty;
            DataObject = new UserViewObject();
            InitVisibleOffice();
        }
Beispiel #11
0
        protected HeaderedLineViewModelBase(IDataServices dataServices,
                                            IDialogService dialogServices,
                                            IEventManager manager,
                                            IRegionManager regionManager,
                                            IIdentifier identifier,
                                            IConfigurationService configurationService,
                                            IInteractionRequestController controller) : base(dataServices, controller, dialogServices, manager, configurationService)
        {
            RegionManager       = regionManager;
            IdentifierGenerator = identifier;
            AssistDataService   = DataServices.GetAssistDataServices();
            LineVisible         = true;
            FooterVisible       = true;

            /* This instruct the toolbar to skip its is own handlers. Avoiding complexity.
             * It will be just the view to save itself with composite command and to alert it subsystem.
             *  This with the SetRegistrationPayLoad set properly it will permit to save itself.
             *  Each view will save itself, like in this scenario:
             *  https://prismlibrary.github.io/docs/wpf/Advanced-MVVM.html
             * It is better that all headered window will use a composite command.
             */
            CompositeCommandOnly = true;
        }
 private void InitServices(IDataServices services, IConfigurationService configurationService)
 {
     _userSettings           = configurationService.UserSettings;
     _dataReservationService = services.GetReservationRequestDataService();
     _assistDataService      = services.GetAssistDataServices();
 }