Changeset 3931 for branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs
- Timestamp:
- 06/19/10 09:17:24 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs
r3578 r3931 99 99 100 100 public IEnumerable<AppointmentDto> GetCalendarForClient(ClientDto client) { 101 Client dbc = Context. Clients.SingleOrDefault(c => c.ResourceId.Equals(client.Id));101 Client dbc = Context.Resources.OfType<Client>().SingleOrDefault(c => c.ResourceId.Equals(client.Id)); 102 102 IList<AppointmentDto> appointments = new List<AppointmentDto>(); 103 103 if (dbc != null) { 104 104 ClientGroup cg = 105 Context. ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId));105 Context.Resources.OfType<ClientGroup>().SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId)); 106 106 //in case no plan has been set 107 107 if (cg == null) 108 if (dbc. Resource.ClientGroup_Resources.FirstOrDefault() != null)109 cg = dbc. Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;108 if (dbc.ClientGroup_Resources_Parents.FirstOrDefault() != null) 109 cg = dbc.ClientGroup_Resources_Parents.FirstOrDefault().ClientGroup; 110 110 111 111 if (cg == null) 112 112 return appointments; 113 113 114 while (cg. Resource.UptimeCalendars.Count == 0) {115 if (cg. Resource.ClientGroup_Resources.FirstOrDefault() != null)116 cg = cg. Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;114 while (cg.UptimeCalendars.Count == 0) { 115 if (cg.ClientGroup_Resources_Parents.FirstOrDefault() != null) 116 cg = cg.ClientGroup_Resources_Parents.FirstOrDefault().ClientGroup; 117 117 else { 118 118 break; … … 120 120 } 121 121 122 foreach (UptimeCalendar appointment in cg. Resource.UptimeCalendars) {122 foreach (UptimeCalendar appointment in cg.UptimeCalendars) { 123 123 appointments.Add(EntityToDto(appointment,null)); 124 124 } … … 131 131 132 132 //Get the current ClientGroup 133 ClientGroup cg = Context. ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(groupId));133 ClientGroup cg = Context.Resources.OfType<ClientGroup>().SingleOrDefault(cgroup => cgroup.ResourceId.Equals(groupId)); 134 134 if(cg == null) 135 135 return; 136 136 137 137 //Get all the affected clients 138 List<Client> clients = Context. Clients.Where(c => c.UseCalendarFromResourceId.Equals(cg.ResourceId)).ToList();138 List<Client> clients = Context.Resources.OfType<Client>().Where(c => c.UseCalendarFromResourceId.Equals(cg.ResourceId)).ToList(); 139 139 140 140 //Set new state … … 146 146 147 147 //Get all Subgroups 148 List<ClientGroup> groups = (from cg1 in Context. ClientGroups149 where cg1. Resource.ClientGroup_Resources.Any(148 List<ClientGroup> groups = (from cg1 in Context.Resources.OfType<ClientGroup>() 149 where cg1.ClientGroup_Resources_Parents.Any( 150 150 cgr => cgr.ClientGroupId.Equals(groupId)) 151 151 select cg1).ToList(); … … 154 154 //otherweise - propagate 155 155 foreach (ClientGroup cgroup in groups) { 156 if(cgroup. Resource.UptimeCalendars.Count == 0)157 NotifyClientsOfNewCalendar( groupId, forcePush);156 if(cgroup.UptimeCalendars.Count == 0) 157 NotifyClientsOfNewCalendar(cgroup.ResourceId, forcePush); 158 158 } 159 159 }
Note: See TracChangeset
for help on using the changeset viewer.