Changeset 5633
- Timestamp:
- 03/08/11 12:39:33 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs
r5602 r5633 342 342 #endregion 343 343 344 #region Appointment Methods 345 public Guid AddAppointment(Appointment appointment) { 346 throw new NotImplementedException(); 347 } 348 349 public void DeleteAppointment(Guid appointmentId) { 350 throw new NotImplementedException(); 351 } 352 353 public void UpdateAppointment(Appointment appointment) { 354 throw new NotImplementedException(); 355 } 356 357 public List<Appointment> GetScheduleForResource(Guid resourceId) { 358 throw new NotImplementedException(); 359 } 360 #endregion 344 361 } 345 362 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Appointment.cs
r5614 r5633 28 28 29 29 protected Appointment(Appointment original, Cloner cloner) { 30 //TODO: uncommment 31 /*this.AllDayEvent = original.AllDayEvent; 30 this.AllDayEvent = original.AllDayEvent; 32 31 this.EndDate = original.EndDate; 33 32 this.Recurring = original.Recurring; … … 35 34 this.ResourceId = original.ResourceId; 36 35 this.StartDate = original.StartDate; 37 this.Id = original.Id; */36 this.Id = original.Id; 38 37 } 39 38 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r5614 r5633 20 20 "nsfer")] 21 21 [System.SerializableAttribute()] 22 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Appointment))] 22 23 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.LightweightJob))] 23 24 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.StateLog))] … … 76 77 { 77 78 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 79 } 80 } 81 } 82 83 [System.Diagnostics.DebuggerStepThroughAttribute()] 84 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 85 [System.Runtime.Serialization.DataContractAttribute(Name="Appointment", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common.DataTra" + 86 "nsfer")] 87 [System.SerializableAttribute()] 88 public partial class Appointment : HeuristicLab.Clients.Hive.HiveItem 89 { 90 91 [System.Runtime.Serialization.OptionalFieldAttribute()] 92 private bool AllDayEventField; 93 94 [System.Runtime.Serialization.OptionalFieldAttribute()] 95 private System.DateTime EndDateField; 96 97 [System.Runtime.Serialization.OptionalFieldAttribute()] 98 private bool RecurringField; 99 100 [System.Runtime.Serialization.OptionalFieldAttribute()] 101 private System.Guid RecurringIdField; 102 103 [System.Runtime.Serialization.OptionalFieldAttribute()] 104 private System.Guid ResourceIdField; 105 106 [System.Runtime.Serialization.OptionalFieldAttribute()] 107 private System.DateTime StartDateField; 108 109 [System.Runtime.Serialization.DataMemberAttribute()] 110 public bool AllDayEvent 111 { 112 get 113 { 114 return this.AllDayEventField; 115 } 116 set 117 { 118 if ((this.AllDayEventField.Equals(value) != true)) 119 { 120 this.AllDayEventField = value; 121 this.RaisePropertyChanged("AllDayEvent"); 122 } 123 } 124 } 125 126 [System.Runtime.Serialization.DataMemberAttribute()] 127 public System.DateTime EndDate 128 { 129 get 130 { 131 return this.EndDateField; 132 } 133 set 134 { 135 if ((this.EndDateField.Equals(value) != true)) 136 { 137 this.EndDateField = value; 138 this.RaisePropertyChanged("EndDate"); 139 } 140 } 141 } 142 143 [System.Runtime.Serialization.DataMemberAttribute()] 144 public bool Recurring 145 { 146 get 147 { 148 return this.RecurringField; 149 } 150 set 151 { 152 if ((this.RecurringField.Equals(value) != true)) 153 { 154 this.RecurringField = value; 155 this.RaisePropertyChanged("Recurring"); 156 } 157 } 158 } 159 160 [System.Runtime.Serialization.DataMemberAttribute()] 161 public System.Guid RecurringId 162 { 163 get 164 { 165 return this.RecurringIdField; 166 } 167 set 168 { 169 if ((this.RecurringIdField.Equals(value) != true)) 170 { 171 this.RecurringIdField = value; 172 this.RaisePropertyChanged("RecurringId"); 173 } 174 } 175 } 176 177 [System.Runtime.Serialization.DataMemberAttribute()] 178 public System.Guid ResourceId 179 { 180 get 181 { 182 return this.ResourceIdField; 183 } 184 set 185 { 186 if ((this.ResourceIdField.Equals(value) != true)) 187 { 188 this.ResourceIdField = value; 189 this.RaisePropertyChanged("ResourceId"); 190 } 191 } 192 } 193 194 [System.Runtime.Serialization.DataMemberAttribute()] 195 public System.DateTime StartDate 196 { 197 get 198 { 199 return this.StartDateField; 200 } 201 set 202 { 203 if ((this.StartDateField.Equals(value) != true)) 204 { 205 this.StartDateField = value; 206 this.RaisePropertyChanged("StartDate"); 207 } 78 208 } 79 209 } … … 1465 1595 void TriggerLifecycle(); 1466 1596 1597 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddAppointment", ReplyAction="http://tempuri.org/IHiveService/AddAppointmentResponse")] 1598 System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment); 1599 1600 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteAppointment", ReplyAction="http://tempuri.org/IHiveService/DeleteAppointmentResponse")] 1601 void DeleteAppointment(System.Guid appointmentId); 1602 1603 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateAppointment", ReplyAction="http://tempuri.org/IHiveService/UpdateAppointmentResponse")] 1604 void UpdateAppointment(HeuristicLab.Clients.Hive.Appointment appointment); 1605 1606 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetScheduleForResource", ReplyAction="http://tempuri.org/IHiveService/GetScheduleForResourceResponse")] 1607 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Appointment> GetScheduleForResource(System.Guid resourceId); 1608 1467 1609 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddJob", ReplyAction="http://tempuri.org/IHiveService/AddJobResponse")] 1468 1610 System.Guid AddJob(HeuristicLab.Clients.Hive.Job job, HeuristicLab.Clients.Hive.JobData jobData, System.Collections.Generic.List<System.Guid> resourceIds); … … 1639 1781 } 1640 1782 1783 public System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment) 1784 { 1785 return base.Channel.AddAppointment(appointment); 1786 } 1787 1788 public void DeleteAppointment(System.Guid appointmentId) 1789 { 1790 base.Channel.DeleteAppointment(appointmentId); 1791 } 1792 1793 public void UpdateAppointment(HeuristicLab.Clients.Hive.Appointment appointment) 1794 { 1795 base.Channel.UpdateAppointment(appointment); 1796 } 1797 1798 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Appointment> GetScheduleForResource(System.Guid resourceId) 1799 { 1800 return base.Channel.GetScheduleForResource(resourceId); 1801 } 1802 1641 1803 public System.Guid AddJob(HeuristicLab.Clients.Hive.Job job, HeuristicLab.Clients.Hive.JobData jobData, System.Collections.Generic.List<System.Guid> resourceIds) 1642 1804 { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r5602 r5633 146 146 #endregion 147 147 148 #region Appointment Methods 149 [OperationContract] 150 Guid AddAppointment(Appointment appointment); 151 152 [OperationContract] 153 void DeleteAppointment(Guid appointmentId); 154 155 [OperationContract] 156 void UpdateAppointment(Appointment appointment); 157 158 [OperationContract] 159 IEnumerable<Appointment> GetScheduleForResource(Guid resourceId); 160 #endregion 148 161 } 149 162 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r5526 r5633 64 64 target.StateLogs.Add(Convert.ToEntity(sl)); 65 65 } 66 66 67 67 //target.StateLogs.AddRange(source.StateLog.Select(x => Convert.ToEntity(x)).OrderBy(x => x.DateTime)); 68 68 target.IsParentJob = source.IsParentJob; … … 103 103 if ((source != null) && (target != null)) { 104 104 target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = source.State; target.UserId = source.UserId; 105 } 106 } 107 #endregion 108 109 #region Appointment 110 public static DT.Appointment ToDto(UptimeCalendar source) { 111 if (source == null) return null; 112 return new DT.Appointment { Id = source.UptimeCalendarId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate }; 113 } 114 public static UptimeCalendar ToEntity(DT.Appointment source) { 115 if (source == null) return null; 116 var entity = new UptimeCalendar(); ToEntity(source, entity); 117 return entity; 118 } 119 public static void ToEntity(DT.Appointment source, UptimeCalendar target) { 120 if ((source != null) && (target != null)) { 121 target.UptimeCalendarId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; 105 122 } 106 123 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r5593 r5633 94 94 where resourceIds.Contains(ar.ResourceId) 95 95 && ar.Job.State == JobState.Waiting 96 && ar.Job.IsParentJob 96 && ar.Job.IsParentJob 97 97 && (finished ? ar.Job.FinishWhenChildJobsFinished : !ar.Job.FinishWhenChildJobsFinished) 98 98 && (from child in db.Jobs … … 581 581 } 582 582 #endregion 583 584 #region AppointmentMethods 585 public Appointment GetAppointment(Guid id) { 586 using (var db = CreateContext()) { 587 return Convert.ToDto(db.UptimeCalendars.SingleOrDefault(x => x.UptimeCalendarId == id)); 588 } 589 } 590 591 public IEnumerable<Appointment> GetAppointments(Expression<Func<UptimeCalendar, bool>> predicate) { 592 using (var db = CreateContext()) { 593 return db.UptimeCalendars.Where(predicate).Select(x => Convert.ToDto(x)).ToArray(); 594 } 595 } 596 597 public Guid AddAppointment(Appointment dto) { 598 using (var db = CreateContext()) { 599 var entity = Convert.ToEntity(dto); 600 db.UptimeCalendars.InsertOnSubmit(entity); 601 db.SubmitChanges(); 602 return entity.UptimeCalendarId; 603 } 604 } 605 606 public void UpdateAppointment(Appointment dto) { 607 using (var db = CreateContext()) { 608 var entity = db.UptimeCalendars.FirstOrDefault(x => x.UptimeCalendarId == dto.Id); 609 if (entity == null) db.UptimeCalendars.InsertOnSubmit(Convert.ToEntity(dto)); 610 else Convert.ToEntity(dto, entity); 611 db.SubmitChanges(); 612 } 613 } 614 615 public void DeleteAppointment(Guid id) { 616 using (var db = CreateContext()) { 617 var entity = db.UptimeCalendars.FirstOrDefault(x => x.UptimeCalendarId == id); 618 if (entity != null) db.UptimeCalendars.DeleteOnSubmit(entity); 619 db.SubmitChanges(); 620 } 621 } 622 #endregion 583 623 } 584 624 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
r5593 r5633 105 105 void SetLastCleanup(DateTime datetime); 106 106 #endregion 107 108 #region Appointment Methods 109 DT.Appointment GetAppointment(Guid id); 110 IEnumerable<DT.Appointment> GetAppointments(Expression<Func<UptimeCalendar, bool>> predicate); 111 Guid AddAppointment(DT.Appointment dto); 112 void UpdateAppointment(DT.Appointment dto); 113 void DeleteAppointment(Guid id); 114 #endregion 115 107 116 } 108 117 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5602 r5633 420 420 421 421 #endregion 422 423 #region Appointment Methods 424 425 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 426 public Guid AddAppointment(Appointment appointment) { 427 using (trans.OpenTransaction()) { 428 return dao.AddAppointment(appointment); 429 } 430 } 431 432 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 433 public void DeleteAppointment(Guid appointmentId) { 434 using (trans.OpenTransaction()) { 435 dao.DeleteAppointment(appointmentId); 436 } 437 } 438 439 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 440 public void UpdateAppointment(Appointment appointment) { 441 using (trans.OpenTransaction()) { 442 dao.UpdateAppointment(appointment); 443 } 444 } 445 446 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 447 public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) { 448 using (trans.OpenTransaction()) { 449 return dao.GetAppointments(x => x.ResourceId == resourceId); 450 } 451 } 452 #endregion 422 453 } 423 454 }
Note: See TracChangeset
for help on using the changeset viewer.