Exemplo n.º 1
0
        /// <summary>
        /// Запомнить участников ознакомления.
        /// </summary>
        public void StoreAcquainters()
        {
            if (!_obj.Status.HasValue || _obj.Status.Value == Workflow.Task.Status.Aborted)
            {
                return;
            }

            var participants = AcquaintanceTaskParticipants.GetAll().FirstOrDefault(x => x.TaskId == _obj.Id);

            if (participants != null)
            {
                AcquaintanceTaskParticipants.Delete(participants);
            }

            participants        = AcquaintanceTaskParticipants.Create();
            participants.TaskId = _obj.Id;

            var employees = Functions.AcquaintanceTask.GetParticipants(_obj);

            foreach (var employee in employees)
            {
                var participant = participants.Employees.AddNew();
                participant.Employee = employee;
            }
            participants.Save();
        }
Exemplo n.º 2
0
        public override void BeforeRestart(Sungero.Workflow.Server.BeforeRestartEventArgs e)
        {
            // Очистить таблицу с номером версии и хешем документа.
            _obj.AcquaintanceVersions.Clear();
            var participants = AcquaintanceTaskParticipants.GetAll().FirstOrDefault(x => x.TaskId == _obj.Id);

            if (participants != null)
            {
                participants.Employees.Clear();
            }
        }
Exemplo n.º 3
0
 public override void AfterDelete(Sungero.Domain.AfterDeleteEventArgs e)
 {
     // Удалить список участников ознакомления, соответствующий задаче.
     if (_obj != null)
     {
         var participants = AcquaintanceTaskParticipants.GetAll().FirstOrDefault(x => x.TaskId == _obj.Id);
         if (participants != null)
         {
             AcquaintanceTaskParticipants.Delete(participants);
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Получить список конечных исполнителей ознакомления на момент отправки.
        /// </summary>
        /// <param name="task">Ознакомление.</param>
        /// <returns>Список сотрудников на момент отправки задачи.</returns>
        public static IEnumerable <IEmployee> GetEmployeesFromParticipants(IAcquaintanceTask task)
        {
            // Заполнение AcquaintanceTaskParticipants происходит в схеме.
            // От старта задачи до начала обработки схемы там ничего не будет - взять из исполнителей задачи.
            var storedParticipants = AcquaintanceTaskParticipants.GetAll().FirstOrDefault(x => x.TaskId == task.Id);

            if (storedParticipants != null)
            {
                return(storedParticipants.Employees.Select(p => p.Employee).ToList());
            }

            return(Functions.AcquaintanceTask.GetParticipants(task));
        }