Index: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj	(revision 3018)
+++ trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj	(revision 3022)
@@ -105,4 +105,5 @@
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
+    <Compile Include="UptimeCalendarDao.cs" />
   </ItemGroup>
   <ItemGroup>
Index: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml	(revision 3018)
+++ trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml	(revision 3022)
@@ -77,4 +77,5 @@
       <Association Name="Resource_ClientGroup_Resource" Member="ClientGroup_Resources" ThisKey="ResourceId" OtherKey="ResourceId" Type="ClientGroup_Resource" />
       <Association Name="Resource_Client" Member="Client" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" Cardinality="One" />
+      <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />
     </Type>
   </Table>
@@ -120,3 +121,15 @@
     </Type>
   </Table>
+  <Table Name="dbo.UptimeCalendar" Member="UptimeCalendars">
+    <Type Name="UptimeCalendar">
+      <Column Name="UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
+      <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="EndDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="AllDayEvent" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+      <Column Name="Recurring" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+      <Column Name="RecurringId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
+      <Association Name="Resource_UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" DeleteOnNull="true" />
+    </Type>
+  </Table>
 </Database>
Index: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout	(revision 3018)
+++ trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout	(revision 3022)
@@ -71,5 +71,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(4.4375 : 5.75); (4.4375 : 5.1362939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(4.78125 : 5.75); (4.78125 : 5.1362939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
       <nodes>
@@ -105,5 +105,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(4.5 : 6.94399251302083); (4.5 : 7.625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(4.78125 : 6.94399251302083); (4.78125 : 7.625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Client" />
       <nodes>
@@ -125,5 +125,5 @@
       </nestedChildShapes>
     </classShape>
-    <associationConnector edgePoints="[(10 : 6.5); (10 : 4.34375); (5.5 : 4.34375)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(10 : 6.5); (10 : 4.34375); (5.5 : 4.34375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
       <nodes>
@@ -132,5 +132,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(11 : 9.37580485026042); (12 : 9.37580485026042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(11 : 9.37580485026042); (12 : 9.37580485026042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
       <nodes>
@@ -139,5 +139,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(5.625 : 8.91270182291667); (9 : 8.91270182291667)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(5.625 : 8.91270182291667); (9 : 8.91270182291667)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Client/Client_Job" />
       <nodes>
@@ -153,5 +153,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(8.25 : 11.0969962565104); (9.32336288461538 : 11.0969962565104); (9.32336288461538 : 10.0016097005208)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(8.25 : 11.0969962565104); (9.32336288461538 : 11.0969962565104); (9.32336288461538 : 10.0016097005208)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Project/Project_Job" />
       <nodes>
@@ -160,4 +160,17 @@
       </nodes>
     </associationConnector>
+    <classShape Id="9ae82b5f-6e47-4a8e-8350-f7312381bb3b" absoluteBounds="0.625, 5.125, 2, 2.1554996744791666">
+      <DataClassMoniker Name="/HiveDataContext/UptimeCalendar" />
+      <nestedChildShapes>
+        <elementListCompartment Id="7469c6a3-4cb2-41c2-82b9-6999782218dd" absoluteBounds="0.64000000000000012, 5.585, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+      </nestedChildShapes>
+    </classShape>
+    <associationConnector edgePoints="[(3.375 : 6.34699625651042); (2.625 : 6.34699625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" />
+      <nodes>
+        <classShapeMoniker Id="e44e8355-4290-42f0-8b46-4473e91e504b" />
+        <classShapeMoniker Id="9ae82b5f-6e47-4a8e-8350-f7312381bb3b" />
+      </nodes>
+    </associationConnector>
   </nestedChildShapes>
 </ordesignerObjectsDiagram>
Index: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs	(revision 3018)
+++ trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs	(revision 3022)
@@ -64,4 +64,7 @@
     partial void UpdateJob(Job instance);
     partial void DeleteJob(Job instance);
+    partial void InsertUptimeCalendar(UptimeCalendar instance);
+    partial void UpdateUptimeCalendar(UptimeCalendar instance);
+    partial void DeleteUptimeCalendar(UptimeCalendar instance);
     #endregion
 		
@@ -181,4 +184,12 @@
 			{
 				return this.GetTable<Job>();
+			}
+		}
+		
+		public System.Data.Linq.Table<UptimeCalendar> UptimeCalendars
+		{
+			get
+			{
+				return this.GetTable<UptimeCalendar>();
 			}
 		}
@@ -604,5 +615,5 @@
 		}
 		
-		[Column(Storage="_UpDownTimeCalendar", DbType="Xml", CanBeNull=true, UpdateCheck=UpdateCheck.Never)]
+		[Column(Storage="_UpDownTimeCalendar", DbType="Xml", UpdateCheck=UpdateCheck.Never)]
 		public System.Xml.Linq.XElement UpDownTimeCalendar
 		{
@@ -1499,4 +1510,6 @@
 		private EntityRef<Client> _Client;
 		
+		private EntitySet<UptimeCalendar> _UptimeCalendars;
+		
     #region Extensibility Method Definitions
     partial void OnLoaded();
@@ -1515,4 +1528,5 @@
 			this._ClientGroup_Resources = new EntitySet<ClientGroup_Resource>(new Action<ClientGroup_Resource>(this.attach_ClientGroup_Resources), new Action<ClientGroup_Resource>(this.detach_ClientGroup_Resources));
 			this._Client = default(EntityRef<Client>);
+			this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));
 			OnCreated();
 		}
@@ -1642,4 +1656,17 @@
 		}
 		
+		[Association(Name="Resource_UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]
+		public EntitySet<UptimeCalendar> UptimeCalendars
+		{
+			get
+			{
+				return this._UptimeCalendars;
+			}
+			set
+			{
+				this._UptimeCalendars.Assign(value);
+			}
+		}
+		
 		public event PropertyChangingEventHandler PropertyChanging;
 		
@@ -1681,4 +1708,16 @@
 		
 		private void detach_ClientGroup_Resources(ClientGroup_Resource entity)
+		{
+			this.SendPropertyChanging();
+			entity.Resource = null;
+		}
+		
+		private void attach_UptimeCalendars(UptimeCalendar entity)
+		{
+			this.SendPropertyChanging();
+			entity.Resource = this;
+		}
+		
+		private void detach_UptimeCalendars(UptimeCalendar entity)
 		{
 			this.SendPropertyChanging();
@@ -2278,5 +2317,5 @@
 		}
 		
-		[Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", CanBeNull=true, UpdateCheck=UpdateCheck.Never)]
+		[Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", UpdateCheck=UpdateCheck.Never)]
 		public System.Data.Linq.Binary SerializedJob
 		{
@@ -2659,4 +2698,251 @@
 		}
 	}
+	
+	[Table(Name="dbo.UptimeCalendar")]
+	public partial class UptimeCalendar : INotifyPropertyChanging, INotifyPropertyChanged
+	{
+		
+		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+		
+		private System.Guid _UptimeCalendarId;
+		
+		private System.Guid _ResourceId;
+		
+		private System.DateTime _StartDate;
+		
+		private System.DateTime _EndDate;
+		
+		private bool _AllDayEvent;
+		
+		private bool _Recurring;
+		
+		private System.Guid _RecurringId;
+		
+		private EntityRef<Resource> _Resource;
+		
+    #region Extensibility Method Definitions
+    partial void OnLoaded();
+    partial void OnValidate(System.Data.Linq.ChangeAction action);
+    partial void OnCreated();
+    partial void OnUptimeCalendarIdChanging(System.Guid value);
+    partial void OnUptimeCalendarIdChanged();
+    partial void OnResourceIdChanging(System.Guid value);
+    partial void OnResourceIdChanged();
+    partial void OnStartDateChanging(System.DateTime value);
+    partial void OnStartDateChanged();
+    partial void OnEndDateChanging(System.DateTime value);
+    partial void OnEndDateChanged();
+    partial void OnAllDayEventChanging(bool value);
+    partial void OnAllDayEventChanged();
+    partial void OnRecurringChanging(bool value);
+    partial void OnRecurringChanged();
+    partial void OnRecurringIdChanging(System.Guid value);
+    partial void OnRecurringIdChanged();
+    #endregion
+		
+		public UptimeCalendar()
+		{
+			this._Resource = default(EntityRef<Resource>);
+			OnCreated();
+		}
+		
+		[Column(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
+		public System.Guid UptimeCalendarId
+		{
+			get
+			{
+				return this._UptimeCalendarId;
+			}
+			set
+			{
+				if ((this._UptimeCalendarId != value))
+				{
+					this.OnUptimeCalendarIdChanging(value);
+					this.SendPropertyChanging();
+					this._UptimeCalendarId = value;
+					this.SendPropertyChanged("UptimeCalendarId");
+					this.OnUptimeCalendarIdChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
+		public System.Guid ResourceId
+		{
+			get
+			{
+				return this._ResourceId;
+			}
+			set
+			{
+				if ((this._ResourceId != value))
+				{
+					if (this._Resource.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
+					this.OnResourceIdChanging(value);
+					this.SendPropertyChanging();
+					this._ResourceId = value;
+					this.SendPropertyChanged("ResourceId");
+					this.OnResourceIdChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_StartDate", DbType="DateTime NOT NULL")]
+		public System.DateTime StartDate
+		{
+			get
+			{
+				return this._StartDate;
+			}
+			set
+			{
+				if ((this._StartDate != value))
+				{
+					this.OnStartDateChanging(value);
+					this.SendPropertyChanging();
+					this._StartDate = value;
+					this.SendPropertyChanged("StartDate");
+					this.OnStartDateChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_EndDate", DbType="DateTime NOT NULL")]
+		public System.DateTime EndDate
+		{
+			get
+			{
+				return this._EndDate;
+			}
+			set
+			{
+				if ((this._EndDate != value))
+				{
+					this.OnEndDateChanging(value);
+					this.SendPropertyChanging();
+					this._EndDate = value;
+					this.SendPropertyChanged("EndDate");
+					this.OnEndDateChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_AllDayEvent", DbType="Bit NOT NULL")]
+		public bool AllDayEvent
+		{
+			get
+			{
+				return this._AllDayEvent;
+			}
+			set
+			{
+				if ((this._AllDayEvent != value))
+				{
+					this.OnAllDayEventChanging(value);
+					this.SendPropertyChanging();
+					this._AllDayEvent = value;
+					this.SendPropertyChanged("AllDayEvent");
+					this.OnAllDayEventChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_Recurring", DbType="Bit NOT NULL")]
+		public bool Recurring
+		{
+			get
+			{
+				return this._Recurring;
+			}
+			set
+			{
+				if ((this._Recurring != value))
+				{
+					this.OnRecurringChanging(value);
+					this.SendPropertyChanging();
+					this._Recurring = value;
+					this.SendPropertyChanged("Recurring");
+					this.OnRecurringChanged();
+				}
+			}
+		}
+		
+		[Column(Storage="_RecurringId", DbType="UniqueIdentifier")]
+		public System.Guid RecurringId
+		{
+			get
+			{
+				return this._RecurringId;
+			}
+			set
+			{
+				if ((this._RecurringId != value))
+				{
+					this.OnRecurringIdChanging(value);
+					this.SendPropertyChanging();
+					this._RecurringId = value;
+					this.SendPropertyChanged("RecurringId");
+					this.OnRecurringIdChanged();
+				}
+			}
+		}
+		
+		[Association(Name="Resource_UptimeCalendar", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
+		public Resource Resource
+		{
+			get
+			{
+				return this._Resource.Entity;
+			}
+			set
+			{
+				Resource previousValue = this._Resource.Entity;
+				if (((previousValue != value) 
+							|| (this._Resource.HasLoadedOrAssignedValue == false)))
+				{
+					this.SendPropertyChanging();
+					if ((previousValue != null))
+					{
+						this._Resource.Entity = null;
+						previousValue.UptimeCalendars.Remove(this);
+					}
+					this._Resource.Entity = value;
+					if ((value != null))
+					{
+						value.UptimeCalendars.Add(this);
+						this._ResourceId = value.ResourceId;
+					}
+					else
+					{
+						this._ResourceId = default(System.Guid);
+					}
+					this.SendPropertyChanged("Resource");
+				}
+			}
+		}
+		
+		public event PropertyChangingEventHandler PropertyChanging;
+		
+		public event PropertyChangedEventHandler PropertyChanged;
+		
+		protected virtual void SendPropertyChanging()
+		{
+			if ((this.PropertyChanging != null))
+			{
+				this.PropertyChanging(this, emptyChangingEventArgs);
+			}
+		}
+		
+		protected virtual void SendPropertyChanged(String propertyName)
+		{
+			if ((this.PropertyChanged != null))
+			{
+				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+			}
+		}
+	}
 }
 #pragma warning restore 1591
Index: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs	(revision 3022)
+++ trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs	(revision 3022)
@@ -0,0 +1,102 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Hive.Contracts.BusinessObjects;
+using HeuristicLab.Hive.Server.DataAccess;
+
+namespace HeuristicLab.Hive.Server.LINQDataAccess {
+  public class UptimeCalendarDao: BaseDao<AppointmentDto, UptimeCalendar>, IUptimeCalendarDao {
+    public override UptimeCalendar DtoToEntity(AppointmentDto source, UptimeCalendar target) {
+      if(source == null)
+        return null;
+      if (target == null)
+        target = new UptimeCalendar();
+
+      target.AllDayEvent = source.AllDayEvent;
+      target.EndDate = source.EndDate;
+      target.StartDate = source.StartDate;
+      target.Recurring = source.Recurring;
+      target.RecurringId = source.RecurringId;
+
+      target.ResourceId = source.ResourceId;
+
+      return target;
+      
+    }
+
+    public override AppointmentDto EntityToDto(UptimeCalendar source, AppointmentDto target) {
+      if (source == null)
+        return null;
+      if (target == null)
+        target = new AppointmentDto();
+      
+      target.AllDayEvent = source.AllDayEvent;
+      target.EndDate = source.EndDate;
+      target.StartDate = source.StartDate;
+      target.Recurring = source.Recurring;
+      target.RecurringId = source.RecurringId;
+
+      target.ResourceId = source.ResourceId;
+
+      return target;
+
+    }
+
+    #region IGenericDao<AppointmentDto> Members
+
+    public AppointmentDto FindById(Guid id) {
+      return (from app in Context.UptimeCalendars
+              where app.UptimeCalendarId.Equals(id)
+              select EntityToDto(app, null)).SingleOrDefault();
+    }
+
+    public IEnumerable<AppointmentDto> FindAll() {
+      return (from app in Context.UptimeCalendars              
+              select EntityToDto(app, null)).ToList();
+    }
+
+    public AppointmentDto Insert(AppointmentDto bObj) {
+      UptimeCalendar uc = DtoToEntity(bObj, null);
+      Context.UptimeCalendars.InsertOnSubmit(uc);
+      Context.SubmitChanges();
+      bObj.Id = uc.UptimeCalendarId;
+      return bObj;
+    }
+
+    public void Delete(AppointmentDto bObj) {
+      Context.UptimeCalendars.DeleteOnSubmit(Context.UptimeCalendars.SingleOrDefault(uc => uc.UptimeCalendarId.Equals(bObj.Id)));
+      Context.SubmitChanges();
+    }
+
+    public void Update(AppointmentDto bObj) {
+      UptimeCalendar cc = Context.UptimeCalendars.SingleOrDefault(c => c.UptimeCalendarId.Equals(bObj.Id));
+      DtoToEntity(bObj, cc);
+      Context.SubmitChanges();
+    }
+
+    public IEnumerable<AppointmentDto> GetUptimeCalendarForResource(Guid resourceId) {
+      return (from uc in Context.UptimeCalendars
+              where uc.ResourceId.Equals(resourceId)
+              select EntityToDto(uc, null)).ToList();
+    }
+
+    public void SetUptimeCalendarForResource(Guid resourceId, IEnumerable<AppointmentDto> appointments) {
+      var q = (from uc in Context.UptimeCalendars
+               where uc.ResourceId.Equals(resourceId)
+               select uc);
+      
+      Context.UptimeCalendars.DeleteAllOnSubmit(q);
+
+      foreach (AppointmentDto appdto in appointments) {      
+        UptimeCalendar uc = DtoToEntity(appdto, null);
+        uc.ResourceId = resourceId;
+        Context.UptimeCalendars.InsertOnSubmit(uc);
+      }
+
+      Context.SubmitChanges();            
+    }
+
+    #endregion
+  }
+}
