public override bool Exists(out IActiveService activeService) { activeService = dbContext.Subscriptions.Where( sub => sub.HandlerName == HandlerName && sub.UserId == userId ).FirstOrDefault(); return(activeService != null); }
public override bool Exists(out IActiveService activeService) { activeService = dbContext.SpecialOffers .Where(so => so.PlaceId == objectId && so.HandlerName == this.HandlerName ) .FirstOrDefault(); return(activeService != null); }
public IService CreateExisting(IActiveService entityService) { //Get definition from database var serviceDefinition = _dbContext.Services.Where(s => s.HandlerName == entityService.HandlerName).FirstOrDefault(); if (serviceDefinition == null) { throw new Exception("Handler not found: " + entityService.HandlerName); } //Create a new instance based on definition.HandlerName var service = (IService)Activator.CreateInstance(null, "Vacation24.Services." + serviceDefinition.HandlerName); service.Init(_dbContext, serviceDefinition, entityService); return(service); }
public void RegisterService(IService service) { try { Services.Add(service.GetType(), service); IActiveService active = service as IActiveService; if (active != null) { ActiveServices.Add(active.GetType(), active); } } catch (ArgumentException ex) { throw new ArgumentException(string.Format(ErrorMessages.DuplicateServiceMessage, service.GetType().ToString()), ex); } }
public MainViewModel(INotificationService notificationService, ILoggingService loggingService, IConfigSerializer configSerializer, ILoadingProgressController loadingProgressController, ITestsService testsService, IGitWorker gitWorker, IPlatformProvider platformProvider, IActiveService isActiveService, ITestsService testService) { dispatcher = Dispatcher.CurrentDispatcher; this.notificationService = notificationService; this.loggingService = loggingService; this.configSerializer = configSerializer; this.platformProvider = platformProvider; this.isActiveService = isActiveService; this.testService = testService; this.gitWorker = gitWorker; obsolescenceTracker = new RepositoryObsolescenceTracker(this.gitWorker, () => _config.Repositories, NoticeRepositoryObsolescenceAsync); LoadingProgressController = loadingProgressController; testService = testsService; testService.PropertyChanged += TestService_PropertyChanged; loggingService.MessageReserved += OnLoggingMessageReserved; }
public abstract bool Exists(out IActiveService activeService);
public virtual void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity) { name = baseEntity.Name; price = baseEntity.Price; dbContext = context; activeEntity = (TEntity)activeServiceEntity; }
public override void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity) { base.Init(context, baseEntity, activeServiceEntity); objectId = activeEntity.PlaceId; }
public override void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity) { base.Init(context, baseEntity, activeServiceEntity); userId = activeEntity.UserId; }
/// <summary> /// 注入service /// </summary> public ActiveController(IActiveService service) { _service = service; }