Example #1
0
        /// <summary>
        /// Activate (Reopen) a task that's Completed.
        /// </summary>
        public void Activate()
        {
            if (State != TaskState.Completed)
            {
                throw new InvalidOperationException("Only tasks that have" +
                                                    "been completed can be activated.");
            }

            Logger.Debug("Task.Activate ()");
            if (!IsBackendDetached)
            {
                Repository.Activate(this);
            }

            if (Activating != null)
            {
                Activating(this, EventArgs.Empty);
            }
            State          = TaskState.Active;
            CompletionDate = DateTime.MinValue;
            if (Activated != null)
            {
                Activated(this, EventArgs.Empty);
            }
        }
Example #2
0
        public async Task <ActionResult> Activate([FromRoute] long projectId)
        {
            var userId = _currentUserService.GetCurrentUserId();
            await Repository.Activate(projectId, userId);

            await UnitOfWork.Complete();

            return(Ok());
        }
Example #3
0
 public void Activate()
 {
     try
     {
         var item = GenerateModel();
         //сохраняем генерированный объект
         Assert.DoesNotThrow(() => Repository.Save(item));
         //вызов активации серверного объекта
         Assert.DoesNotThrow(() => Repository.Activate(item));
         //Удаляем созданный объект
         Assert.DoesNotThrow(() => Repository.Delete(item));
         //Проверка, что активация сработала
         Assert.IsTrue(item.IsActive);
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex);
         throw;
     }
 }
        private void connectRepository(ConnectionProfile repo)
        {
            //Verbindung zum Repository herstellen
            try
            {
                Repository.RegisterTypes(divMobiTypes());
                Repository.RegisterType(typeof(UserProxy));
                Repository.Activate();
                try
                {
                    String syncIt  = "[" + _userName + "].SyncItem";
                    String fieldSt = "[" + _userName + "].FieldState";
                    if (!MappingDictionary.Mapping.ContainsKey(typeof(SyncItem)))
                    {
                        MappingDictionary.Mapping.Add(typeof(SyncItem), syncIt);
                    }
                    if (!MappingDictionary.Mapping.ContainsKey(typeof(FieldState)))
                    {
                        MappingDictionary.Mapping.Add(typeof(FieldState), fieldSt);
                    }

                    Synchronization.RegisterType(typeof(SyncItem));
                    Synchronization.RegisterType(typeof(FieldState));
                    Synchronization.Activate();
                }
                catch// (Exception syncDBEx)
                {
                    Synchronization = null;
                    MappingDictionary.Mapping.Clear();
                }

                try
                {
                    //Taxon Serializer erstellen

                    Definitions.RegisterType(typeof(TaxonNames));
                    Definitions.RegisterType(typeof(PropertyNames));
                }
                catch //(Exception repTaxEx)
                {
                    Definitions = null;
                }
            }
            catch// (Exception repositoryEx)
            {
                Repository = null;
            }

            var state = State;

            if (Repository != null)
            {
                state |= ConnectionState.ConnectedToRepository;
            }
            if (Definitions != null)
            {
                state |= ConnectionState.ConnectedToRepTax;
            }
            if (Synchronization != null)
            {
                state |= ConnectionState.ConnectedToSynchronization;
            }
            State = state;
        }