Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/18 15:51:41 (7 years ago)
Author:
jzenisek
Message:

#2839: Fixed several bugs and added project duration handling

  • fixed project duration handling (client- & service-side)
  • fixed tagging in HiveJobAdmin
  • added ProjectJobs view (under construction)
  • added necessary service methods
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/JobDao.cs

    r15908 r15966  
    3232      return GetByIdQuery(DataContext, id);
    3333    }
    34    
     34
    3535    public void DeleteByState(JobState state) {
    3636      DataContext.ExecuteCommand(DeleteByStateQueryString, Enum.GetName(typeof(JobState), state));
     37    }
     38
     39    public IEnumerable<Job> GetByProjectId(Guid id) {
     40      return GetByProjectIdQuery(DataContext, id);
     41    }
     42
     43    public IEnumerable<Job> GetByProjectIds(IEnumerable<Guid> projectIds) {
     44      string paramProjectIds = string.Join(",", projectIds.ToList().Select(x => string.Format("'{0}'", x)));
     45      if(!string.IsNullOrWhiteSpace(paramProjectIds)) {
     46        string queryString = string.Format(GetByProjectIdsQueryString, paramProjectIds);
     47        return DataContext.ExecuteQuery<Job>(queryString);
     48      }
     49      return Enumerable.Empty<Job>();
    3750    }
    3851
     
    5669         where job.JobId == jobId
    5770         select job).SingleOrDefault());
     71    private static readonly Func<DataContext, Guid, IEnumerable<Job>> GetByProjectIdQuery =
     72      CompiledQuery.Compile((DataContext db, Guid projectId) =>
     73        (from job in db.GetTable<Job>()
     74         where job.ProjectId == projectId
     75         select job));
    5876    private static readonly Func<DataContext, JobState, IEnumerable<Job>> GetByStateQuery =
    5977      CompiledQuery.Compile((DataContext db, JobState jobState) =>
     
    92110        WHERE t.JobId = j.JobId)
    93111    ";
     112    private const string GetByProjectIdsQueryString = @"
     113      SELECT DISTINCT j.*
     114      FROM [Job] j
     115      WHERE j.ProjectId IN ({0})
     116    ";
    94117    #endregion
    95118  }
Note: See TracChangeset for help on using the changeset viewer.