/// <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; TestConnection(sqlExecutor, 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); _bookingDataService = new BookingDataAccessLayer(sqlExecutor, null); _fareDataService = new FareDataServices(sqlExecutor); _reservationRequestDataService = new ReservationRequestDataAccessLayer(sqlExecutor); _budgetDataService = new BudgetDataAccessLayer(sqlExecutor); _bookingIncidentDataService = new BookingIncidentDataAccessLayer(sqlExecutor); _userDataService = new UserDataService(sqlExecutor); }
/// <summary> /// ClientsInfoViewModel constructor. /// </summary> /// <param name="eventManager">Event manager</param> /// <param name="configurationService">Configuration service</param> /// <param name="dataServices">Data Service</param> /// <param name="manager">Region Manager</param> public ClientsInfoViewModel(IEventManager eventManager, IConfigurationService configurationService, IDataServices dataServices, IDialogService dialogService, IRegionManager manager, IInteractionRequestController controller) : base(eventManager, configurationService, dataServices, dialogService, manager, controller) { base.ConfigureAssist(); ConfigurationService = configurationService; MailBoxHandler += MessageHandler; IsVisible = Visibility.Collapsed; EventManager.RegisterObserverSubsystem(MasterModuleConstants.ClientSubSystemName, this); InitVmCommands(); ClientInfoRightRegionName = CreateNameRegion("RightRegion"); DriverZoneRegionName = CreateNameRegion("DriverZoneRegion"); StateVisible = true; _onBranchesPrimaryKey += ClientOnBranchesPrimaryKey; _onContactsPrimaryKey += ClientOnContactsPrimaryKey; _clientDataServices = dataServices.GetClientDataServices(); _clientData = _clientDataServices.GetNewDo("0"); eventHandler += OnDriverUpdate; DefaultPageSize = 50; ViewModelUri = new Uri("karve://client/viewmodel?id=" + Guid.ToString()); ActiveSubSystem(); _initialized = false; }
/// The ctor has been initialized correctly. /// <summary> /// This execute the data payload received from the toolbar /// </summary> /// <param name="services">DataServices</param> /// <param name="manager">Event manager for communicating between view model</param> /// <param name="payLoad">DataPayload to be executed</param> public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad) { _clientDataServices = services.GetClientDataServices(); _payload = payLoad; EventManager = manager; DataServices = services; // FIXME: move to the parent class. _initializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleSaveOrUpdate(payLoad), ExecutedPayloadHandler); }
public DriversControlViewModel(IDataServices services, IRegionManager manager) : base(services) { _regionManager = manager; _clientDataServices = DataServices.GetClientDataServices(); GoBackCommand = new DelegateCommand(GoBack); GoForwardCommand = new DelegateCommand(GoForward); _drivers = new IncrementalList <ClientSummaryExtended>(LoadMoreItems); _notifyTaskCompletion = NotifyTaskCompletion.Create <IEnumerable <ClientSummaryExtended> >(_clientDataServices.GetPagedSummaryDoAsync(0, DefaultPageSize), PagingEvent); }
public void SetUp() { try { _clientDataServices = DataServices.GetClientDataServices(); Assert.NotNull(SqlExecutor); Assert.NotNull(DataServices); } catch (Exception e) { Assert.Fail(e.Message); } }
/// <summary> /// Client control view model. View Model to get the client. /// </summary> /// <param name="configurationService">Configuration service. This service is used to reconfigure dynamically the view model and get enviroment variables</param> /// <param name="eventManager">The event manager implements the mediator design pattern</param> /// <param name="services">Data access layer interface. It provide an abstraction to database access</param> /// <param name="regionManager">The region manager is useful to manage regions and navigate/create new views.</param> public ClientsControlViewModel(IUnityContainer container, IConfigurationService configurationService, IEventManager eventManager, IDataServices services, IRegionManager regionManager) : base(configurationService, eventManager, services, regionManager) { _clientDataServices = services.GetClientDataServices(); _regionManager = regionManager; _mailBoxName = EventSubsystem.ClientSummaryVm; OpenItemCommand = new DelegateCommand <object>(OpenCurrentItem); SortCommand = new DelegateCommand <object>(OnSortCommand); _container = container; InitViewModel(); }
/// <summary> /// Unity /// </summary> /// <param name="unityContainer">Container </param> public TestMainWindowViewModel(IUnityContainer unityContainer, IDataServices dataServices, ISqlExecutor executor) { _clientDataServices = dataServices.GetClientDataServices(); _domainFactory = AbstractDomainWrapperFactory.GetFactory(dataServices); _unityContainer = unityContainer; evSummaryCompleted += OnEventCompleted; SourceView = new IncrementalList <ClientSummaryExtended>(LoadMoreItems) { MaxItemCount = 10000 }; //Controller = _unityContainer.Resolve<RequestController>(); ItemChangedCommand = new DelegateCommand <Dictionary <string, object> >(OnItemChangedCommand); AssistCommand = new DelegateCommand <object>(OnAssistCommand); GridCommand = new DelegateCommand <object>(OnGridFilterCommand); _dataFilterService = new DataFilterSummaryService <ClientSummaryExtended>(null, executor); _dataFilterService.FilterEventResult += _dataFilterService_FilterEventResult; notifyTaskCompletion = NotifyTaskCompletion.Create(_clientDataServices.GetPagedSummaryDoAsync(1, 500), evSummaryCompleted); }
/// <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); }
// singleton factory for the domain. protected AbstractDomainWrapperFactory(IDataServices services) { BuildFactory(services); _services = services; _clientDataServices = _services.GetClientDataServices(); }