コード例 #1
0
        private void EvaluateNextRecursiveItem(sysBpmsElement element, List <sysBpmsTask> list)
        {
            switch ((sysBpmsElement.e_TypeLU)element.TypeLU)
            {
            case sysBpmsElement.e_TypeLU.Event:
                this.GetRecursiveBeginElements(element.ID, element.ProcessID, list);
                break;

            case sysBpmsElement.e_TypeLU.Gateway:
                this.GetRecursiveBeginElements(element.ID, element.ProcessID, list);
                break;

            case sysBpmsElement.e_TypeLU.Task:
                sysBpmsTask task = this.Context.sysBpmsTasks.AsNoTracking().FirstOrDefault(c => c.ProcessID == element.ProcessID && c.ElementID == element.ID);
                switch ((sysBpmsTask.e_TypeLU)task.TypeLU)
                {
                case sysBpmsTask.e_TypeLU.ServiceTask:
                    this.GetRecursiveBeginElements(task.ElementID, element.ProcessID, list);
                    break;

                case sysBpmsTask.e_TypeLU.UserTask:
                    list.Add(task);
                    break;
                }
                break;
            }
        }
コード例 #2
0
 private void GetRecursiveBeginElements(string elementID, Guid processId, List <sysBpmsTask> list)
 {
     foreach (sysBpmsSequenceFlow item in this.Context.sysBpmsSequenceFlows.Where(c => c.SourceElementID == elementID).AsNoTracking().ToList())
     {
         sysBpmsElement element = this.Context.sysBpmsElements.AsNoTracking().FirstOrDefault(c => c.ProcessID == processId && c.ID == item.TargetElementID);
         this.EvaluateNextRecursiveItem(element, list);
     }
 }
コード例 #3
0
        public void Delete(string elementId, Guid processId)
        {
            sysBpmsElement Element = this.Context.sysBpmsElements.FirstOrDefault(d => d.ID == elementId && d.ProcessID == processId);

            if (Element != null)
            {
                this.Context.sysBpmsElements.Remove(Element);
            }
        }
コード例 #4
0
        public ResultOperation Add(sysBpmsElement Element)
        {
            ResultOperation resultOperation = new ResultOperation();

            if (resultOperation.IsSuccess)
            {
                this.UnitOfWork.Repository <IElementRepository>().Add(Element);
                this.UnitOfWork.Save();
            }
            return(resultOperation);
        }
コード例 #5
0
        public ResultOperation Update(sysBpmsElement element)
        {
            ResultOperation resultOperation = new ResultOperation();

            if (resultOperation.IsSuccess)
            {
                element.Name = element.Name.ToStringObj().Trim();
                this.UnitOfWork.Repository <IElementRepository>().Update(element);
                this.UnitOfWork.Save();
            }
            return(resultOperation);
        }
コード例 #6
0
        public void Update(sysBpmsElement element)
        {
            //To fix 'Attaching an entity failed' error.
            var local = this.Context.Set <sysBpmsElement>().Local.FirstOrDefault(f => f.ID == element.ID);

            if (local != null)
            {
                this.Context.Entry(local).State = EntityState.Detached;
                local = null;
            }

            this.Context.Entry(element.Clone()).State = EntityState.Modified;
        }
コード例 #7
0
 /// <summary>
 /// used for finding all tasks from an inclusive gateway element to start event.
 /// </summary>
 /// <param name="element">first time it is inclusive gateway</param>
 private void GetRecursiveTraceToStart(sysBpmsElement element, List <string> listTaskID,
                                       List <string> listEvaluatedID, List <sysBpmsElement> listElement,
                                       List <sysBpmsSequenceFlow> listSequenceFlow, List <string> listTracedItems)
 {
     if (listEvaluatedID.Contains(element.ID))
     {
         return;
     }
     if (element.TypeLU == (int)sysBpmsElement.e_TypeLU.Event)
     {
         sysBpmsEvent sysBpmsEvent = new EventService().GetInfo(element.ID, element.ProcessID);
         if (sysBpmsEvent.TypeLU != (int)sysBpmsEvent.e_TypeLU.IntermediateThrow || sysBpmsEvent.TypeLU != (int)sysBpmsEvent.e_TypeLU.IntermediateCatch)
         {
             return;
         }
     }
     if (element.TypeLU == (int)sysBpmsElement.e_TypeLU.Task)
     {
         if (!listTaskID.Contains(element.ID))
         {
             listTaskID.Add(element.ID);
         }
     }
     if (element.TypeLU == (int)sysBpmsElement.e_TypeLU.Event ||
         element.TypeLU == (int)sysBpmsElement.e_TypeLU.Gateway)
     {
         listTracedItems.Add(element.ID);
     }
     foreach (sysBpmsSequenceFlow item in listSequenceFlow.Where(c => c.SourceElementID != element.ID && c.TargetElementID == element.ID))
     {
         if (!listTracedItems.Any(c => c == item.SourceElementID))
         {
             this.GetRecursiveTraceToStart(listElement.FirstOrDefault(c => c.ID == item.SourceElementID), listTaskID, listEvaluatedID, listElement, listSequenceFlow, listTracedItems);
         }
     }
 }
コード例 #8
0
 public void Add(sysBpmsElement element)
 {
     this.Context.sysBpmsElements.Add(element);
 }