Exemple #1
0
 public override bool Exists(out IActiveService activeService)
 {
     activeService = dbContext.Subscriptions.Where(
         sub =>
         sub.HandlerName == HandlerName &&
         sub.UserId == userId
         ).FirstOrDefault();
     return(activeService != null);
 }
Exemple #2
0
 public override bool Exists(out IActiveService activeService)
 {
     activeService = dbContext.SpecialOffers
                     .Where(so =>
                            so.PlaceId == objectId &&
                            so.HandlerName == this.HandlerName
                            )
                     .FirstOrDefault();
     return(activeService != null);
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
 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;
 }
Exemple #6
0
 public abstract bool Exists(out IActiveService activeService);
Exemple #7
0
        public virtual void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity)
        {
            name  = baseEntity.Name;
            price = baseEntity.Price;

            dbContext    = context;
            activeEntity = (TEntity)activeServiceEntity;
        }
Exemple #8
0
        public override void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity)
        {
            base.Init(context, baseEntity, activeServiceEntity);

            objectId = activeEntity.PlaceId;
        }
Exemple #9
0
        public override void Init(IPaymentServicesContext context, Service baseEntity, IActiveService activeServiceEntity)
        {
            base.Init(context, baseEntity, activeServiceEntity);

            userId = activeEntity.UserId;
        }
Exemple #10
0
 /// <summary>
 /// 注入service
 /// </summary>
 public ActiveController(IActiveService service)
 {
     _service = service;
 }