Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs @ 5991

Last change on this file since 5991 was 5793, checked in by cneumuel, 14 years ago

#1233

  • implemented correct downloading of paused jobs. its now also possible to change parameters and resume a algorithm
  • removed Prepare() calls in ExperimentManager and in slave, as it prevents corrent resuming of paused jobs
  • made events in ItemTreeView be invoked in the correct thread
  • reduced log output in ExperimentManager
File size: 19.2 KB
RevLine 
[5028]1using System;
2using System.Collections.Generic;
3using System.Linq;
[5793]4using System.Security.Permissions;
[5028]5using System.ServiceModel;
[5375]6using HeuristicLab.Services.Hive.Common;
7using HeuristicLab.Services.Hive.Common.DataTransfer;
[5028]8using HeuristicLab.Services.Hive.Common.ServiceContracts;
9
10namespace HeuristicLab.Services.Hive {
11
12  /// <summary>
13  /// Implementation of the Hive service (interface <see cref="IHiveService"/>).
[5599]14  /// We need 'IgnoreExtensionDataObject' Attribute for the slave to work.
[5028]15  /// </summary>
[5599]16  [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, IgnoreExtensionDataObject = true)]
[5028]17  public class HiveService : IHiveService {
18    private DataAccess.IHiveDao dao {
19      get { return ServiceLocator.Instance.HiveDao; }
20    }
21    private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
22      get { return ServiceLocator.Instance.TransactionManager; }
23    }
24    private IAuthorizationManager auth {
25      get { return ServiceLocator.Instance.AuthorizationManager; }
26    }
[5095]27    private ILifecycleManager lifecycleManager {
28      get { return ServiceLocator.Instance.LifecycleManager; }
[5028]29    }
[5405]30    private HeartbeatManager heartbeatManager {
31      get { return ServiceLocator.Instance.HeartbeatManager; }
32    }
[5028]33
34    #region Job Methods
[5793]35    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
36    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5511]37    public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) {
[5708]38      return trans.UseTransaction(() => {
[5155]39        job.Id = dao.AddJob(job);
40        jobData.JobId = job.Id;
[5106]41        jobData.LastUpdate = DateTime.Now;
[5511]42        if (resourceIds != null) {
43          foreach (Guid slaveGroupId in resourceIds) {
[5155]44            dao.AssignJobToResource(job.Id, slaveGroupId);
45          }
46        } else {
47          // todo: use default group
48        }
[5028]49        dao.AddJobData(jobData);
[5636]50        dao.UpdateJobState(job.Id, JobState.Waiting, null, auth.UserId, null);
[5028]51        return jobData.JobId;
[5708]52      });
[5028]53    }
54
[5793]55    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
56    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]57    public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
[5708]58      return trans.UseTransaction(() => {
[5028]59        job.ParentJobId = parentJobId;
[5155]60        return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));
[5708]61      });
[5028]62    }
63
[5793]64    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
65    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
66    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5028]67    public Job GetJob(Guid jobId) {
68      return dao.GetJob(jobId);
69    }
70
[5793]71    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
72    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]73    public IEnumerable<Job> GetJobs() {
74      return dao.GetJobs(x => true);
75    }
76
[5793]77    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
78    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]79    public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) {
80      return dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray();
81    }
82
[5793]83    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
84    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]85    public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
86      return GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray();
87    }
88
[5793]89    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
90    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
91    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5028]92    public JobData GetJobData(Guid jobId) {
93      return dao.GetJobData(jobId);
94    }
95
[5793]96    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
97    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
98    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5511]99    public void UpdateJob(Job job) {
[5708]100      trans.UseTransaction(() => {
[5511]101        dao.UpdateJob(job);
[5708]102      });
[5511]103    }
104
[5793]105    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
106    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
107    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5511]108    public void UpdateJobData(Job job, JobData jobData) {
[5708]109      trans.UseTransaction(() => {
[5106]110        jobData.LastUpdate = DateTime.Now;
111        dao.UpdateJob(job);
112        dao.UpdateJobData(jobData);
[5708]113      });
[5028]114    }
115
[5793]116    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
117    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
118    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5106]119    public void DeleteJob(Guid jobId) {
[5708]120      trans.UseTransaction(() => {
[5106]121        dao.DeleteJob(jobId);
[5708]122      });
[5028]123    }
124
[5793]125    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
126    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
127    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5106]128    public void DeleteChildJobs(Guid parentJobId) {
[5708]129      trans.UseTransaction(() => {
[5106]130        var jobs = GetChildJobs(parentJobId, true, false);
[5028]131        foreach (var job in jobs) {
132          dao.DeleteJob(job.Id);
133          dao.DeleteJobData(job.Id);
134        };
[5708]135      });
[5028]136    }
[5102]137
[5793]138    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
139    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
140    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5636]141    public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {
[5779]142      return trans.UseTransaction(() => {
143        Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception);
144        if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == JobState.Paused) {
145          job.Command = null;
146        } else if (job.Command.HasValue && job.Command.Value == Command.Abort && job.State == JobState.Aborted) {
147          job.Command = null;
148        } else if (job.Command.HasValue && job.Command.Value == Command.Stop && job.State == JobState.Aborted) {
149          job.Command = null;
150        }
151        dao.UpdateJob(job);
152        return job;
153      });
[5636]154    }
[5028]155    #endregion
156
157    #region Job Control Methods
[5793]158    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
159    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
160    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5053]161    public void StopJob(Guid jobId) {
[5708]162      trans.UseTransaction(() => {
[5779]163        //dao.UpdateJobState(jobId, JobState.Aborted, null, auth.UserId, string.Empty);
164        var job = dao.GetJob(jobId);
165        job.Command = Command.Stop;
166        dao.UpdateJob(job);
[5708]167      });
[5028]168    }
[5526]169
[5793]170    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
171    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
172    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5062]173    public void PauseJob(Guid jobId) {
[5708]174      trans.UseTransaction(() => {
[5779]175        //dao.UpdateJobState(jobId, JobState.Paused, null, auth.UserId, string.Empty);
176        var job = dao.GetJob(jobId);
177        job.Command = Command.Pause;
178        dao.UpdateJob(job);
[5708]179      });
[5028]180    }
[5779]181
[5793]182    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
183    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
184    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5779]185    public void RestartJob(Guid jobId) {
186      trans.UseTransaction(() => {
187        Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, auth.UserId, string.Empty);
188        job.Command = null;
189        dao.UpdateJob(job);
190      });
191    }
[5028]192    #endregion
193
194    #region HiveExperiment Methods
[5793]195    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
196    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]197    public HiveExperiment GetHiveExperiment(Guid id) {
[5511]198      return dao.GetHiveExperiments(x =>
199             x.HiveExperimentId == id
200          && (x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0)
201          ).FirstOrDefault();
[5028]202    }
203
[5793]204    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
205    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]206    public IEnumerable<HiveExperiment> GetHiveExperiments() {
[5511]207      return dao.GetHiveExperiments(x => x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0);
[5028]208    }
209
[5793]210    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]   
[5602]211    public IEnumerable<HiveExperiment> GetAllHiveExperiments() {
212      return dao.GetHiveExperiments(x => true);
213    }
214
[5793]215    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
216    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]217    public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
[5708]218      return trans.UseTransaction(() => {
[5511]219        hiveExperimentDto.OwnerUserId = auth.UserId;
[5106]220        hiveExperimentDto.DateCreated = DateTime.Now;
[5028]221        return dao.AddHiveExperiment(hiveExperimentDto);
[5708]222      });
[5028]223    }
224
[5793]225    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
226    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]227    public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
[5708]228      trans.UseTransaction(() => {
[5028]229        dao.UpdateHiveExperiment(hiveExperimentDto);
[5708]230      });
[5028]231    }
232
[5793]233    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
234    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]235    public void DeleteHiveExperiment(Guid hiveExperimentId) {
[5708]236      trans.UseTransaction(() => {
[5028]237        HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
[5106]238        dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger
[5708]239      });
[5028]240    }
241    #endregion
[5106]242
[5028]243    #region Login Methods
[5793]244    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5405]245    public void Hello(Slave slaveInfo) {
[5708]246      trans.UseTransaction(() => {
[5405]247        var slave = dao.GetSlave(slaveInfo.Id);
[5375]248
249        if (slave == null) {
[5405]250          dao.AddSlave(slaveInfo);
[5375]251        } else {
[5405]252          dao.UpdateSlave(slaveInfo);
[5375]253        }
[5708]254      });
[5053]255    }
[5028]256
[5793]257    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5375]258    public void GoodBye(Guid slaveId) {
[5708]259      trans.UseTransaction(() => {
[5375]260        var slave = dao.GetSlave(slaveId);
261        if (slave != null) {
262          slave.SlaveState = SlaveState.Offline;
263          dao.UpdateSlave(slave);
264        }
[5708]265      });
[5053]266    }
[5028]267    #endregion
268
269    #region Heartbeat Methods
[5793]270    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5053]271    public List<MessageContainer> Heartbeat(Heartbeat heartbeat) {
[5636]272      TriggerLifecycle(false);
[5708]273      return trans.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));
[5028]274    }
275    #endregion
276
277    #region Plugin Methods
[5793]278    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
279    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]280    public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) {
[5708]281      return trans.UseTransaction(() => {
[5402]282        plugin.UserId = auth.UserId;
283        plugin.DateCreated = DateTime.Now;
[5028]284        Guid pluginId = dao.AddPlugin(plugin);
285        foreach (PluginData pluginData in pluginDatas) {
286          pluginData.PluginId = pluginId;
287          dao.AddPluginData(pluginData);
288        }
289        return pluginId;
[5708]290      });
[5028]291    }
[5526]292
[5793]293    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
294    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
295    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5053]296    public IEnumerable<Plugin> GetPlugins() {
[5593]297      return dao.GetPlugins(x => x.IsLocal == false);
[5028]298    }
[5375]299
[5793]300    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
301    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
302    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
[5053]303    public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) {
[5375]304      List<PluginData> pluginDatas = new List<PluginData>();
305
[5708]306      return trans.UseTransaction(() => {
[5375]307        foreach (Guid guid in pluginIds) {
308          List<PluginData> pluginData = dao.GetPluginDatas(x => x.PluginId == guid).ToList();
309          if (pluginData != null) {
310            pluginDatas.AddRange(pluginData);
311          } else {
312            //ignore ?
313          }
314        }
315        return pluginDatas;
[5708]316      });
[5028]317    }
[5375]318
[5028]319    #endregion
[5106]320
[5028]321    #region Slave Methods
[5793]322    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
323    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]324    public Guid AddSlave(Slave slave) {
[5708]325      return trans.UseTransaction(() => dao.AddSlave(slave));
[5028]326    }
327
[5793]328    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
329    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]330    public Guid AddSlaveGroup(SlaveGroup slaveGroup) {
[5708]331      return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
[5028]332    }
333
[5793]334    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
335    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]336    public Slave GetSlave(Guid slaveId) {
337      return dao.GetSlave(slaveId);
338    }
339
340    public SlaveGroup GetSlaveGroup(Guid slaveGroupId) {
341      return dao.GetSlaveGroup(slaveGroupId);
342    }
343
[5793]344    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
345    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]346    public IEnumerable<Slave> GetSlaves() {
347      return dao.GetSlaves(x => true);
348    }
349
[5793]350    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
351    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5028]352    public IEnumerable<SlaveGroup> GetSlaveGroups() {
353      return dao.GetSlaveGroups(x => true);
354    }
355
[5793]356    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
357    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]358    public void UpdateSlave(Slave slave) {
[5708]359      trans.UseTransaction(() => {
[5106]360        dao.UpdateSlave(slave);
[5708]361      });
[5028]362    }
363
[5793]364    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
365    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]366    public void UpdateSlaveGroup(SlaveGroup slaveGroup) {
[5708]367      trans.UseTransaction(() => {
[5106]368        dao.UpdateSlaveGroup(slaveGroup);
[5708]369      });
[5028]370    }
371
[5793]372    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
373    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]374    public void DeleteSlave(Guid slaveId) {
[5708]375      trans.UseTransaction(() => {
[5106]376        dao.DeleteSlave(slaveId);
[5708]377      });
[5028]378    }
379
[5793]380    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
381    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]382    public void DeleteSlaveGroup(Guid slaveGroupId) {
[5708]383      trans.UseTransaction(() => {
[5106]384        dao.DeleteSlaveGroup(slaveGroupId);
[5708]385      });
[5028]386    }
[5106]387
[5793]388    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
389    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]390    public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) {
[5708]391      trans.UseTransaction(() => {
[5106]392        var resource = dao.GetResource(resourceId);
393        resource.ParentResourceId = slaveGroupId;
394        dao.UpdateResource(resource);
[5708]395      });
[5106]396    }
397
[5793]398    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
399    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5106]400    public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) {
[5708]401      trans.UseTransaction(() => {
[5106]402        var resource = dao.GetResource(resourceId);
403        resource.ParentResourceId = null;
404        dao.UpdateResource(resource);
[5708]405      });
[5106]406    }
407
[5793]408    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
409    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
[5458]410    public Guid GetResourceId(string resourceName) {
[5708]411      return trans.UseTransaction(() => {
[5458]412        var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault();
413        if (resource != null) {
414          return resource.Id;
415        } else {
416          return Guid.Empty;
417        }
[5708]418      });
[5458]419    }
[5593]420
[5636]421    public void TriggerLifecycle(bool force) {
[5708]422      trans.UseTransaction(() => {
[5593]423        DateTime lastCleanup = dao.GetLastCleanup();
[5636]424        if (force || DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) {
[5593]425          dao.SetLastCleanup(DateTime.Now);
426          lifecycleManager.Cleanup();
427        }
[5708]428      });
[5593]429    }
[5028]430    #endregion
431
432    #region Helper Methods
433    private IEnumerable<Job> GetChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
434      var jobs = new List<Job>(dao.GetJobs(x => parentJobId == null ? !x.ParentJobId.HasValue : x.ParentJobId.Value == parentJobId));
435
436      if (recursive) {
437        var childs = new List<Job>();
438        foreach (var job in jobs) {
439          childs.AddRange(GetChildJobs(job.Id, recursive, false));
440        }
441        jobs.AddRange(childs);
442      }
[5535]443
444      if (includeParent) jobs.Add(GetJob(parentJobId.Value));
445
[5028]446      return jobs;
447    }
448
449    #endregion
[5633]450
451    #region Appointment Methods
452
[5793]453    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
[5633]454    public Guid AddAppointment(Appointment appointment) {
[5708]455      return trans.UseTransaction(() => dao.AddAppointment(appointment));
[5633]456    }
457
[5793]458    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
[5633]459    public void DeleteAppointment(Guid appointmentId) {
[5708]460      trans.UseTransaction(() => {
[5633]461        dao.DeleteAppointment(appointmentId);
[5708]462      });
[5633]463    }
464
[5793]465    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
[5633]466    public void UpdateAppointment(Appointment appointment) {
[5708]467      trans.UseTransaction(() => {
[5633]468        dao.UpdateAppointment(appointment);
[5708]469      });
[5633]470    }
471
[5793]472    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
[5633]473    public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) {
[5708]474      return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
[5633]475    }
476    #endregion
[5028]477  }
478}
Note: See TracBrowser for help on using the repository browser.