Ejemplo n.º 1
0
        public virtual WorkItem Add(WorkItem workItem)
        {
            workItem.State = string.IsNullOrWhiteSpace(workItem.ExecutorId) ? WorkItemState.New : WorkItemState.Planned;
            var item = _repository.Add(workItem);

            _repository.SaveChanges();
            return(item);
        }
Ejemplo n.º 2
0
        void IWorkItemService.Create(WorkItem workItem)
        {
            _repository.Add(workItem);

            //任务创建事件
            if (workItem.Status == WorkItemStatus.New)
            {
                this._bus.RaiseWorkItemArrived(new WorkItemArgs(workItem));
            }

            this._log.InfoFormat(
                "创建任务:ID={0}|Actioner={1}|Bookmark={2}|HumanActivityInstanceId={3}|ActivityName={4}|ProcessId={5}|Status={6}"
                , workItem.ID
                , workItem.Actioner.UserName
                , workItem.ActivityInstance.ReferredBookmarkName
                , workItem.ActivityInstance.ID
                , workItem.ActivityInstance.ActivityName
                , workItem.Process.ID
                , workItem.Status);
        }
Ejemplo n.º 3
0
        public WorkItem UpdateWorkItem(WorkItem workItem)
        {
            try
            {
                WorkItem udpatedEntity = null;

                if (workItem.WorkItemId == 0)
                {
                    udpatedEntity = _WorkItemRepository.Add(workItem);
                }
                else
                {
                    udpatedEntity = _WorkItemRepository.Update(workItem);
                }

                return(udpatedEntity);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }