/// <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> /// Execute the payload when the user press to save and it notifies the /// </summary> /// <param name="services">Data services are used to store the data.</param> /// <param name="manager">Event manager is used to notify the caller and refresh data.</param> /// <param name="payLoad">Payload to be updated</param> public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad) { CurrentEventManager = manager; CurrentPayload = payLoad; DataServices = services ?? throw new ArgumentNullException($"Cannot save without DataServices"); ToolbarInitializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleSaveOrUpdate(payLoad), ExecutedPayloadHandler); _invoiceDataServices = services.GetInvoiceDataServices(); }
public void SetUp() { try { _sqlExecutor = SetupSqlQueryExecutor(); _dataServices = new DataServiceImplementation(_sqlExecutor); _invoiceDataService = _dataServices.GetInvoiceDataServices(); } catch (Exception e) { Assert.Fail(e.Message); } }
/// <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); }
/// <summary> /// Control the invoce control view model. /// </summary> /// <param name="dataServices">Data Services</param> /// <param name="container">Unity container</param> /// <param name="service">Service</param> /// <param name="manager">Region Manager</param> /// <param name="requestService">Request service</param> /// <param name="eventManager">Event manager</param> public InvoiceControlViewModel(IDataServices dataServices, IUnityContainer container, IDialogService service, IRegionManager manager, IInteractionRequestController requestService, IEventManager eventManager) : base(dataServices, requestService, service, eventManager) { _regionManager = manager; IsBusy = false; _container = container; OpenItemCommand = new DelegateCommand <object>(OpenCurrentItem); InitViewModel(); ItemName = "Facturas"; ShowClientCommand = new DelegateCommand <object>(OnShowClient); _invoiceDataServices = DataServices.GetInvoiceDataServices(); ViewModelUri = new Uri("karve://invoice/viewmodel?id=" + UniqueId); MailboxName = ViewModelUri.ToString(); EventManager.RegisterObserverSubsystem(InvoiceModule.InvoiceSubSystem, this); RegisterMailBox(ViewModelUri.ToString()); StartAndNotify(); }