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; } }
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); } }
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); } }
public ResultOperation Add(sysBpmsElement Element) { ResultOperation resultOperation = new ResultOperation(); if (resultOperation.IsSuccess) { this.UnitOfWork.Repository <IElementRepository>().Add(Element); this.UnitOfWork.Save(); } return(resultOperation); }
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); }
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; }
/// <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); } } }
public void Add(sysBpmsElement element) { this.Context.sysBpmsElements.Add(element); }