/// <summary> /// Default ctor setting services /// </summary> public StockServiceBehavior() { this.m_actRepository = ApplicationContext.Current.GetService <IActRepositoryService>(); this.m_materialRepository = ApplicationContext.Current.GetService <IMaterialRepositoryService>(); this.m_placeRepository = ApplicationContext.Current.GetService <IPlaceRepositoryService>(); this.m_stockService = ApplicationContext.Current.GetService <IStockManagementRepositoryService>(); this.m_gs1Util = new Gs1Util(); }
/// <summary> /// Default ctor setting services /// </summary> public StockServiceBehavior() { this.m_actRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Act> >(); this.m_materialRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Material> >(); this.m_placeRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Place> >(); this.m_stockService = ApplicationServiceContext.Current.GetService <IStockManagementRepositoryService>(); this.m_manufMaterialRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <ManufacturedMaterial> >(); this.m_gs1Util = new Gs1Util(); }
/// <summary> /// Start the daemon /// </summary> public bool Start() { this.Starting?.Invoke(this, EventArgs.Empty); ApplicationServiceContext.Current.Started += (o, e) => { this.m_gs1Util = new Gs1Util(); // Application has started let's bind to the events we need ApplicationServiceContext.Current.GetService <IDataPersistenceService <Act> >().Inserted += (xo, xe) => this.NotifyAct(new Act[] { xe.Data }); ApplicationServiceContext.Current.GetService <IDataPersistenceService <Bundle> >().Inserted += (xo, xe) => this.NotifyAct(xe.Data.Item.OfType <Act>()); }; this.Started?.Invoke(this, EventArgs.Empty); return(true); }
/// <summary> /// Start the daemon /// </summary> public bool Start() { this.Starting?.Invoke(this, EventArgs.Empty); ApplicationContext.Current.Started += (o, e) => { this.m_gs1Util = new Gs1Util(); // Application has started let's bind to the events we need ApplicationContext.Current.GetService <IRepositoryService <Act> >().DataCreated += (xo, xe) => this.NotifyAct(xe.Objects.OfType <Act>()); ApplicationContext.Current.GetService <IRepositoryService <Bundle> >().DataCreated += (xo, xe) => this.NotifyAct(xe.Objects.OfType <Bundle>().SelectMany(i => i.Item.OfType <Act>())); }; this.Started?.Invoke(this, EventArgs.Empty); return(true); }