- Timestamp:
- 05/01/10 13:58:24 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs
r3220 r3578 25 25 } 26 26 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 27 51 public byte[] GetBinaryJobFile(Guid jobId) { 28 52 return (from job in Context.Jobs … … 34 58 Job j = DtoToEntity(bObj, null); 35 59 Context.Jobs.InsertOnSubmit(j); 36 Co ntext.SubmitChanges();60 CommitChanges(); 37 61 bObj.Id = j.JobId; 38 62 return bObj; … … 45 69 j.AssignedResources.Add(new AssignedResource { ResourceId = assignRessourceId}); 46 70 Context.Jobs.InsertOnSubmit(j); 47 Co ntext.SubmitChanges();71 CommitChanges(); 48 72 job.JobInfo.Id = j.JobId; 49 73 return job; … … 54 78 Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id)); 55 79 Context.Jobs.DeleteOnSubmit(job); 56 Co ntext.SubmitChanges();80 CommitChanges(); 57 81 } 58 82 59 83 public void Update(JobDto bObj) { 60 84 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(); 67 87 } 68 88 … … 105 125 c.Jobs.Add(j); 106 126 j.Client = c; 107 Co ntext.SubmitChanges();127 CommitChanges(); 108 128 } 109 129 … … 112 132 j.Client = null; 113 133 j.JobState = Enum.GetName(typeof(State), State.offline); 114 Co ntext.SubmitChanges();134 CommitChanges(); 115 135 } 116 136 … … 137 157 target.DateCalculated = source.DateCalculated; 138 158 target.DateCreated = source.DateCreated; 159 target.DateFinished = source.DateFinished; 139 160 target.JobId = source.Id; 140 161 … … 162 183 target.MemoryNeeded = source.MemoryNeeded; 163 184 164 165 166 185 target.DateCalculated = source.DateCalculated; 167 186 target.DateCreated = source.DateCreated; 187 target.DateFinished = source.DateFinished; 168 188 target.Id = source.JobId; 169 170 189 171 190 target.Percentage = source.Percentage; 172 191
Note: See TracChangeset
for help on using the changeset viewer.