public IEnumerable <WFTrackerTable> GetCurrentStep(Expression <Func <WFTrackerTable, bool> > predicate) { WFTrackerTable endStep = repo.FindAll(predicate).OrderByDescending(x => x.LineNum).FirstOrDefault(); if (endStep != null) { if (endStep.ParallelID != String.Empty) { IEnumerable <WFTrackerTable> alltrack = repo.FindAll(x => x.DocumentTableId == endStep.DocumentTableId).Where(b => b.ParallelID == endStep.ParallelID); if (alltrack.Any(x => x.TrackerType == TrackerType.Cancelled) && endStep.DocumentTable.DocumentState != DocumentState.Agreement) { return(null); } IEnumerable <WFTrackerTable> trackers = repo.FindAll(predicate).Where(b => b.ParallelID == endStep.ParallelID).OrderByDescending(x => x.LineNum); return(trackers); } else { return(repo.FindAll(predicate).Where(b => b.TrackerType == TrackerType.Waiting).OrderByDescending(x => x.LineNum)); } } else { return(null); } }
public DateTime?GetLastSignDate(Guid documentId, bool SLAOffset = false, string currentUserName = "") { IEnumerable <WFTrackerTable> items = GetCurrentSignStep(documentId, currentUserName); WFTrackerTable item = items.FirstOrDefault(x => x.SLAOffset > 0); if (item != null) { return(item.CreatedDate.AddHours(item.SLAOffset)); } return(null); }
public void SaveTrackList(Guid documentId, List <Array> allSteps) { foreach (string[] step in allSteps) { WFTrackerTable trackerTable = new WFTrackerTable(); trackerTable.ActivityName = step[0]; trackerTable.ActivityID = step[1]; trackerTable.ParallelID = step[2]; trackerTable.DocumentTableId = documentId; trackerTable.TrackerType = TrackerType.NonActive; SaveDomain(trackerTable); } }
public void CreateTrackerRecord(DocumentState step, Guid documentId, string bookmarkName, List <WFTrackerUsersTable> listUser, string currentUser, string activityId, bool useManual, int slaOffset, bool executionStep) { if ((step != DocumentState.Cancelled) && (step != DocumentState.Closed)) { WFTrackerTable trackerTable = _WorkflowTrackerService.FirstOrDefault(x => x.ActivityID == activityId && x.DocumentTableId == documentId); trackerTable.ActivityName = bookmarkName.Replace(keyForStep, ""); trackerTable.Users = listUser; trackerTable.TrackerType = TrackerType.Waiting; trackerTable.ManualExecutor = useManual; trackerTable.SLAOffset = slaOffset; trackerTable.ExecutionStep = executionStep; _WorkflowTrackerService.SaveDomain(trackerTable, currentUser); } }
public void SaveDomain(WFTrackerTable domainTable, string currentUserName = "") { string localUserName = getCurrentUserName(currentUserName); ApplicationUser user = _AccountService.FirstOrDefault(x => x.UserName == localUserName); if (domainTable.Id == Guid.Empty) { domainTable.CreatedDate = DateTime.UtcNow; domainTable.ModifiedDate = domainTable.CreatedDate; domainTable.ApplicationUserCreatedId = user.Id; domainTable.ApplicationUserModifiedId = user.Id; repo.Add(domainTable); } else { domainTable.ModifiedDate = DateTime.UtcNow; domainTable.ApplicationUserModifiedId = user.Id; repo.Update(domainTable); } _uow.Save(); }
public ActionResult AddExecutor(Guid id, string activityId, string[] listdata, bool?isAjax) { if (isAjax == true) { WFTrackerTable tracker = _WorkflowTrackerService.FirstOrDefault(x => x.DocumentTableId == id && x.ActivityID == activityId); if (tracker != null) { ApplicationUser userTable = _AccountService.FirstOrDefault(x => x.UserName == User.Identity.Name); if (userTable == null) { return(HttpNotFound()); } foreach (string data in listdata) { if (tracker.Users.Exists(x => x.UserId == data) == false) { _EmailService.SendNewExecutorEmail(id, data); } } tracker.Users.RemoveAll(x => x.InitiatorUserId != null); if (listdata != null) { foreach (string data in listdata) { tracker.Users.Add(new WFTrackerUsersTable { UserId = data, InitiatorUserId = userTable.Id }); } } _WorkflowTrackerService.SaveDomain(tracker); } } return(RedirectToAction("ShowDocument", new { id = id })); }
public ActionResult AddExecutor(Guid id, string activityId) { ViewBag.DocumentId = id; var empls = _EmplService.GetPartialIntercompanyView(x => x.ApplicationUserId != null); WFTrackerTable tracker = _WorkflowTrackerService.FirstOrDefault(x => x.ActivityID == activityId && x.DocumentTableId == id); if (tracker.Users != null) { foreach (var empl in empls) { foreach (var user in tracker.Users) { if (empl.ApplicationUserId == user.UserId) { empl.isActiveDualList = true; } } } } return(View(empls)); }