Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/01/10 13:58:24 (14 years ago)
Author:
kgrading
Message:

Removed References to HiveLogging and updated the default logging mechanism (#991)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs

    r3220 r3578  
    2525    }
    2626
     27    public IEnumerable<JobDto> FindWithLimitations(State jobState, int offset, int count) {
     28
     29      IQueryable<JobDto> query = null;
     30      if (jobState == State.finished) {
     31         query = from job in Context.Jobs
     32                 where job.JobState == Enum.GetName(typeof (State), jobState)
     33                 orderby job.DateFinished
     34                 select EntityToDto(job, null);
     35      } else if (jobState == State.calculating || jobState == State.requestSnapshot || jobState == State.requestSnapshotSent) {
     36        query = from job in Context.Jobs
     37                    where job.JobState == Enum.GetName(typeof(State), jobState)
     38                    orderby job.DateCalculated
     39                    select EntityToDto(job, null);
     40      } else {
     41        query = from job in Context.Jobs
     42                    where job.JobState == Enum.GetName(typeof(State), jobState)
     43                    orderby job.DateCreated
     44                    select EntityToDto(job, null);
     45      }
     46
     47      return query.Skip(offset).Take(count).ToList();
     48    }
     49
     50
    2751    public byte[] GetBinaryJobFile(Guid jobId) {
    2852      return (from job in Context.Jobs
     
    3458      Job j = DtoToEntity(bObj, null);
    3559      Context.Jobs.InsertOnSubmit(j);
    36       Context.SubmitChanges();
     60      CommitChanges();
    3761      bObj.Id = j.JobId;
    3862      return bObj;
     
    4569        j.AssignedResources.Add(new AssignedResource { ResourceId = assignRessourceId});
    4670      Context.Jobs.InsertOnSubmit(j);
    47       Context.SubmitChanges();
     71      CommitChanges();
    4872      job.JobInfo.Id = j.JobId;
    4973      return job;
     
    5478      Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id));
    5579      Context.Jobs.DeleteOnSubmit(job);
    56       Context.SubmitChanges();
     80      CommitChanges();
    5781    }
    5882
    5983    public void Update(JobDto bObj) {
    6084      Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id));
    61       DtoToEntity(bObj, job);
    62       try {
    63         Context.SubmitChanges();
    64       } catch (ChangeConflictException cfe) {
    65        
    66       }
     85      DtoToEntity(bObj, job);   
     86      CommitChanges();
    6787    }
    6888
     
    105125      c.Jobs.Add(j);
    106126      j.Client = c;
    107       Context.SubmitChanges();     
     127      CommitChanges();     
    108128    }
    109129
     
    112132      j.Client = null;
    113133      j.JobState = Enum.GetName(typeof(State), State.offline);
    114       Context.SubmitChanges();
     134      CommitChanges();
    115135    }
    116136
     
    137157      target.DateCalculated = source.DateCalculated;
    138158      target.DateCreated = source.DateCreated;
     159      target.DateFinished = source.DateFinished;
    139160      target.JobId = source.Id;
    140161
     
    162183      target.MemoryNeeded = source.MemoryNeeded;
    163184
    164 
    165 
    166185      target.DateCalculated = source.DateCalculated;
    167186      target.DateCreated = source.DateCreated;
     187      target.DateFinished = source.DateFinished;
    168188      target.Id = source.JobId;
    169      
    170          
     189       
    171190      target.Percentage = source.Percentage;
    172191     
Note: See TracChangeset for help on using the changeset viewer.