- Timestamp:
- 04/19/16 17:11:50 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Hubs/CalendarHub.cs
r13768 r13775 77 77 obj.AllDayEvent = false; 78 78 obj.ResourceId = Guid.Parse(s[4]); 79 adminClient.Store(obj, CancellationToken.None); 79 if (s[5] == "true") 80 { 81 obj.Recurring = true; 82 if (s[6] == "0") 83 { 84 var dayarr = s[9].Split(','); 85 var start = (new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse(s[7])); 86 var end = (new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse(s[8])); 87 loopAddDowns(start, end, dayarr, obj); 88 } 89 else 90 { 91 obj.RecurringId = Guid.Parse(s[6]); 92 adminClient.Store(obj, CancellationToken.None); 93 } 94 } 95 else { 96 obj.Recurring = false; 97 adminClient.Store(obj, CancellationToken.None); 98 } 99 100 80 101 } 81 102 foreach(var s in upd) … … 92 113 else 93 114 obj.AllDayEvent = false; 94 //adminClient.Store(obj, CancellationToken.None); Throws error 115 if (s[5] == "true" && !obj.Recurring) 116 { 117 obj.Recurring = true; 118 if (s[6] == "00000000-0000-0000-0000-000000000000") 119 { 120 var dayarr = s[9].Split(','); 121 var start = (new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse(s[7])); 122 var end = (new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse(s[8])); 123 //loopAddDowns(start, end, dayarr, obj); 124 } 125 else 126 { 127 obj.RecurringId = Guid.Parse(s[6]); 128 //adminClient.Store(obj, CancellationToken.None); //Throws error 129 } 130 } 131 else 132 { 133 //adminClient.Store(obj, CancellationToken.None); //Throws error 134 } 135 136 95 137 } 96 138 if( last) … … 103 145 } 104 146 } 147 private void loopAddDowns(DateTime start, DateTime end, string[] dayarr, Downtime obj) 148 { 149 var rid = Guid.NewGuid(); 150 for (; start < end;) 151 { 152 if (dayarr[(int)(start.DayOfWeek)] == "true") 153 { 154 var temp = new Downtime(); 155 temp.StartDate = start.AddHours(obj.StartDate.Hour - start.Hour).AddMinutes(obj.StartDate.Minute - start.Minute); 156 temp.EndDate = start.AddHours(obj.EndDate.Hour - start.Hour).AddMinutes(obj.EndDate.Minute - start.Minute); 157 temp.Id = obj.Id; 158 temp.DowntimeType = obj.DowntimeType; 159 temp.AllDayEvent = obj.AllDayEvent; 160 temp.ResourceId = obj.ResourceId; 161 temp.Recurring = obj.Recurring; 162 temp.RecurringId = rid; 163 adminClient.Store(temp, CancellationToken.None); 164 } 165 start = start.AddDays(1); 166 } 167 } 105 168 } 106 169 }
Note: See TracChangeset
for help on using the changeset viewer.