Changeset 6451 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administration/3.4/Views/ScheduleView.cs
- Timestamp:
- 06/20/11 14:06:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administration/3.4/Views/ScheduleView.cs
r6437 r6451 72 72 73 73 foreach (HiveAppointment app in offlineTimes) { 74 if (app.StartDate >= e.StartDate && app.StartDate <= e.EndDate ) {74 if (app.StartDate >= e.StartDate && app.StartDate <= e.EndDate && !app.Deleted) { 75 75 apps.Add(app); 76 76 } … … 103 103 Locked = true, 104 104 Subject = "Offline", 105 Changed = false 105 Changed = false, 106 Id = app.Id 106 107 }); 107 108 } … … 169 170 170 171 private void DeleteRecurringAppointment(Guid recurringId) { 171 offlineTimes.RemoveAll(a => a.RecurringId.ToString() == ((HiveAppointment)dvOnline.SelectedAppointment).RecurringId.ToString()); 172 foreach (HiveAppointment app in offlineTimes) { 173 if (app.RecurringId == recurringId) { 174 app.Deleted = true; 175 } 176 } 172 177 } 173 178 … … 217 222 218 223 private void DeleteAppointment() { 219 offlineTimes.Remove((HiveAppointment)dvOnline.SelectedAppointment); 224 try { 225 HiveAppointment app = offlineTimes.First(s => s.Equals((HiveAppointment)dvOnline.SelectedAppointment)); 226 app.Deleted = true; 227 } 228 catch (InvalidOperationException) { 229 // this is a ui bug where a selected all day appointment is not properly selected :-/ 230 } 220 231 } 221 232 … … 246 257 247 258 private void btnClearCal_Click(object sender, System.EventArgs e) { 248 offlineTimes.Clear(); 259 foreach (HiveAppointment app in offlineTimes) { 260 app.Deleted = true; 261 } 262 dvOnline.Invalidate(); 249 263 } 250 264 … … 319 333 List<Appointment> appointments = new List<Appointment>(); 320 334 foreach (HiveAppointment app in offlineTimes) { 321 if (app.Changed) { 335 if (app.Deleted) { 336 ServiceLocator.Instance.CallHiveService(service => { 337 if (app.Id != Guid.Empty) { 338 service.DeleteAppointment(app.Id); 339 } 340 }); 341 } else if (app.Changed) { 322 342 Appointment apdto = new Appointment { 323 343 AllDayEvent = app.AllDayEvent, … … 339 359 } 340 360 }); 341 342 //TODO: refresh Content343 361 } 344 362 }
Note: See TracChangeset
for help on using the changeset viewer.