Ejemplo n.º 1
0
        public List <UserProcessViewModel> TargetProcessListForCancel(int WorkFlowTraceId)
        {
            var birimdekiTumWorkFlowTraceler = _workFlowDataService.GetWorkFlowTraceList();

            UserProcessViewModel kullaniciWorkFlowTrace =
                birimdekiTumWorkFlowTraceler
                .Where(x => x.Id == WorkFlowTraceId)
                .FirstOrDefault();

            var tumIslemler =
                birimdekiTumWorkFlowTraceler
                .Where(x => x.OwnerId == kullaniciWorkFlowTrace.OwnerId && x.ProcessStatus == Common.Enums.ProcessStatus.Completed && x.Id < WorkFlowTraceId)
                .OrderByDescending(x => x.Id);

            List <UserProcessViewModel> oncekiWorkFlowTraceListesi = new List <UserProcessViewModel>();
            var taskId = kullaniciWorkFlowTrace.TaskId;//WorkFlowTrace.GorevWorkFlowTrace.GorevId;
            var WorkFlowTraceiYapanRol    = kullaniciWorkFlowTrace.AssignedRole;
            var gorevWorkFlowTraceId      = kullaniciWorkFlowTrace.ProcessId;
            var gorevWorkFlowTraceListesi = _workFlowDataService.GetWorkFlowProcessList(taskId);

            foreach (var oncekiIslem in tumIslemler)
            {
                ProcessVM gorevWorkFlowTrace = gorevWorkFlowTraceListesi.SingleOrDefault(x => x.Id == oncekiIslem.ProcessId);

                if (gorevWorkFlowTrace.AssignedRole == ProjectRole.System)
                {
                    continue;
                }
                if (gorevWorkFlowTrace.AssignedRole != WorkFlowTraceiYapanRol)
                {
                    break;
                }

                if (gorevWorkFlowTrace.IsCondition)
                {
                    gorevWorkFlowTrace = gorevWorkFlowTraceListesi.SingleOrDefault(x => x.Id == oncekiIslem.ConditionOptionId);
                }

                if (oncekiIslem.ProcessId != gorevWorkFlowTraceId && !oncekiWorkFlowTraceListesi.Any(x => oncekiIslem.ProcessId == x.ProcessId))
                {
                    List <int> elementOfTree = new List <int>();
                    if (!SearchProcessInsideNextPath(elementOfTree, gorevWorkFlowTraceListesi, gorevWorkFlowTraceId, oncekiIslem.ProcessId))
                    {
                        oncekiWorkFlowTraceListesi.Add(oncekiIslem);
                    }
                }
            }
            return(oncekiWorkFlowTraceListesi.OrderBy(x => x.Id).ToList());
        }
Ejemplo n.º 2
0
        public List <WorkFlowTraceVM> ProgressProcessList(int workFlowTraceId)
        {
            UserProcessViewModel kullaniciWorkFlowTrace =
                _workFlowDataService
                .GetWorkFlowTraceList()
                .Single(x => x.Id == workFlowTraceId);

            ProcessVM sonrakiGorev = null;


            var processList = _workFlowDataService.GetWorkFlowProcessList(kullaniciWorkFlowTrace.TaskId);

            if (kullaniciWorkFlowTrace.NextProcessId != null)
            {
                sonrakiGorev =
                    processList
                    .Where(x => x.Id == (int)kullaniciWorkFlowTrace.NextProcessId)
                    .FirstOrDefault();
            }


            var workFlowTraceListesi = WorkFlowTraceList(kullaniciWorkFlowTrace.OwnerId);

            List <WorkFlowTraceVM> tumWorkFlowTraceler = workFlowTraceListesi
                                                         .OrderBy(x => x.LastlyModifiedTime)
                                                         .Select(x => new WorkFlowTraceVM
            {
                Description       = x.ProcessDescription,
                ProcessName       = x.ProcessName,
                ProcessId         = x.ProcessId,
                ProcessStatus     = x.ProcessStatus,
                ConditionOptionId = x.ConditionOptionId,
                OwnerId           = x.OwnerId,
                AssignedRole      = x.AssignedRole,
                Id = x.Id
            })
                                                         .ToList();
            List <WorkFlowTraceVM> progressGosterilecekWorkFlowTraceler = new List <WorkFlowTraceVM>();

            if (tumWorkFlowTraceler.Count() > 1)
            {
                for (int i = 0; i < tumWorkFlowTraceler.Count(); i++)
                {
                    if ((i + 1) < tumWorkFlowTraceler.Count() && tumWorkFlowTraceler[i + 1].Id == workFlowTraceId)
                    {
                        progressGosterilecekWorkFlowTraceler.Add(tumWorkFlowTraceler[i]);
                        progressGosterilecekWorkFlowTraceler.Add(tumWorkFlowTraceler[i + 1]);
                        break;
                    }
                }
            }
            else
            {
                progressGosterilecekWorkFlowTraceler.Add(tumWorkFlowTraceler[0]);
            }


            if (sonrakiGorev != null)
            {
                progressGosterilecekWorkFlowTraceler.Add(new WorkFlowTraceVM
                {
                    ProcessStatus = null,
                    AssignedRole  = sonrakiGorev.AssignedRole,
                    Description   = sonrakiGorev.Description,
                    ProcessName   = sonrakiGorev.Name
                });
            }

            return(progressGosterilecekWorkFlowTraceler);
        }