Пример #1
0
 public Comparison(GranularityEnum granularity, MatchEnum matchType, long newPosition, string newData, long oldPosition, string oldData)
 {
     _granularity = granularity;
     _matchType   = matchType;
     _newPosition = newPosition;
     _newData     = newData;
     _oldPosition = OldPosition;
     _oldData     = oldData;
 }
Пример #2
0
        public Package GetPackageById(long iPackageId, GranularityEnum iGranularity)
        {
            if (iPackageId < 1)
            {
                throw new Exception("L'id du package n'est pas valide");
            }

            var thePackage = DBReleaseDataService.GetPackageById(iPackageId).Convert();

            if (iGranularity == GranularityEnum.Full)
            {
                //Deployement
                thePackage.Deployements = GetDeployementByPackageId(iPackageId);

                //MainTask
                thePackage.MainTasks = GetMaintaskListByPackageId(iPackageId).Enum().Where(x => x.Status != MainTaskStatusEnum.Canceled).Enum().ToList();

                //ProjectTask
                thePackage.SubTasks = new List <SubTask>();
                foreach (var mainTaskItem in thePackage.MainTasks.Enum())
                {
                    mainTaskItem.SubTasks = GetSubTaskByMainTaskId(mainTaskItem.MainTaskId);
                    thePackage.SubTasks.AddRange(mainTaskItem.SubTasks);
                }
            }
            else if (iGranularity == GranularityEnum.Partial1)
            {
                //MainTask
                thePackage.MainTasks = GetMaintaskListByPackageId(iPackageId).Enum().Where(x => x.Status != MainTaskStatusEnum.Canceled).Enum().ToList();

                //ProjectTask
                thePackage.SubTasks = new List <SubTask>();
                foreach (var mainTaskItem in thePackage.MainTasks.Enum())
                {
                    mainTaskItem.SubTasks = GetSubTaskByMainTaskId(mainTaskItem.MainTaskId);
                    thePackage.SubTasks.AddRange(mainTaskItem.SubTasks);
                }
            }

            return(thePackage);
        }
        public MainTask GetMainTaskById(long iMainTaskId, GranularityEnum iGranularity)
        {
            if (iMainTaskId < 1)
            {
                throw new Exception("L'id de la tâche est invalide");
            }

            //MainTask
            var entity      = DBReleaseDataService.GetMainTaskById(iMainTaskId);
            var theMainTask = entity.Convert();

            if (theMainTask == null)
            {
                return(null);
            }

            if (iGranularity == GranularityEnum.Full)
            {
                //SubTask
                theMainTask.SubTasks = GetSubTaskByMainTaskId(iMainTaskId);

                //Package
                if (theMainTask.PackageId != null)
                {
                    theMainTask.Package = GetPackageById((long)theMainTask.PackageId, GranularityEnum.Full);
                }

                //ProductLine
                theMainTask.ProductLines = GetProductLineByMainTaskId(theMainTask.MainTaskId);

                //ExternalProject
                if (theMainTask.ExternalProjectId != null)
                {
                    theMainTask.ExternalProject = GetExternalProject((long)theMainTask.ExternalProjectId);
                }
            }

            return(theMainTask);
        }
        public List <MainTask> GetDevMainTasks(GranularityEnum iGranularity)
        {
            var query = DBReleaseDataService.GetQuery <T_E_MainTask>(null).Where(x => x.StatusRef == (short)MainTaskStatusEnum.Dev).Enum().ToList();

            return(query.Select(x => GetMainTaskById(x.MainTaskId, iGranularity)).Enum().ToList());
        }
        public Tuple <List <MainTask>, int> GetMainTaskList(MainTaskStatusSearchEnum iMainTasksSearchEnum, MainTaskOrderByEnum iOrderBy, Guid?iProjectGUID, long?iProductLineId, MainTaskTypeEnum?iMainTaskType, Guid?iDevelopperGuid, long?iPackageId, int iSkip, int iTake, GranularityEnum iGranularity, long?iExternalProjectId)
        {
            if (iTake < 1)
            {
                throw new Exception("Le nombre à prendre est invalide");
            }

            //Choix de la table
            IQueryable <T_E_MainTask> theQuery = DBReleaseDataService.GetQuery <T_E_MainTask>(null);

            //Statut
            if (iMainTasksSearchEnum != MainTaskStatusSearchEnum.All)
            {
                if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.Canceled)
                {
                    theQuery = theQuery.Where(x => x.StatusRef == (short)MainTaskStatusEnum.Canceled);
                }
                else if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.Completed)
                {
                    theQuery = theQuery.Where(x => x.StatusRef == (short)MainTaskStatusEnum.Completed);
                }
                else if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.InProgress)
                {
                    theQuery = theQuery.Where(x => x.StatusRef == (short)MainTaskStatusEnum.Dev || x.StatusRef == (short)MainTaskStatusEnum.Staging);
                }
                else if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.Request)
                {
                    theQuery = theQuery.Where(x => x.StatusRef == (short)MainTaskStatusEnum.Requested);
                }
                else if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.Waiting)
                {
                    theQuery = theQuery.Where(x => x.StatusRef == (short)MainTaskStatusEnum.Waiting);
                }
                else if (iMainTasksSearchEnum == MainTaskStatusSearchEnum.NotCompleted)
                {
                    theQuery = theQuery.Where(x => x.StatusRef != (short)MainTaskStatusEnum.Completed && x.StatusRef != (short)MainTaskStatusEnum.Canceled);
                }
                else
                {
                    throw new NotSupportedException(iMainTasksSearchEnum.ToStringWithEnumName());
                }
            }

            //Gamme,
            if (iProductLineId != null)
            {
                theQuery = theQuery.Where(x => x.T_E_ProductLineTask.Any(y => y.ProductLineId == (long)iProductLineId));
            }

            //Project
            if (iProjectGUID != null)
            {
                theQuery = theQuery.Where(x => x.T_E_SubTask.Any(y => y.ProjectGUID == iProjectGUID));
            }

            //Tasktype
            if (iMainTaskType != null)
            {
                theQuery = theQuery.Where(x => x.TaskTypeRef == (short)iMainTaskType);
            }

            //Developper
            if (iDevelopperGuid != null)
            {
                theQuery = theQuery.Where(x => x.T_E_SubTask.Any(y => y.DevelopperGUID == iDevelopperGuid));
            }

            //Package
            if (iPackageId != null)
            {
                theQuery = theQuery.Where(x => x.PackageId == iPackageId);
            }

            //External project
            if (iExternalProjectId != null)
            {
                theQuery = theQuery.Where(x => x.ExternalProjectId == iExternalProjectId);
            }

            var totalCount = theQuery.Count();
            List <T_E_MainTask> entities;

            if (iOrderBy == MainTaskOrderByEnum.MainTaskId)
            {
                entities = theQuery.OrderBy(x => x.MainTaskId).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.DateObjectif)
            {
                entities = theQuery.OrderByDescending(x => x.ObjectifCloseDate.HasValue).ThenBy(x => x.ObjectifCloseDate).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.TaskPriority)
            {
                entities = theQuery.OrderByDescending(x => x.Priority.HasValue).ThenBy(x => x.Priority).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.PackagePriority)
            {
                entities = theQuery.OrderByDescending(x => x.T_E_Package.Priority.HasValue).ThenBy(x => x.T_E_Package.Priority).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.ProjectNumber)
            {
                entities = theQuery.OrderByDescending(x => x.T_E_ExternalProject.ProjectNumber).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.CreationDate)
            {
                entities = theQuery.OrderByDescending(x => x.CreationDate).Skip(iSkip).Take(iTake).ToList();
            }
            else if (iOrderBy == MainTaskOrderByEnum.ProductionDeployementDate)
            {
                var environmentProductionShort = (short)EquinoxeExtend.Shared.Enum.EnvironmentEnum.Production;
                entities = theQuery.OrderByDescending(x => x.T_E_Package.T_E_Deployement.Where(y => y.EnvironmentDestinationRef == environmentProductionShort).OrderByDescending(t => t.DeployementDate).FirstOrDefault().DeployementDate).Skip(iSkip).Take(iTake).ToList();
            }
            else
            {
                throw new NotSupportedException(iOrderBy.ToStringWithEnumName());
            }

            if (entities.IsNotNullAndNotEmpty())
            {
                var result = new List <MainTask>();

                if (iGranularity == GranularityEnum.Full)
                {
                    foreach (var mainTaskItem in entities)
                    {
                        result.Add(GetMainTaskById(mainTaskItem.MainTaskId, iGranularity));
                    }
                }
                else if (iGranularity == GranularityEnum.Nude)
                {
                    result = entities.Select(x => x.Convert()).ToList();
                }

                return(new Tuple <List <MainTask>, int>(result, totalCount));
            }
            return(null);
        }