public List <ExternalProject> GetExternalProjectList(ExternalProjectStatusSearchEnum iExternalProjectStatusSearchEnum) { IQueryable <T_E_ExternalProject> theQuery = DBReleaseDataService.GetQuery <T_E_ExternalProject>(null); if (iExternalProjectStatusSearchEnum != ExternalProjectStatusSearchEnum.All) { if (iExternalProjectStatusSearchEnum == ExternalProjectStatusSearchEnum.Completed) { theQuery = theQuery.Where(x => x.StatusRef == (short)ExternalProjectStatusEnum.Completed); } else if (iExternalProjectStatusSearchEnum == ExternalProjectStatusSearchEnum.InProgress) { theQuery = theQuery.Where(x => x.StatusRef == (short)ExternalProjectStatusEnum.InProgress); } else if (iExternalProjectStatusSearchEnum == ExternalProjectStatusSearchEnum.Waiting) { theQuery = theQuery.Where(x => x.StatusRef == (short)ExternalProjectStatusEnum.Waiting); } else if (iExternalProjectStatusSearchEnum == ExternalProjectStatusSearchEnum.UnProcessed) { theQuery = theQuery.Where(x => x.IsProcessed == false); } else { throw new NotSupportedException(iExternalProjectStatusSearchEnum.ToStringWithEnumName()); } } return(theQuery.ToList().Enum().OrderBy(x => x.ProjectNumber).Enum().Select(x => x.Convert()).Enum().ToList()); }
public List <Deployement> GetDeployementByPackageId(long iPackageId) { if (iPackageId < 1) { throw new Exception("L'id du package n'est pas valide"); } return(DBReleaseDataService.GetQuery <T_E_Deployement>(null).Where(x => x.PackageId == iPackageId).Enum().Select(x => x.Convert()).Enum().OrderBy(x => x.DeployementDate).Enum().ToList()); }
public Deployement GetDeployementById(long iDeployementId) { var query = DBReleaseDataService.GetQuery <T_E_Deployement>(null).SingleOrDefault(x => x.DeployementId == iDeployementId); if (query != null) { return(query.Convert()); } else { return(null); } }
public List <Package> GetPackageOrderByDeployementList(DeployementSearchEnum iDeployementSearch, bool iIsDescending) { var theQuery = DBReleaseDataService.GetQuery <T_E_Deployement>(null); //Env if (iDeployementSearch == DeployementSearchEnum.Production) { theQuery = theQuery.Where(x => x.EnvironmentDestinationRef == (short)PackageStatusEnum.Production); } else if (iDeployementSearch == DeployementSearchEnum.Staging) { theQuery = theQuery.Where(x => x.EnvironmentDestinationRef == (short)PackageStatusEnum.Staging); } else if (iDeployementSearch == DeployementSearchEnum.All) { //Ne rien filtrer } else { throw new Exception(iDeployementSearch.ToStringWithEnumName()); } //Order if (iIsDescending) { theQuery = theQuery.OrderByDescending(x => x.DeployementDate); } else { theQuery = theQuery.OrderBy(x => x.DeployementDate); } var deploiement = theQuery.ToList(); var result = new List <Package>(); //Enrichissement package avec un seul deploiement foreach (var item in deploiement.Enum()) { var thePackage = GetPackageById(item.PackageId, GranularityEnum.Partial1); //deployement thePackage.Deployements = new List <Deployement>(); thePackage.Deployements.Add(GetDeployementById(item.DeployementId)); result.Add(thePackage); } return(result); }
public void MoveDownMainTaskPriority(MainTask iMainTask) { if (iMainTask == null) { throw new Exception("La tâche est nulle"); } if (iMainTask.Priority < 0) { throw new Exception("La priorité doit être positive"); } using (var ts = new TransactionScope()) { var theTask = DBReleaseDataService.GetMainTaskById(iMainTask.MainTaskId); T_E_MainTask followingTask = null; int? thePriority; if (theTask.Priority != null) { thePriority = theTask.Priority + 1; followingTask = DBReleaseDataService.GetSingleOrDefault <T_E_MainTask>(x => x.Priority == iMainTask.Priority + 1); } else { var lastPriority = DBReleaseDataService.GetQuery <T_E_MainTask>(null).Max(x => x.Priority); if (lastPriority == null) { thePriority = 1; } else { thePriority = lastPriority + 1; } } theTask.Priority = thePriority; DBReleaseDataService.Update(theTask); if (followingTask != null) { followingTask.Priority -= 1; DBReleaseDataService.Update(followingTask); } ts.Complete(); } }
public void MoveDownPackagePriority(Package iPackage) { if (iPackage == null) { throw new Exception("La tâche est nulle"); } if (iPackage.Priority < 0) { throw new Exception("La priorité doit être positive"); } using (var ts = new TransactionScope()) { var thePackage = DBReleaseDataService.GetPackageById(iPackage.PackageId); T_E_Package followingPackage = null; int? thePriority; if (thePackage.Priority != null) { thePriority = thePackage.Priority + 1; followingPackage = DBReleaseDataService.GetSingleOrDefault <T_E_Package>(x => x.Priority == iPackage.Priority + 1); } else { var lastPriority = DBReleaseDataService.GetQuery <T_E_Package>(null).Max(x => x.Priority); if (lastPriority == null) { thePriority = 1; } else { thePriority = lastPriority + 1; } } thePackage.Priority = thePriority; DBReleaseDataService.Update(thePackage); if (followingPackage != null) { followingPackage.Priority -= 1; DBReleaseDataService.Update(followingPackage); } ts.Complete(); } }
public void FillGapTaskPriority() { var taskList = DBReleaseDataService.GetQuery <T_E_MainTask>(null).Where(x => x.Priority != null).ToList().Enum().OrderBy(x => x.Priority).Enum().ToList(); var priorityCounter = 1; using (var ts = new TransactionScope()) { //boucle sur chaque tâche pour attribuer la bonne priorité foreach (var item in taskList.Enum()) { if (item.Priority != priorityCounter) { item.Priority = priorityCounter; DBReleaseDataService.Update(item); } priorityCounter++; } ts.Complete(); } }
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); }
public List <MainTask> GetMaintaskListByPackageId(long iPackageId) { return(DBReleaseDataService.GetQuery <T_E_MainTask>(null).Where(x => x.PackageId == iPackageId).Enum().Select(x => x.Convert()).Enum().ToList()); }
public List <Package> GetAllowedPackagesForMainTask(MainTask iMainTask) { var result = new List <Package>(); var affectedPackageIsLocked = false; if (iMainTask != null) { //Package déjà affecté à la tâche var originalMainTask = GetMainTaskById(iMainTask.MainTaskId, GranularityEnum.Nude); if (originalMainTask.PackageId != null) { var affectedPackage = GetPackageById((long)originalMainTask.PackageId, GranularityEnum.Full); result.Add(affectedPackage); if (affectedPackage.IsLocked) { affectedPackageIsLocked = true; } } } if (affectedPackageIsLocked) { //Retourne seulement le package affecté locké return(result); } else { //Récupération des packages non ouvert déverrouillé var unopenUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Waiting).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList(); result.AddRange(unopenUnlockPackages.Enum()); } if (iMainTask != null) { //Récupération des packages ouvert déverrouillé var openUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Developpement).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList(); //Garde les packages ouvert dont les projets sont commun var packageWithCommonProject = new List <Package>(); foreach (var item in openUnlockPackages.Enum()) { if (item.SubTasks.Exists(x => iMainTask.SubTasks.Exists(y => y.ProjectGUID == x.ProjectGUID))) { packageWithCommonProject.Add(item); } } //Si un seul projet alors seule solution if (packageWithCommonProject.Count == 1) { result.Add(packageWithCommonProject.Single()); } //Si aucun package de projet en commun alors tous les projets sont possibles else if (packageWithCommonProject.Count == 0) { result.AddRange(openUnlockPackages.Enum()); } } else { var openUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Developpement).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList(); result.AddRange(openUnlockPackages.Enum()); } //Suppression des doublons return(result.Enum().GroupBy(x => x.PackageId).Select(x => x.First()).ToList()); }
public List <Package> GetPackageList(PackageStatusSearchEnum iPackageEnvironmentSearch, PackageOrderByEnum iPackageOrderBy) { var theQuery = DBReleaseDataService.GetQuery <T_E_Package>(null); //Status if (iPackageEnvironmentSearch == PackageStatusSearchEnum.Developpement) { theQuery = theQuery.Where(x => x.StatusRef == (short)PackageStatusEnum.Developpement).AsQueryable(); } else if (iPackageEnvironmentSearch == PackageStatusSearchEnum.Production) { theQuery = theQuery.Where(x => x.StatusRef == (short)PackageStatusEnum.Production).AsQueryable(); } else if (iPackageEnvironmentSearch == PackageStatusSearchEnum.Staging) { theQuery = theQuery.Where(x => x.StatusRef == (short)PackageStatusEnum.Staging).AsQueryable(); } else if (iPackageEnvironmentSearch == PackageStatusSearchEnum.InProgress) { theQuery = theQuery.Where(x => x.StatusRef == (short)PackageStatusEnum.Developpement || x.StatusRef == (short)PackageStatusEnum.Staging).AsQueryable(); } else if (iPackageEnvironmentSearch == PackageStatusSearchEnum.All) { //ne filtre rien } else if (iPackageEnvironmentSearch == PackageStatusSearchEnum.NotCompleted) { theQuery = theQuery.Where(x => x.StatusRef == (short)PackageStatusEnum.Developpement || x.StatusRef == (short)PackageStatusEnum.Staging || x.StatusRef == (short)PackageStatusEnum.Waiting).AsQueryable(); } else { throw new Exception(iPackageEnvironmentSearch.ToStringWithEnumName()); } var packageList = theQuery.Enum().ToList(); var result = new List <Package>(); //OrderBy if (iPackageOrderBy == PackageOrderByEnum.Priority) { packageList = packageList.OrderByDescending(x => x.Priority.HasValue).ThenBy(x => x.Priority).ToList(); } else if (iPackageOrderBy == PackageOrderByEnum.PackageId) { packageList = packageList.OrderBy(x => x.PackageId).ToList(); } else if (iPackageOrderBy == PackageOrderByEnum.DateObjectif) { packageList = packageList.OrderByDescending(x => x.DeployementObjectifDate.HasValue).ThenBy(x => x.DeployementObjectifDate).ToList(); } else { throw new Exception(iPackageOrderBy.ToStringWithEnumName()); } foreach (var item in packageList.Enum()) { result.Add(GetPackageById(item.PackageId, GranularityEnum.Full)); } return(result); }