Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/10 10:50:26 (14 years ago)
Author:
kgrading
Message:

implemented the server on the client, using push & force push, added refresh buttons, added auto calender methods that traverse the tree... (#908)

Location:
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2
Files:
6 edited

Legend:

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

    r3011 r3203  
    3838              select EntityToDto(job.Client, null)).SingleOrDefault();
    3939    }
    40  
     40
     41    public void SetServerSideCalendar(ClientDto client, Guid clientGroupId) {
     42      Client dbclient = Context.Clients.SingleOrDefault(c => c.ResourceId.Equals(client.Id));
     43      dbclient.UseCalendarFromResourceId = clientGroupId;
     44      dbclient.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), CalendarState.Fetch);
     45      Context.SubmitChanges();
     46    }
     47
    4148    public ClientDto Insert(ClientDto info) {
    4249      Client c = DtoToEntity(info, null);     
     
    7986      target.Resource.Name = source.Name;
    8087      target.Resource.ResourceId = source.Id;
    81 
     88      target.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), source.CalendarSyncStatus);
    8289      target.Login = source.Login;
    8390      target.Memory = source.Memory;
     
    96103      target.FreeMemory = source.FreeMemory;
    97104      target.Id = source.ResourceId;
     105      target.CalendarSyncStatus = (CalendarState) Enum.Parse(typeof (CalendarState), source.CalendarSyncStatus);
    98106      target.Login = source.Login;
    99107      target.Memory = source.Memory;
     
    103111      target.State = (State) Enum.Parse(typeof (State), source.Status);
    104112      return target;
    105     }
     113    } 
    106114  }
    107115}
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientGroupDao.cs

    r3018 r3203  
    5656      ClientGroup cg = Context.ClientGroups.SingleOrDefault(c => c.ResourceId.Equals(clientGroupId));
    5757      Resource res = Context.Resources.SingleOrDefault(r => r.ResourceId.Equals(resource));
    58       cg.ClientGroup_Resources.Add(new ClientGroup_Resource { ClientGroup = cg, Resource = res });
     58      cg.ClientGroup_Resources.Add(new ClientGroup_Resource { ClientGroup = cg, Resource = res });     
    5959      Context.SubmitChanges();
    6060    }
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml

    r3022 r3203  
    7676      <Association Name="Resource_ClientGroup" Member="ClientGroup" ThisKey="ResourceId" OtherKey="ResourceId" Type="ClientGroup" Cardinality="One" />
    7777      <Association Name="Resource_ClientGroup_Resource" Member="ClientGroup_Resources" ThisKey="ResourceId" OtherKey="ResourceId" Type="ClientGroup_Resource" />
     78      <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />
    7879      <Association Name="Resource_Client" Member="Client" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" Cardinality="One" />
    79       <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />
    80     </Type>
    81   </Table>
    82   <Table Name="dbo.Client" Member="Clients">
    83     <Type Name="Client">
    84       <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    85       <Column Name="CPUSpeed" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    86       <Column Name="Memory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    87       <Column Name="Login" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
    88       <Column Name="Status" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
    89       <Column Name="ClientConfigId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
    90       <Column Name="NumberOfCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    91       <Column Name="NumberOfFreeCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    92       <Column Name="FreeMemory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    93       <Association Name="Client_UptimeStatistic" Member="UptimeStatistics" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeStatistic" />
    94       <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" />
    95       <Association Name="Resource_Client" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" DeleteOnNull="true" />
    96       <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="ClientConfig" IsForeignKey="true" DeleteRule="SET NULL" />
     80      <Association Name="Resource_Client1" Member="Client1" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" Cardinality="One" />
    9781    </Type>
    9882  </Table>
     
    116100      <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" />
    117101      <Association Name="Job_Job" Member="Jobs" ThisKey="JobId" OtherKey="ParentJobId" Type="Job" />
    118       <Association Name="Client_Job" Member="Client" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" IsForeignKey="true" DeleteRule="SET NULL" />
    119102      <Association Name="Job_Job" Member="Job1" ThisKey="ParentJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
    120103      <Association Name="Project_Job" Member="Project" ThisKey="ProjectId" OtherKey="ProjectId" Type="Project" IsForeignKey="true" DeleteRule="SET NULL" />
     104      <Association Name="Client_Job" Member="Client" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" IsForeignKey="true" DeleteRule="SET NULL" />
    121105    </Type>
    122106  </Table>
     
    133117    </Type>
    134118  </Table>
     119  <Table Name="dbo.Client" Member="Clients">
     120    <Type Name="Client">
     121      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     122      <Column Name="CPUSpeed" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     123      <Column Name="Memory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     124      <Column Name="Login" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
     125      <Column Name="Status" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
     126      <Column Name="CalendarSyncStatus" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
     127      <Column Name="UseCalendarFromResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
     128      <Column Name="ClientConfigId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
     129      <Column Name="NumberOfCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     130      <Column Name="NumberOfFreeCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     131      <Column Name="FreeMemory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     132      <Association Name="Client_UptimeStatistic" Member="UptimeStatistics" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeStatistic" />
     133      <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" />
     134      <Association Name="Resource_Client" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" DeleteOnNull="true" />
     135      <Association Name="Resource_Client1" Member="Resource1" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
     136      <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="ClientConfig" IsForeignKey="true" DeleteRule="SET NULL" />
     137    </Type>
     138  </Table>
    135139</Database>
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout

    r3022 r3203  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 14.25, 12.625" name="DataClasses1">
     2<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 14.25, 13.625" name="DataClasses1">
    33  <DataContextMoniker Name="/HiveDataContext" />
    44  <nestedChildShapes>
     
    99      </nestedChildShapes>
    1010    </classShape>
    11     <classShape Id="93016de7-5896-4132-9db6-bc2fe38230fe" absoluteBounds="0.75, 9.25, 2, 1.5785953776041666">
     11    <classShape Id="93016de7-5896-4132-9db6-bc2fe38230fe" absoluteBounds="0.5, 10.125, 2, 1.5785953776041666">
    1212      <DataClassMoniker Name="/HiveDataContext/UptimeStatistic" />
    1313      <nestedChildShapes>
    14         <elementListCompartment Id="c1f9c6c9-81a2-4007-8bd0-bcadb42ee3d5" absoluteBounds="0.76499999999999968, 9.71, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     14        <elementListCompartment Id="c1f9c6c9-81a2-4007-8bd0-bcadb42ee3d5" absoluteBounds="0.51499999999999968, 10.585, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    1515      </nestedChildShapes>
    1616    </classShape>
    17     <classShape Id="5f1881a6-9a97-4298-a30e-bc434b948d15" absoluteBounds="3.625, 11, 2, 1.3862939453124987">
     17    <classShape Id="5f1881a6-9a97-4298-a30e-bc434b948d15" absoluteBounds="3.625, 12, 2, 1.3862939453124987">
    1818      <DataClassMoniker Name="/HiveDataContext/ClientConfig" />
    1919      <nestedChildShapes>
    20         <elementListCompartment Id="3dbf7375-bb24-421c-a581-712b9ba03996" absoluteBounds="3.64, 11.46, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     20        <elementListCompartment Id="3dbf7375-bb24-421c-a581-712b9ba03996" absoluteBounds="3.64, 12.46, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    2121      </nestedChildShapes>
    2222    </classShape>
     
    9292      </nodes>
    9393    </associationConnector>
    94     <classShape Id="a2f0b500-6e5f-4de0-b608-64e4b55a73c4" absoluteBounds="3.625, 7.625, 2, 2.5401025390625">
    95       <DataClassMoniker Name="/HiveDataContext/Client" />
    96       <nestedChildShapes>
    97         <elementListCompartment Id="73aab418-5f1d-4648-a326-abf68f213f0e" absoluteBounds="3.64, 8.085, 1.9700000000000002, 1.9801025390625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    98       </nestedChildShapes>
    99     </classShape>
    100     <associationConnector edgePoints="[(3.625 : 9.70755126953125); (2.75 : 9.70755126953125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    101       <AssociationMoniker Name="/HiveDataContext/Client/Client_UptimeStatistic" />
    102       <nodes>
    103         <classShapeMoniker Id="a2f0b500-6e5f-4de0-b608-64e4b55a73c4" />
    104         <classShapeMoniker Id="93016de7-5896-4132-9db6-bc2fe38230fe" />
    105       </nodes>
    106     </associationConnector>
    107     <associationConnector edgePoints="[(4.78125 : 6.94399251302083); (4.78125 : 7.625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    108       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Client" />
    109       <nodes>
    110         <classShapeMoniker Id="e44e8355-4290-42f0-8b46-4473e91e504b" />
    111         <classShapeMoniker Id="a2f0b500-6e5f-4de0-b608-64e4b55a73c4" />
    112       </nodes>
    113     </associationConnector>
    114     <associationConnector edgePoints="[(4.625 : 11); (4.625 : 10.1651025390625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    115       <AssociationMoniker Name="/HiveDataContext/ClientConfig/ClientConfig_Client" />
    116       <nodes>
    117         <classShapeMoniker Id="5f1881a6-9a97-4298-a30e-bc434b948d15" />
    118         <classShapeMoniker Id="a2f0b500-6e5f-4de0-b608-64e4b55a73c4" />
    119       </nodes>
    120     </associationConnector>
    12194    <classShape Id="9af04358-a545-4e37-bb13-d249fecfa769" absoluteBounds="9, 6.5, 2, 3.5016097005208326">
    12295      <DataClassMoniker Name="/HiveDataContext/Job" />
     
    137110        <classShapeMoniker Id="9af04358-a545-4e37-bb13-d249fecfa769" />
    138111        <classShapeMoniker Id="59a84aec-bc57-49b5-a709-71cdf7612b31" />
    139       </nodes>
    140     </associationConnector>
    141     <associationConnector edgePoints="[(5.625 : 8.91270182291667); (9 : 8.91270182291667)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    142       <AssociationMoniker Name="/HiveDataContext/Client/Client_Job" />
    143       <nodes>
    144         <classShapeMoniker Id="a2f0b500-6e5f-4de0-b608-64e4b55a73c4" />
    145         <classShapeMoniker Id="9af04358-a545-4e37-bb13-d249fecfa769" />
    146112      </nodes>
    147113    </associationConnector>
     
    166132      </nestedChildShapes>
    167133    </classShape>
    168     <associationConnector edgePoints="[(3.375 : 6.34699625651042); (2.625 : 6.34699625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     134    <associationConnector edgePoints="[(3.375 : 6.34699625651042); (2.625 : 6.34699625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    169135      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" />
    170136      <nodes>
     
    173139      </nodes>
    174140    </associationConnector>
     141    <classShape Id="51cb317e-413a-4e25-a9b6-e903322f0371" absoluteBounds="3.875, 8.25, 2, 2.9247054036458331">
     142      <DataClassMoniker Name="/HiveDataContext/Client" />
     143      <nestedChildShapes>
     144        <elementListCompartment Id="0103eb78-0280-47ac-a748-9c6593a9640b" absoluteBounds="3.89, 8.71, 1.9700000000000002, 2.364705403645833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     145      </nestedChildShapes>
     146    </classShape>
     147    <associationConnector edgePoints="[(3.875 : 10.6498527018229); (2.5 : 10.6498527018229)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     148      <AssociationMoniker Name="/HiveDataContext/Client/Client_UptimeStatistic" />
     149      <nodes>
     150        <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />
     151        <classShapeMoniker Id="93016de7-5896-4132-9db6-bc2fe38230fe" />
     152      </nodes>
     153    </associationConnector>
     154    <associationConnector edgePoints="[(5.875 : 9.12580485026042); (9 : 9.12580485026042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     155      <AssociationMoniker Name="/HiveDataContext/Client/Client_Job" />
     156      <nodes>
     157        <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />
     158        <classShapeMoniker Id="9af04358-a545-4e37-bb13-d249fecfa769" />
     159      </nodes>
     160    </associationConnector>
     161    <associationConnector edgePoints="[(4.625 : 6.94399251302083); (4.625 : 8.25)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     162      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Client" />
     163      <nodes>
     164        <classShapeMoniker Id="e44e8355-4290-42f0-8b46-4473e91e504b" />
     165        <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />
     166      </nodes>
     167    </associationConnector>
     168    <associationConnector edgePoints="[(5.0625 : 6.94399251302083); (5.0625 : 8.25)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     169      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Client1" />
     170      <nodes>
     171        <classShapeMoniker Id="e44e8355-4290-42f0-8b46-4473e91e504b" />
     172        <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />
     173      </nodes>
     174    </associationConnector>
     175    <associationConnector edgePoints="[(4.75 : 12); (4.75 : 11.1747054036458)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     176      <AssociationMoniker Name="/HiveDataContext/ClientConfig/ClientConfig_Client" />
     177      <nodes>
     178        <classShapeMoniker Id="5f1881a6-9a97-4298-a30e-bc434b948d15" />
     179        <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />
     180      </nodes>
     181    </associationConnector>
    175182  </nestedChildShapes>
    176183</ordesignerObjectsDiagram>
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs

    r3022 r3203  
    5858    partial void UpdateResource(Resource instance);
    5959    partial void DeleteResource(Resource instance);
    60     partial void InsertClient(Client instance);
    61     partial void UpdateClient(Client instance);
    62     partial void DeleteClient(Client instance);
    6360    partial void InsertJob(Job instance);
    6461    partial void UpdateJob(Job instance);
     
    6764    partial void UpdateUptimeCalendar(UptimeCalendar instance);
    6865    partial void DeleteUptimeCalendar(UptimeCalendar instance);
     66    partial void InsertClient(Client instance);
     67    partial void UpdateClient(Client instance);
     68    partial void DeleteClient(Client instance);
    6969    #endregion
    7070   
     
    171171    }
    172172   
     173    public System.Data.Linq.Table<Job> Jobs
     174    {
     175      get
     176      {
     177        return this.GetTable<Job>();
     178      }
     179    }
     180   
     181    public System.Data.Linq.Table<UptimeCalendar> UptimeCalendars
     182    {
     183      get
     184      {
     185        return this.GetTable<UptimeCalendar>();
     186      }
     187    }
     188   
    173189    public System.Data.Linq.Table<Client> Clients
    174190    {
     
    176192      {
    177193        return this.GetTable<Client>();
    178       }
    179     }
    180    
    181     public System.Data.Linq.Table<Job> Jobs
    182     {
    183       get
    184       {
    185         return this.GetTable<Job>();
    186       }
    187     }
    188    
    189     public System.Data.Linq.Table<UptimeCalendar> UptimeCalendars
    190     {
    191       get
    192       {
    193         return this.GetTable<UptimeCalendar>();
    194194      }
    195195    }
     
    15081508    private EntitySet<ClientGroup_Resource> _ClientGroup_Resources;
    15091509   
     1510    private EntitySet<UptimeCalendar> _UptimeCalendars;
     1511   
    15101512    private EntityRef<Client> _Client;
    15111513   
    1512     private EntitySet<UptimeCalendar> _UptimeCalendars;
     1514    private EntityRef<Client> _Client1;
    15131515   
    15141516    #region Extensibility Method Definitions
     
    15271529      this._ClientGroup = default(EntityRef<ClientGroup>);
    15281530      this._ClientGroup_Resources = new EntitySet<ClientGroup_Resource>(new Action<ClientGroup_Resource>(this.attach_ClientGroup_Resources), new Action<ClientGroup_Resource>(this.detach_ClientGroup_Resources));
     1531      this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));
    15291532      this._Client = default(EntityRef<Client>);
    1530       this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));
     1533      this._Client1 = default(EntityRef<Client>);
    15311534      OnCreated();
    15321535    }
     
    16271630    }
    16281631   
     1632    [Association(Name="Resource_UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]
     1633    public EntitySet<UptimeCalendar> UptimeCalendars
     1634    {
     1635      get
     1636      {
     1637        return this._UptimeCalendars;
     1638      }
     1639      set
     1640      {
     1641        this._UptimeCalendars.Assign(value);
     1642      }
     1643    }
     1644   
    16291645    [Association(Name="Resource_Client", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsUnique=true, IsForeignKey=false)]
    16301646    public Client Client
     
    16561672    }
    16571673   
    1658     [Association(Name="Resource_UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]
    1659     public EntitySet<UptimeCalendar> UptimeCalendars
    1660     {
    1661       get
    1662       {
    1663         return this._UptimeCalendars;
    1664       }
    1665       set
    1666       {
    1667         this._UptimeCalendars.Assign(value);
     1674    [Association(Name="Resource_Client1", Storage="_Client1", ThisKey="ResourceId", OtherKey="ResourceId", IsUnique=true, IsForeignKey=false)]
     1675    public Client Client1
     1676    {
     1677      get
     1678      {
     1679        return this._Client1.Entity;
     1680      }
     1681      set
     1682      {
     1683        Client previousValue = this._Client1.Entity;
     1684        if (((previousValue != value)
     1685              || (this._Client1.HasLoadedOrAssignedValue == false)))
     1686        {
     1687          this.SendPropertyChanging();
     1688          if ((previousValue != null))
     1689          {
     1690            this._Client1.Entity = null;
     1691            previousValue.Resource1 = null;
     1692          }
     1693          this._Client1.Entity = value;
     1694          if ((value != null))
     1695          {
     1696            value.Resource1 = this;
     1697          }
     1698          this.SendPropertyChanged("Client1");
     1699        }
    16681700      }
    16691701    }
     
    17231755      this.SendPropertyChanging();
    17241756      entity.Resource = null;
    1725     }
    1726   }
    1727  
    1728   [Table(Name="dbo.Client")]
    1729   public partial class Client : INotifyPropertyChanging, INotifyPropertyChanged
    1730   {
    1731    
    1732     private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    1733    
    1734     private System.Guid _ResourceId;
    1735    
    1736     private int _CPUSpeed;
    1737    
    1738     private int _Memory;
    1739    
    1740     private System.DateTime _Login;
    1741    
    1742     private string _Status;
    1743    
    1744     private System.Nullable<System.Guid> _ClientConfigId;
    1745    
    1746     private int _NumberOfCores;
    1747    
    1748     private int _NumberOfFreeCores;
    1749    
    1750     private int _FreeMemory;
    1751    
    1752     private EntitySet<UptimeStatistic> _UptimeStatistics;
    1753    
    1754     private EntitySet<Job> _Jobs;
    1755    
    1756     private EntityRef<Resource> _Resource;
    1757    
    1758     private EntityRef<ClientConfig> _ClientConfig;
    1759    
    1760     #region Extensibility Method Definitions
    1761     partial void OnLoaded();
    1762     partial void OnValidate(System.Data.Linq.ChangeAction action);
    1763     partial void OnCreated();
    1764     partial void OnResourceIdChanging(System.Guid value);
    1765     partial void OnResourceIdChanged();
    1766     partial void OnCPUSpeedChanging(int value);
    1767     partial void OnCPUSpeedChanged();
    1768     partial void OnMemoryChanging(int value);
    1769     partial void OnMemoryChanged();
    1770     partial void OnLoginChanging(System.DateTime value);
    1771     partial void OnLoginChanged();
    1772     partial void OnStatusChanging(string value);
    1773     partial void OnStatusChanged();
    1774     partial void OnClientConfigIdChanging(System.Nullable<System.Guid> value);
    1775     partial void OnClientConfigIdChanged();
    1776     partial void OnNumberOfCoresChanging(int value);
    1777     partial void OnNumberOfCoresChanged();
    1778     partial void OnNumberOfFreeCoresChanging(int value);
    1779     partial void OnNumberOfFreeCoresChanged();
    1780     partial void OnFreeMemoryChanging(int value);
    1781     partial void OnFreeMemoryChanged();
    1782     #endregion
    1783    
    1784     public Client()
    1785     {
    1786       this._UptimeStatistics = new EntitySet<UptimeStatistic>(new Action<UptimeStatistic>(this.attach_UptimeStatistics), new Action<UptimeStatistic>(this.detach_UptimeStatistics));
    1787       this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    1788       this._Resource = default(EntityRef<Resource>);
    1789       this._ClientConfig = default(EntityRef<ClientConfig>);
    1790       OnCreated();
    1791     }
    1792    
    1793     [Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    1794     public System.Guid ResourceId
    1795     {
    1796       get
    1797       {
    1798         return this._ResourceId;
    1799       }
    1800       set
    1801       {
    1802         if ((this._ResourceId != value))
    1803         {
    1804           if (this._Resource.HasLoadedOrAssignedValue)
    1805           {
    1806             throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    1807           }
    1808           this.OnResourceIdChanging(value);
    1809           this.SendPropertyChanging();
    1810           this._ResourceId = value;
    1811           this.SendPropertyChanged("ResourceId");
    1812           this.OnResourceIdChanged();
    1813         }
    1814       }
    1815     }
    1816    
    1817     [Column(Storage="_CPUSpeed", DbType="Int NOT NULL")]
    1818     public int CPUSpeed
    1819     {
    1820       get
    1821       {
    1822         return this._CPUSpeed;
    1823       }
    1824       set
    1825       {
    1826         if ((this._CPUSpeed != value))
    1827         {
    1828           this.OnCPUSpeedChanging(value);
    1829           this.SendPropertyChanging();
    1830           this._CPUSpeed = value;
    1831           this.SendPropertyChanged("CPUSpeed");
    1832           this.OnCPUSpeedChanged();
    1833         }
    1834       }
    1835     }
    1836    
    1837     [Column(Storage="_Memory", DbType="Int NOT NULL")]
    1838     public int Memory
    1839     {
    1840       get
    1841       {
    1842         return this._Memory;
    1843       }
    1844       set
    1845       {
    1846         if ((this._Memory != value))
    1847         {
    1848           this.OnMemoryChanging(value);
    1849           this.SendPropertyChanging();
    1850           this._Memory = value;
    1851           this.SendPropertyChanged("Memory");
    1852           this.OnMemoryChanged();
    1853         }
    1854       }
    1855     }
    1856    
    1857     [Column(Storage="_Login", DbType="DateTime NOT NULL")]
    1858     public System.DateTime Login
    1859     {
    1860       get
    1861       {
    1862         return this._Login;
    1863       }
    1864       set
    1865       {
    1866         if ((this._Login != value))
    1867         {
    1868           this.OnLoginChanging(value);
    1869           this.SendPropertyChanging();
    1870           this._Login = value;
    1871           this.SendPropertyChanged("Login");
    1872           this.OnLoginChanged();
    1873         }
    1874       }
    1875     }
    1876    
    1877     [Column(Storage="_Status", DbType="VarChar(MAX)")]
    1878     public string Status
    1879     {
    1880       get
    1881       {
    1882         return this._Status;
    1883       }
    1884       set
    1885       {
    1886         if ((this._Status != value))
    1887         {
    1888           this.OnStatusChanging(value);
    1889           this.SendPropertyChanging();
    1890           this._Status = value;
    1891           this.SendPropertyChanged("Status");
    1892           this.OnStatusChanged();
    1893         }
    1894       }
    1895     }
    1896    
    1897     [Column(Storage="_ClientConfigId", DbType="UniqueIdentifier")]
    1898     public System.Nullable<System.Guid> ClientConfigId
    1899     {
    1900       get
    1901       {
    1902         return this._ClientConfigId;
    1903       }
    1904       set
    1905       {
    1906         if ((this._ClientConfigId != value))
    1907         {
    1908           if (this._ClientConfig.HasLoadedOrAssignedValue)
    1909           {
    1910             throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    1911           }
    1912           this.OnClientConfigIdChanging(value);
    1913           this.SendPropertyChanging();
    1914           this._ClientConfigId = value;
    1915           this.SendPropertyChanged("ClientConfigId");
    1916           this.OnClientConfigIdChanged();
    1917         }
    1918       }
    1919     }
    1920    
    1921     [Column(Storage="_NumberOfCores", DbType="Int NOT NULL")]
    1922     public int NumberOfCores
    1923     {
    1924       get
    1925       {
    1926         return this._NumberOfCores;
    1927       }
    1928       set
    1929       {
    1930         if ((this._NumberOfCores != value))
    1931         {
    1932           this.OnNumberOfCoresChanging(value);
    1933           this.SendPropertyChanging();
    1934           this._NumberOfCores = value;
    1935           this.SendPropertyChanged("NumberOfCores");
    1936           this.OnNumberOfCoresChanged();
    1937         }
    1938       }
    1939     }
    1940    
    1941     [Column(Storage="_NumberOfFreeCores", DbType="Int NOT NULL")]
    1942     public int NumberOfFreeCores
    1943     {
    1944       get
    1945       {
    1946         return this._NumberOfFreeCores;
    1947       }
    1948       set
    1949       {
    1950         if ((this._NumberOfFreeCores != value))
    1951         {
    1952           this.OnNumberOfFreeCoresChanging(value);
    1953           this.SendPropertyChanging();
    1954           this._NumberOfFreeCores = value;
    1955           this.SendPropertyChanged("NumberOfFreeCores");
    1956           this.OnNumberOfFreeCoresChanged();
    1957         }
    1958       }
    1959     }
    1960    
    1961     [Column(Storage="_FreeMemory", DbType="Int NOT NULL")]
    1962     public int FreeMemory
    1963     {
    1964       get
    1965       {
    1966         return this._FreeMemory;
    1967       }
    1968       set
    1969       {
    1970         if ((this._FreeMemory != value))
    1971         {
    1972           this.OnFreeMemoryChanging(value);
    1973           this.SendPropertyChanging();
    1974           this._FreeMemory = value;
    1975           this.SendPropertyChanged("FreeMemory");
    1976           this.OnFreeMemoryChanged();
    1977         }
    1978       }
    1979     }
    1980    
    1981     [Association(Name="Client_UptimeStatistic", Storage="_UptimeStatistics", ThisKey="ResourceId", OtherKey="ResourceId")]
    1982     public EntitySet<UptimeStatistic> UptimeStatistics
    1983     {
    1984       get
    1985       {
    1986         return this._UptimeStatistics;
    1987       }
    1988       set
    1989       {
    1990         this._UptimeStatistics.Assign(value);
    1991       }
    1992     }
    1993    
    1994     [Association(Name="Client_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="ResourceId")]
    1995     public EntitySet<Job> Jobs
    1996     {
    1997       get
    1998       {
    1999         return this._Jobs;
    2000       }
    2001       set
    2002       {
    2003         this._Jobs.Assign(value);
    2004       }
    2005     }
    2006    
    2007     [Association(Name="Resource_Client", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
    2008     public Resource Resource
    2009     {
    2010       get
    2011       {
    2012         return this._Resource.Entity;
    2013       }
    2014       set
    2015       {
    2016         Resource previousValue = this._Resource.Entity;
    2017         if (((previousValue != value)
    2018               || (this._Resource.HasLoadedOrAssignedValue == false)))
    2019         {
    2020           this.SendPropertyChanging();
    2021           if ((previousValue != null))
    2022           {
    2023             this._Resource.Entity = null;
    2024             previousValue.Client = null;
    2025           }
    2026           this._Resource.Entity = value;
    2027           if ((value != null))
    2028           {
    2029             value.Client = this;
    2030             this._ResourceId = value.ResourceId;
    2031           }
    2032           else
    2033           {
    2034             this._ResourceId = default(System.Guid);
    2035           }
    2036           this.SendPropertyChanged("Resource");
    2037         }
    2038       }
    2039     }
    2040    
    2041     [Association(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")]
    2042     public ClientConfig ClientConfig
    2043     {
    2044       get
    2045       {
    2046         return this._ClientConfig.Entity;
    2047       }
    2048       set
    2049       {
    2050         ClientConfig previousValue = this._ClientConfig.Entity;
    2051         if (((previousValue != value)
    2052               || (this._ClientConfig.HasLoadedOrAssignedValue == false)))
    2053         {
    2054           this.SendPropertyChanging();
    2055           if ((previousValue != null))
    2056           {
    2057             this._ClientConfig.Entity = null;
    2058             previousValue.Clients.Remove(this);
    2059           }
    2060           this._ClientConfig.Entity = value;
    2061           if ((value != null))
    2062           {
    2063             value.Clients.Add(this);
    2064             this._ClientConfigId = value.ClientConfigId;
    2065           }
    2066           else
    2067           {
    2068             this._ClientConfigId = default(Nullable<System.Guid>);
    2069           }
    2070           this.SendPropertyChanged("ClientConfig");
    2071         }
    2072       }
    2073     }
    2074    
    2075     public event PropertyChangingEventHandler PropertyChanging;
    2076    
    2077     public event PropertyChangedEventHandler PropertyChanged;
    2078    
    2079     protected virtual void SendPropertyChanging()
    2080     {
    2081       if ((this.PropertyChanging != null))
    2082       {
    2083         this.PropertyChanging(this, emptyChangingEventArgs);
    2084       }
    2085     }
    2086    
    2087     protected virtual void SendPropertyChanged(String propertyName)
    2088     {
    2089       if ((this.PropertyChanged != null))
    2090       {
    2091         this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    2092       }
    2093     }
    2094    
    2095     private void attach_UptimeStatistics(UptimeStatistic entity)
    2096     {
    2097       this.SendPropertyChanging();
    2098       entity.Client = this;
    2099     }
    2100    
    2101     private void detach_UptimeStatistics(UptimeStatistic entity)
    2102     {
    2103       this.SendPropertyChanging();
    2104       entity.Client = null;
    2105     }
    2106    
    2107     private void attach_Jobs(Job entity)
    2108     {
    2109       this.SendPropertyChanging();
    2110       entity.Client = this;
    2111     }
    2112    
    2113     private void detach_Jobs(Job entity)
    2114     {
    2115       this.SendPropertyChanging();
    2116       entity.Client = null;
    21171757    }
    21181758  }
     
    21581798    private EntitySet<Job> _Jobs;
    21591799   
     1800    private EntityRef<Job> _Job1;
     1801   
     1802    private EntityRef<Project> _Project;
     1803   
    21601804    private EntityRef<Client> _Client;
    2161    
    2162     private EntityRef<Job> _Job1;
    2163    
    2164     private EntityRef<Project> _Project;
    21651805   
    21661806    #region Extensibility Method Definitions
     
    22031843      this._RequiredPlugins = new EntitySet<RequiredPlugin>(new Action<RequiredPlugin>(this.attach_RequiredPlugins), new Action<RequiredPlugin>(this.detach_RequiredPlugins));
    22041844      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    2205       this._Client = default(EntityRef<Client>);
    22061845      this._Job1 = default(EntityRef<Job>);
    22071846      this._Project = default(EntityRef<Project>);
     1847      this._Client = default(EntityRef<Client>);
    22081848      OnCreated();
    22091849    }
     
    23171957    }
    23181958   
    2319     [Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", UpdateCheck=UpdateCheck.Never)]
     1959    [Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", CanBeNull=true, UpdateCheck=UpdateCheck.Never)]
    23201960    public System.Data.Linq.Binary SerializedJob
    23211961    {
     
    25402180    }
    25412181   
     2182    [Association(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)]
     2183    public Job Job1
     2184    {
     2185      get
     2186      {
     2187        return this._Job1.Entity;
     2188      }
     2189      set
     2190      {
     2191        Job previousValue = this._Job1.Entity;
     2192        if (((previousValue != value)
     2193              || (this._Job1.HasLoadedOrAssignedValue == false)))
     2194        {
     2195          this.SendPropertyChanging();
     2196          if ((previousValue != null))
     2197          {
     2198            this._Job1.Entity = null;
     2199            previousValue.Jobs.Remove(this);
     2200          }
     2201          this._Job1.Entity = value;
     2202          if ((value != null))
     2203          {
     2204            value.Jobs.Add(this);
     2205            this._ParentJobId = value.JobId;
     2206          }
     2207          else
     2208          {
     2209            this._ParentJobId = default(Nullable<System.Guid>);
     2210          }
     2211          this.SendPropertyChanged("Job1");
     2212        }
     2213      }
     2214    }
     2215   
     2216    [Association(Name="Project_Job", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="SET NULL")]
     2217    public Project Project
     2218    {
     2219      get
     2220      {
     2221        return this._Project.Entity;
     2222      }
     2223      set
     2224      {
     2225        Project previousValue = this._Project.Entity;
     2226        if (((previousValue != value)
     2227              || (this._Project.HasLoadedOrAssignedValue == false)))
     2228        {
     2229          this.SendPropertyChanging();
     2230          if ((previousValue != null))
     2231          {
     2232            this._Project.Entity = null;
     2233            previousValue.Jobs.Remove(this);
     2234          }
     2235          this._Project.Entity = value;
     2236          if ((value != null))
     2237          {
     2238            value.Jobs.Add(this);
     2239            this._ProjectId = value.ProjectId;
     2240          }
     2241          else
     2242          {
     2243            this._ProjectId = default(Nullable<System.Guid>);
     2244          }
     2245          this.SendPropertyChanged("Project");
     2246        }
     2247      }
     2248    }
     2249   
    25422250    [Association(Name="Client_Job", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
    25432251    public Client Client
     
    25702278          }
    25712279          this.SendPropertyChanged("Client");
    2572         }
    2573       }
    2574     }
    2575    
    2576     [Association(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)]
    2577     public Job Job1
    2578     {
    2579       get
    2580       {
    2581         return this._Job1.Entity;
    2582       }
    2583       set
    2584       {
    2585         Job previousValue = this._Job1.Entity;
    2586         if (((previousValue != value)
    2587               || (this._Job1.HasLoadedOrAssignedValue == false)))
    2588         {
    2589           this.SendPropertyChanging();
    2590           if ((previousValue != null))
    2591           {
    2592             this._Job1.Entity = null;
    2593             previousValue.Jobs.Remove(this);
    2594           }
    2595           this._Job1.Entity = value;
    2596           if ((value != null))
    2597           {
    2598             value.Jobs.Add(this);
    2599             this._ParentJobId = value.JobId;
    2600           }
    2601           else
    2602           {
    2603             this._ParentJobId = default(Nullable<System.Guid>);
    2604           }
    2605           this.SendPropertyChanged("Job1");
    2606         }
    2607       }
    2608     }
    2609    
    2610     [Association(Name="Project_Job", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="SET NULL")]
    2611     public Project Project
    2612     {
    2613       get
    2614       {
    2615         return this._Project.Entity;
    2616       }
    2617       set
    2618       {
    2619         Project previousValue = this._Project.Entity;
    2620         if (((previousValue != value)
    2621               || (this._Project.HasLoadedOrAssignedValue == false)))
    2622         {
    2623           this.SendPropertyChanging();
    2624           if ((previousValue != null))
    2625           {
    2626             this._Project.Entity = null;
    2627             previousValue.Jobs.Remove(this);
    2628           }
    2629           this._Project.Entity = value;
    2630           if ((value != null))
    2631           {
    2632             value.Jobs.Add(this);
    2633             this._ProjectId = value.ProjectId;
    2634           }
    2635           else
    2636           {
    2637             this._ProjectId = default(Nullable<System.Guid>);
    2638           }
    2639           this.SendPropertyChanged("Project");
    26402280        }
    26412281      }
     
    29452585    }
    29462586  }
     2587 
     2588  [Table(Name="dbo.Client")]
     2589  public partial class Client : INotifyPropertyChanging, INotifyPropertyChanged
     2590  {
     2591   
     2592    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     2593   
     2594    private System.Guid _ResourceId;
     2595   
     2596    private int _CPUSpeed;
     2597   
     2598    private int _Memory;
     2599   
     2600    private System.DateTime _Login;
     2601   
     2602    private string _Status;
     2603   
     2604    private string _CalendarSyncStatus;
     2605   
     2606    private System.Nullable<System.Guid> _UseCalendarFromResourceId;
     2607   
     2608    private System.Nullable<System.Guid> _ClientConfigId;
     2609   
     2610    private int _NumberOfCores;
     2611   
     2612    private int _NumberOfFreeCores;
     2613   
     2614    private int _FreeMemory;
     2615   
     2616    private EntitySet<UptimeStatistic> _UptimeStatistics;
     2617   
     2618    private EntitySet<Job> _Jobs;
     2619   
     2620    private EntityRef<Resource> _Resource;
     2621   
     2622    private EntityRef<Resource> _Resource1;
     2623   
     2624    private EntityRef<ClientConfig> _ClientConfig;
     2625   
     2626    #region Extensibility Method Definitions
     2627    partial void OnLoaded();
     2628    partial void OnValidate(System.Data.Linq.ChangeAction action);
     2629    partial void OnCreated();
     2630    partial void OnResourceIdChanging(System.Guid value);
     2631    partial void OnResourceIdChanged();
     2632    partial void OnCPUSpeedChanging(int value);
     2633    partial void OnCPUSpeedChanged();
     2634    partial void OnMemoryChanging(int value);
     2635    partial void OnMemoryChanged();
     2636    partial void OnLoginChanging(System.DateTime value);
     2637    partial void OnLoginChanged();
     2638    partial void OnStatusChanging(string value);
     2639    partial void OnStatusChanged();
     2640    partial void OnCalendarSyncStatusChanging(string value);
     2641    partial void OnCalendarSyncStatusChanged();
     2642    partial void OnUseCalendarFromResourceIdChanging(System.Nullable<System.Guid> value);
     2643    partial void OnUseCalendarFromResourceIdChanged();
     2644    partial void OnClientConfigIdChanging(System.Nullable<System.Guid> value);
     2645    partial void OnClientConfigIdChanged();
     2646    partial void OnNumberOfCoresChanging(int value);
     2647    partial void OnNumberOfCoresChanged();
     2648    partial void OnNumberOfFreeCoresChanging(int value);
     2649    partial void OnNumberOfFreeCoresChanged();
     2650    partial void OnFreeMemoryChanging(int value);
     2651    partial void OnFreeMemoryChanged();
     2652    #endregion
     2653   
     2654    public Client()
     2655    {
     2656      this._UptimeStatistics = new EntitySet<UptimeStatistic>(new Action<UptimeStatistic>(this.attach_UptimeStatistics), new Action<UptimeStatistic>(this.detach_UptimeStatistics));
     2657      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
     2658      this._Resource = default(EntityRef<Resource>);
     2659      this._Resource1 = default(EntityRef<Resource>);
     2660      this._ClientConfig = default(EntityRef<ClientConfig>);
     2661      OnCreated();
     2662    }
     2663   
     2664    [Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     2665    public System.Guid ResourceId
     2666    {
     2667      get
     2668      {
     2669        return this._ResourceId;
     2670      }
     2671      set
     2672      {
     2673        if ((this._ResourceId != value))
     2674        {
     2675          if (this._Resource.HasLoadedOrAssignedValue)
     2676          {
     2677            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     2678          }
     2679          this.OnResourceIdChanging(value);
     2680          this.SendPropertyChanging();
     2681          this._ResourceId = value;
     2682          this.SendPropertyChanged("ResourceId");
     2683          this.OnResourceIdChanged();
     2684        }
     2685      }
     2686    }
     2687   
     2688    [Column(Storage="_CPUSpeed", DbType="Int NOT NULL")]
     2689    public int CPUSpeed
     2690    {
     2691      get
     2692      {
     2693        return this._CPUSpeed;
     2694      }
     2695      set
     2696      {
     2697        if ((this._CPUSpeed != value))
     2698        {
     2699          this.OnCPUSpeedChanging(value);
     2700          this.SendPropertyChanging();
     2701          this._CPUSpeed = value;
     2702          this.SendPropertyChanged("CPUSpeed");
     2703          this.OnCPUSpeedChanged();
     2704        }
     2705      }
     2706    }
     2707   
     2708    [Column(Storage="_Memory", DbType="Int NOT NULL")]
     2709    public int Memory
     2710    {
     2711      get
     2712      {
     2713        return this._Memory;
     2714      }
     2715      set
     2716      {
     2717        if ((this._Memory != value))
     2718        {
     2719          this.OnMemoryChanging(value);
     2720          this.SendPropertyChanging();
     2721          this._Memory = value;
     2722          this.SendPropertyChanged("Memory");
     2723          this.OnMemoryChanged();
     2724        }
     2725      }
     2726    }
     2727   
     2728    [Column(Storage="_Login", DbType="DateTime NOT NULL")]
     2729    public System.DateTime Login
     2730    {
     2731      get
     2732      {
     2733        return this._Login;
     2734      }
     2735      set
     2736      {
     2737        if ((this._Login != value))
     2738        {
     2739          this.OnLoginChanging(value);
     2740          this.SendPropertyChanging();
     2741          this._Login = value;
     2742          this.SendPropertyChanged("Login");
     2743          this.OnLoginChanged();
     2744        }
     2745      }
     2746    }
     2747   
     2748    [Column(Storage="_Status", DbType="VarChar(MAX)")]
     2749    public string Status
     2750    {
     2751      get
     2752      {
     2753        return this._Status;
     2754      }
     2755      set
     2756      {
     2757        if ((this._Status != value))
     2758        {
     2759          this.OnStatusChanging(value);
     2760          this.SendPropertyChanging();
     2761          this._Status = value;
     2762          this.SendPropertyChanged("Status");
     2763          this.OnStatusChanged();
     2764        }
     2765      }
     2766    }
     2767   
     2768    [Column(Storage="_CalendarSyncStatus", DbType="VarChar(MAX)")]
     2769    public string CalendarSyncStatus
     2770    {
     2771      get
     2772      {
     2773        return this._CalendarSyncStatus;
     2774      }
     2775      set
     2776      {
     2777        if ((this._CalendarSyncStatus != value))
     2778        {
     2779          this.OnCalendarSyncStatusChanging(value);
     2780          this.SendPropertyChanging();
     2781          this._CalendarSyncStatus = value;
     2782          this.SendPropertyChanged("CalendarSyncStatus");
     2783          this.OnCalendarSyncStatusChanged();
     2784        }
     2785      }
     2786    }
     2787   
     2788    [Column(Storage="_UseCalendarFromResourceId", DbType="UniqueIdentifier")]
     2789    public System.Nullable<System.Guid> UseCalendarFromResourceId
     2790    {
     2791      get
     2792      {
     2793        return this._UseCalendarFromResourceId;
     2794      }
     2795      set
     2796      {
     2797        if ((this._UseCalendarFromResourceId != value))
     2798        {
     2799          this.OnUseCalendarFromResourceIdChanging(value);
     2800          this.SendPropertyChanging();
     2801          this._UseCalendarFromResourceId = value;
     2802          this.SendPropertyChanged("UseCalendarFromResourceId");
     2803          this.OnUseCalendarFromResourceIdChanged();
     2804        }
     2805      }
     2806    }
     2807   
     2808    [Column(Storage="_ClientConfigId", DbType="UniqueIdentifier")]
     2809    public System.Nullable<System.Guid> ClientConfigId
     2810    {
     2811      get
     2812      {
     2813        return this._ClientConfigId;
     2814      }
     2815      set
     2816      {
     2817        if ((this._ClientConfigId != value))
     2818        {
     2819          if (this._ClientConfig.HasLoadedOrAssignedValue)
     2820          {
     2821            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     2822          }
     2823          this.OnClientConfigIdChanging(value);
     2824          this.SendPropertyChanging();
     2825          this._ClientConfigId = value;
     2826          this.SendPropertyChanged("ClientConfigId");
     2827          this.OnClientConfigIdChanged();
     2828        }
     2829      }
     2830    }
     2831   
     2832    [Column(Storage="_NumberOfCores", DbType="Int NOT NULL")]
     2833    public int NumberOfCores
     2834    {
     2835      get
     2836      {
     2837        return this._NumberOfCores;
     2838      }
     2839      set
     2840      {
     2841        if ((this._NumberOfCores != value))
     2842        {
     2843          this.OnNumberOfCoresChanging(value);
     2844          this.SendPropertyChanging();
     2845          this._NumberOfCores = value;
     2846          this.SendPropertyChanged("NumberOfCores");
     2847          this.OnNumberOfCoresChanged();
     2848        }
     2849      }
     2850    }
     2851   
     2852    [Column(Storage="_NumberOfFreeCores", DbType="Int NOT NULL")]
     2853    public int NumberOfFreeCores
     2854    {
     2855      get
     2856      {
     2857        return this._NumberOfFreeCores;
     2858      }
     2859      set
     2860      {
     2861        if ((this._NumberOfFreeCores != value))
     2862        {
     2863          this.OnNumberOfFreeCoresChanging(value);
     2864          this.SendPropertyChanging();
     2865          this._NumberOfFreeCores = value;
     2866          this.SendPropertyChanged("NumberOfFreeCores");
     2867          this.OnNumberOfFreeCoresChanged();
     2868        }
     2869      }
     2870    }
     2871   
     2872    [Column(Storage="_FreeMemory", DbType="Int NOT NULL")]
     2873    public int FreeMemory
     2874    {
     2875      get
     2876      {
     2877        return this._FreeMemory;
     2878      }
     2879      set
     2880      {
     2881        if ((this._FreeMemory != value))
     2882        {
     2883          this.OnFreeMemoryChanging(value);
     2884          this.SendPropertyChanging();
     2885          this._FreeMemory = value;
     2886          this.SendPropertyChanged("FreeMemory");
     2887          this.OnFreeMemoryChanged();
     2888        }
     2889      }
     2890    }
     2891   
     2892    [Association(Name="Client_UptimeStatistic", Storage="_UptimeStatistics", ThisKey="ResourceId", OtherKey="ResourceId")]
     2893    public EntitySet<UptimeStatistic> UptimeStatistics
     2894    {
     2895      get
     2896      {
     2897        return this._UptimeStatistics;
     2898      }
     2899      set
     2900      {
     2901        this._UptimeStatistics.Assign(value);
     2902      }
     2903    }
     2904   
     2905    [Association(Name="Client_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="ResourceId")]
     2906    public EntitySet<Job> Jobs
     2907    {
     2908      get
     2909      {
     2910        return this._Jobs;
     2911      }
     2912      set
     2913      {
     2914        this._Jobs.Assign(value);
     2915      }
     2916    }
     2917   
     2918    [Association(Name="Resource_Client", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
     2919    public Resource Resource
     2920    {
     2921      get
     2922      {
     2923        return this._Resource.Entity;
     2924      }
     2925      set
     2926      {
     2927        Resource previousValue = this._Resource.Entity;
     2928        if (((previousValue != value)
     2929              || (this._Resource.HasLoadedOrAssignedValue == false)))
     2930        {
     2931          this.SendPropertyChanging();
     2932          if ((previousValue != null))
     2933          {
     2934            this._Resource.Entity = null;
     2935            previousValue.Client = null;
     2936          }
     2937          this._Resource.Entity = value;
     2938          if ((value != null))
     2939          {
     2940            value.Client = this;
     2941            this._ResourceId = value.ResourceId;
     2942          }
     2943          else
     2944          {
     2945            this._ResourceId = default(System.Guid);
     2946          }
     2947          this.SendPropertyChanged("Resource");
     2948        }
     2949      }
     2950    }
     2951   
     2952    [Association(Name="Resource_Client1", Storage="_Resource1", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
     2953    public Resource Resource1
     2954    {
     2955      get
     2956      {
     2957        return this._Resource1.Entity;
     2958      }
     2959      set
     2960      {
     2961        Resource previousValue = this._Resource1.Entity;
     2962        if (((previousValue != value)
     2963              || (this._Resource1.HasLoadedOrAssignedValue == false)))
     2964        {
     2965          this.SendPropertyChanging();
     2966          if ((previousValue != null))
     2967          {
     2968            this._Resource1.Entity = null;
     2969            previousValue.Client1 = null;
     2970          }
     2971          this._Resource1.Entity = value;
     2972          if ((value != null))
     2973          {
     2974            value.Client1 = this;
     2975            this._ResourceId = value.ResourceId;
     2976          }
     2977          else
     2978          {
     2979            this._ResourceId = default(System.Guid);
     2980          }
     2981          this.SendPropertyChanged("Resource1");
     2982        }
     2983      }
     2984    }
     2985   
     2986    [Association(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")]
     2987    public ClientConfig ClientConfig
     2988    {
     2989      get
     2990      {
     2991        return this._ClientConfig.Entity;
     2992      }
     2993      set
     2994      {
     2995        ClientConfig previousValue = this._ClientConfig.Entity;
     2996        if (((previousValue != value)
     2997              || (this._ClientConfig.HasLoadedOrAssignedValue == false)))
     2998        {
     2999          this.SendPropertyChanging();
     3000          if ((previousValue != null))
     3001          {
     3002            this._ClientConfig.Entity = null;
     3003            previousValue.Clients.Remove(this);
     3004          }
     3005          this._ClientConfig.Entity = value;
     3006          if ((value != null))
     3007          {
     3008            value.Clients.Add(this);
     3009            this._ClientConfigId = value.ClientConfigId;
     3010          }
     3011          else
     3012          {
     3013            this._ClientConfigId = default(Nullable<System.Guid>);
     3014          }
     3015          this.SendPropertyChanged("ClientConfig");
     3016        }
     3017      }
     3018    }
     3019   
     3020    public event PropertyChangingEventHandler PropertyChanging;
     3021   
     3022    public event PropertyChangedEventHandler PropertyChanged;
     3023   
     3024    protected virtual void SendPropertyChanging()
     3025    {
     3026      if ((this.PropertyChanging != null))
     3027      {
     3028        this.PropertyChanging(this, emptyChangingEventArgs);
     3029      }
     3030    }
     3031   
     3032    protected virtual void SendPropertyChanged(String propertyName)
     3033    {
     3034      if ((this.PropertyChanged != null))
     3035      {
     3036        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     3037      }
     3038    }
     3039   
     3040    private void attach_UptimeStatistics(UptimeStatistic entity)
     3041    {
     3042      this.SendPropertyChanging();
     3043      entity.Client = this;
     3044    }
     3045   
     3046    private void detach_UptimeStatistics(UptimeStatistic entity)
     3047    {
     3048      this.SendPropertyChanging();
     3049      entity.Client = null;
     3050    }
     3051   
     3052    private void attach_Jobs(Job entity)
     3053    {
     3054      this.SendPropertyChanging();
     3055      entity.Client = this;
     3056    }
     3057   
     3058    private void detach_Jobs(Job entity)
     3059    {
     3060      this.SendPropertyChanging();
     3061      entity.Client = null;
     3062    }
     3063  }
    29473064}
    29483065#pragma warning restore 1591
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs

    r3022 r3203  
    9696
    9797      Context.SubmitChanges();           
     98    }   
     99
     100    public IEnumerable<AppointmentDto> GetCalendarForClient(ClientDto client) {
     101      Client dbc = Context.Clients.SingleOrDefault(c => c.ResourceId.Equals(client.Id));
     102      IList<AppointmentDto> appointments = new List<AppointmentDto>();
     103      if (dbc != null) {
     104        ClientGroup cg =
     105          Context.ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId));
     106        //in case no plan has been set
     107        if (cg == null)
     108          if (dbc.Resource.ClientGroup_Resources.FirstOrDefault() != null)
     109            cg = dbc.Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;
     110
     111        if (cg == null)
     112          return appointments;
     113
     114        while (cg.Resource.UptimeCalendars.Count == 0) {
     115          if (cg.Resource.ClientGroup_Resources.FirstOrDefault() != null)
     116            cg = cg.Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;
     117          else {
     118            break;
     119          }
     120        }
     121
     122        foreach (UptimeCalendar appointment in cg.Resource.UptimeCalendars) {
     123          appointments.Add(EntityToDto(appointment,null)); 
     124        }
     125
     126      }
     127      return appointments;
     128    }
     129
     130    public void NotifyClientsOfNewCalendar(Guid groupId, bool forcePush) {
     131     
     132      //Get the current ClientGroup
     133      ClientGroup cg = Context.ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(groupId));
     134      if(cg == null)
     135        return;
     136
     137      //Get all the affected clients
     138      List<Client> clients = Context.Clients.Where(c => c.UseCalendarFromResourceId.Equals(cg.ResourceId)).ToList();
     139     
     140      //Set new state
     141      foreach (Client client in clients) {
     142        client.CalendarSyncStatus = (forcePush ? Enum.GetName(typeof(CalendarState), CalendarState.ForceFetch) : Enum.GetName(typeof(CalendarState), CalendarState.Fetch));     
     143      }
     144     
     145      Context.SubmitChanges();
     146
     147      //Get all Subgroups
     148      List<ClientGroup> groups = (from cg1 in Context.ClientGroups
     149                                  where cg1.Resource.ClientGroup_Resources.Any(
     150                                cgr => cgr.ClientGroupId.Equals(groupId))
     151                              select cg1).ToList();
     152
     153      //If they have their own calendar - stop propagation
     154      //otherweise - propagate
     155      foreach (ClientGroup cgroup in groups) {
     156        if(cgroup.Resource.UptimeCalendars.Count == 0)
     157          NotifyClientsOfNewCalendar(groupId, forcePush);       
     158      }
    98159    }
    99160
Note: See TracChangeset for help on using the changeset viewer.