- Timestamp:
- 04/16/13 13:13:41 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 6 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Clients.Hive.Administrator.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.Administrator.Views { 2 23 partial class Recurrence { 3 24 /// <summary> … … 42 63 this.cbTuesday = new System.Windows.Forms.CheckBox(); 43 64 this.cbMonday = new System.Windows.Forms.CheckBox(); 65 this.appointmentTypeView = new HeuristicLab.Clients.Hive.Administrator.Views.DowntimeTypeView(); 66 this.gbDowntimeType = new System.Windows.Forms.GroupBox(); 44 67 this.gbAppointment.SuspendLayout(); 45 68 this.gbWeekly.SuspendLayout(); 69 this.gbDowntimeType.SuspendLayout(); 46 70 this.SuspendLayout(); 47 71 // … … 82 106 // dtpToTime 83 107 // 84 this.dtpToTime.CustomFormat = "HH: 00";108 this.dtpToTime.CustomFormat = "HH:mm"; 85 109 this.dtpToTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 86 110 this.dtpToTime.Location = new System.Drawing.Point(226, 56); … … 109 133 // dtpFromTime 110 134 // 111 this.dtpFromTime.CustomFormat = "HH: 00";135 this.dtpFromTime.CustomFormat = "HH:mm"; 112 136 this.dtpFromTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 113 137 this.dtpFromTime.Location = new System.Drawing.Point(226, 19); … … 128 152 // btSaveRecurrence 129 153 // 130 this.btSaveRecurrence.Location = new System.Drawing.Point(2, 2 17);154 this.btSaveRecurrence.Location = new System.Drawing.Point(2, 298); 131 155 this.btSaveRecurrence.Name = "btSaveRecurrence"; 132 156 this.btSaveRecurrence.Size = new System.Drawing.Size(147, 23); … … 138 162 // btCancelRecurrence 139 163 // 140 this.btCancelRecurrence.Location = new System.Drawing.Point(241, 2 17);164 this.btCancelRecurrence.Location = new System.Drawing.Point(241, 298); 141 165 this.btCancelRecurrence.Name = "btCancelRecurrence"; 142 166 this.btCancelRecurrence.Size = new System.Drawing.Size(147, 23); … … 232 256 this.cbMonday.UseVisualStyleBackColor = true; 233 257 // 258 // appointmentTypeView 259 // 260 this.appointmentTypeView.DowntimeType = HeuristicLab.Clients.Hive.DowntimeType.Offline; 261 this.appointmentTypeView.Location = new System.Drawing.Point(10, 19); 262 this.appointmentTypeView.Name = "appointmentTypeView"; 263 this.appointmentTypeView.Size = new System.Drawing.Size(120, 50); 264 this.appointmentTypeView.TabIndex = 45; 265 // 266 // gbDowntimeType 267 // 268 this.gbDowntimeType.Controls.Add(this.appointmentTypeView); 269 this.gbDowntimeType.Location = new System.Drawing.Point(2, 217); 270 this.gbDowntimeType.Name = "gbDowntimeType"; 271 this.gbDowntimeType.Size = new System.Drawing.Size(386, 75); 272 this.gbDowntimeType.TabIndex = 46; 273 this.gbDowntimeType.TabStop = false; 274 this.gbDowntimeType.Text = "Type of Downtime"; 275 // 234 276 // Recurrence 235 277 // 236 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);237 278 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 238 this.ClientSize = new System.Drawing.Size(393, 243); 279 this.ClientSize = new System.Drawing.Size(393, 332); 280 this.Controls.Add(this.gbDowntimeType); 239 281 this.Controls.Add(this.gbWeekly); 240 282 this.Controls.Add(this.btCancelRecurrence); … … 242 284 this.Controls.Add(this.gbAppointment); 243 285 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 244 this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon;245 286 this.Name = "Recurrence"; 287 this.ShowIcon = false; 288 this.ShowInTaskbar = false; 246 289 this.Text = "Recurrence"; 290 this.TopMost = true; 247 291 this.gbAppointment.ResumeLayout(false); 248 292 this.gbAppointment.PerformLayout(); 249 293 this.gbWeekly.ResumeLayout(false); 250 294 this.gbWeekly.PerformLayout(); 295 this.gbDowntimeType.ResumeLayout(false); 251 296 this.ResumeLayout(false); 252 297 … … 273 318 private System.Windows.Forms.CheckBox cbTuesday; 274 319 private System.Windows.Forms.CheckBox cbMonday; 320 private DowntimeTypeView appointmentTypeView; 321 private System.Windows.Forms.GroupBox gbDowntimeType; 275 322 } 276 323 } -
branches/OaaS/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.cs
r7259 r9363 53 53 DateTo = dateTo, 54 54 AllDay = chbade.Checked, 55 WeekDays = days 55 WeekDays = days, 56 DowntimeType = appointmentTypeView.DowntimeType 56 57 }; 57 58 -
branches/OaaS/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r8089 r9363 437 437 438 438 try { 439 if (!Access.UserInformation.Instance.UserExists) { 440 //do a refresh just in case that the user has changed his usr and pwd in between 441 Access.UserInformation.Instance.Refresh(); 442 } 439 443 HiveAdminClient.Instance.Refresh(); 440 444 Content = HiveAdminClient.Instance.Resources; -
branches/OaaS/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.Designer.cs
r8058 r9363 71 71 this.dvOnline.ActiveTool = drawTool1; 72 72 this.dvOnline.AmPmDisplay = false; 73 this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 74 | System.Windows.Forms.AnchorStyles.Left) 73 this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 74 | System.Windows.Forms.AnchorStyles.Left) 75 75 | System.Windows.Forms.AnchorStyles.Right))); 76 76 this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes; … … 96 96 // txttimeTo 97 97 // 98 this.txttimeTo.CustomFormat = "HH: 00";98 this.txttimeTo.CustomFormat = "HH:mm"; 99 99 this.txttimeTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 100 100 this.txttimeTo.Location = new System.Drawing.Point(164, 45); … … 106 106 // txttimeFrom 107 107 // 108 this.txttimeFrom.CustomFormat = "HH: 00";108 this.txttimeFrom.CustomFormat = "HH:mm"; 109 109 this.txttimeFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 110 110 this.txttimeFrom.Location = new System.Drawing.Point(164, 12); … … 212 212 this.btCreate.Size = new System.Drawing.Size(242, 26); 213 213 this.btCreate.TabIndex = 20; 214 this.btCreate.Text = "Create Appointment";215 this.toolTip.SetToolTip(this.btCreate, "Create a new appointmentin the calender");214 this.btCreate.Text = "Create Downtime"; 215 this.toolTip.SetToolTip(this.btCreate, "Create a new downtime in the calender"); 216 216 this.btCreate.UseVisualStyleBackColor = true; 217 217 this.btCreate.Click += new System.EventHandler(this.btCreate_Click); … … 247 247 // mcOnline 248 248 // 249 this.mcOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 249 this.mcOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 250 250 | System.Windows.Forms.AnchorStyles.Right))); 251 251 this.mcOnline.CalendarDimensions = new System.Drawing.Size(2, 1); -
branches/OaaS/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r8075 r9363 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using System.Xml.Serialization;28 27 using Calendar; 29 28 using HeuristicLab.Core; … … 40 39 } 41 40 42 [XmlArray("Appointments")] 43 [XmlArrayItem("HiveAppointment", typeof(HiveAppointment))] 44 public List<HiveAppointment> offlineTimes = new List<HiveAppointment>(); 41 public List<HiveDowntime> offlineTimes = new List<HiveDowntime>(); 45 42 46 43 //delegate fired, if a dialog is being closed … … 59 56 60 57 private void dvOnline_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs e) { 61 List<Hive Appointment> apps = new List<HiveAppointment>();62 63 foreach (Hive Appointmentapp in offlineTimes) {58 List<HiveDowntime> apps = new List<HiveDowntime>(); 59 60 foreach (HiveDowntime app in offlineTimes) { 64 61 if (app.StartDate >= e.StartDate && app.StartDate <= e.EndDate && !app.Deleted) { 65 62 apps.Add(app); … … 68 65 69 66 e.Appointments.Clear(); 70 foreach (Hive Appointmentapp in apps) {67 foreach (HiveDowntime app in apps) { 71 68 e.Appointments.Add(app); 72 69 } … … 74 71 75 72 private void dvOnline_OnNewAppointment(object sender, NewAppointmentEventArgs e) { 76 Hive Appointment Appointment = new HiveAppointment();77 78 Appointment.StartDate = e.StartDate;79 Appointment.EndDate = e.EndDate;80 offlineTimes.Add( Appointment);73 HiveDowntime downtime = new HiveDowntime(); 74 75 downtime.StartDate = e.StartDate; 76 downtime.EndDate = e.EndDate; 77 offlineTimes.Add(downtime); 81 78 } 82 79 … … 84 81 offlineTimes.Clear(); 85 82 if (Content != null) { 86 foreach (Downtime appin Content) {87 offlineTimes.Add(ToHive Appointment(app));88 } 89 } 90 dvOnline.Invalidate(); 91 } 92 93 private bool Create Appointment() {83 foreach (Downtime downtime in Content) { 84 offlineTimes.Add(ToHiveDowntime(downtime)); 85 } 86 } 87 dvOnline.Invalidate(); 88 } 89 90 private bool CreateDowntime(DowntimeType dtType) { 94 91 DateTime from, to; 95 92 … … 98 95 //whole day appointment, only dates are visible 99 96 if (DateTime.TryParse(dtpFrom.Text, out from) && DateTime.TryParse(dtpTo.Text, out to) && from <= to) 100 offlineTimes.Add(Create Appointment(from, to.AddDays(1), true));97 offlineTimes.Add(CreateDowntime(from, to.AddDays(1), true, dtType)); 101 98 else 102 99 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 105 102 if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to) { 106 103 if (from.Date == to.Date) 107 offlineTimes.Add(Create Appointment(from, to, false));104 offlineTimes.Add(CreateDowntime(from, to, false, dtType)); 108 105 else { 109 106 //more than 1 day selected 110 107 while (from.Date != to.Date) { 111 offlineTimes.Add(Create Appointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false));108 offlineTimes.Add(CreateDowntime(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType)); 112 109 from = from.AddDays(1); 113 110 } 114 offlineTimes.Add(Create Appointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false));111 offlineTimes.Add(CreateDowntime(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType)); 115 112 } 116 113 } else … … 120 117 return true; 121 118 } else { 122 MessageBox.Show("Error in create appointment, please fill out all textboxes!", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error);119 MessageBox.Show("Error creating downtime, please fill out all textboxes!", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 123 120 return false; 124 121 } 125 122 } 126 123 127 private Hive Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay) {128 Hive Appointment app = new HiveAppointment();129 app.StartDate = startDate;130 app.EndDate = endDate;131 app.AllDayEvent = allDay;132 app.BorderColor = Color.Red;133 app.Locked = true;134 app.Subject = "Offline";135 app.Recurring = false;136 return app;137 } 138 139 private Hive Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay, bool recurring, Guid recurringId) {140 Hive Appointment app = new HiveAppointment();141 app.StartDate = startDate;142 app.EndDate = endDate;143 app.AllDayEvent = allDay;144 app.BorderColor = Color.Red;145 app.Locked = true;146 app.Subject = "Offline";147 app.Recurring = recurring;148 app.RecurringId = recurringId;149 return app;150 } 151 152 private void DeleteRecurring Appointment(Guid recurringId) {153 foreach (Hive Appointment appin offlineTimes) {154 if ( app.RecurringId == recurringId) {155 app.Deleted = true;156 } 157 } 158 } 159 160 private void ChangeRecurrence Appointment(Guid recurringId) {124 private HiveDowntime CreateDowntime(DateTime startDate, DateTime endDate, bool allDay, DowntimeType downtimeType) { 125 HiveDowntime downtime = new HiveDowntime(); 126 downtime.StartDate = startDate; 127 downtime.EndDate = endDate; 128 downtime.AllDayEvent = allDay; 129 downtime.BorderColor = Color.Red; 130 downtime.Locked = true; 131 downtime.Subject = downtimeType.ToString(); 132 downtime.Recurring = false; 133 return downtime; 134 } 135 136 private HiveDowntime CreateDowntime(DateTime startDate, DateTime endDate, bool allDay, bool recurring, Guid recurringId, DowntimeType downtimeType) { 137 HiveDowntime downtime = new HiveDowntime(); 138 downtime.StartDate = startDate; 139 downtime.EndDate = endDate; 140 downtime.AllDayEvent = allDay; 141 downtime.BorderColor = Color.Red; 142 downtime.Locked = true; 143 downtime.Subject = downtimeType.ToString(); 144 downtime.Recurring = recurring; 145 downtime.RecurringId = recurringId; 146 return downtime; 147 } 148 149 private void DeleteRecurringDowntime(Guid recurringId) { 150 foreach (HiveDowntime downtime in offlineTimes) { 151 if (downtime.RecurringId == recurringId) { 152 downtime.Deleted = true; 153 } 154 } 155 } 156 157 private void ChangeRecurrenceDowntime(Guid recurringId) { 161 158 int hourfrom = int.Parse(txttimeFrom.Text.Substring(0, txttimeFrom.Text.IndexOf(':'))); 162 159 int hourTo = int.Parse(txttimeTo.Text.Substring(0, txttimeTo.Text.IndexOf(':'))); 163 List<HiveAppointment> recurringAppointments = offlineTimes.Where(appointment => ((HiveAppointment)appointment).RecurringId == recurringId).ToList(); 164 recurringAppointments.ForEach(appointment => appointment.StartDate = new DateTime(appointment.StartDate.Year, appointment.StartDate.Month, appointment.StartDate.Day, hourfrom, 0, 0)); 165 recurringAppointments.ForEach(appointment => appointment.EndDate = new DateTime(appointment.EndDate.Year, appointment.EndDate.Month, appointment.EndDate.Day, hourTo, 0, 0)); 166 167 DeleteRecurringAppointment(recurringId); 168 offlineTimes.AddRange(recurringAppointments); 160 List<HiveDowntime> recurringDowntimes = offlineTimes.Where(appointment => ((HiveDowntime)appointment).RecurringId == recurringId).ToList(); 161 recurringDowntimes.ForEach(appointment => appointment.StartDate = new DateTime(appointment.StartDate.Year, appointment.StartDate.Month, appointment.StartDate.Day, hourfrom, 0, 0)); 162 recurringDowntimes.ForEach(appointment => appointment.EndDate = new DateTime(appointment.EndDate.Year, appointment.EndDate.Month, appointment.EndDate.Day, hourTo, 0, 0)); 169 163 } 170 164 171 165 public void DialogClosed(RecurrentEvent e) { 172 CreateDailyRecurrence Appointments(e.DateFrom, e.DateTo, e.AllDay, e.WeekDays);173 } 174 175 private void CreateDailyRecurrence Appointments(DateTime dateFrom, DateTime dateTo, bool allDay, HashSet<DayOfWeek> daysOfWeek) {166 CreateDailyRecurrenceDowntimes(e.DateFrom, e.DateTo, e.AllDay, e.WeekDays, e.DowntimeType); 167 } 168 169 private void CreateDailyRecurrenceDowntimes(DateTime dateFrom, DateTime dateTo, bool allDay, HashSet<DayOfWeek> daysOfWeek, DowntimeType appointmentType) { 176 170 DateTime incDate = dateFrom; 177 171 Guid guid = Guid.NewGuid(); … … 179 173 while (incDate.Date <= dateTo.Date) { 180 174 if (daysOfWeek.Contains(incDate.Date.DayOfWeek)) 181 offlineTimes.Add(Create Appointment(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid));175 offlineTimes.Add(CreateDowntime(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid, appointmentType)); 182 176 incDate = incDate.AddDays(1); 183 177 } … … 187 181 188 182 private void btbDelete_Click(object sender, EventArgs e) { 189 Hive Appointment selectedAppointment = (HiveAppointment)dvOnline.SelectedAppointment;183 HiveDowntime selectedDowntime = (HiveDowntime)dvOnline.SelectedAppointment; 190 184 if (dvOnline.SelectedAppointment != null) { 191 if (!selected Appointment.Recurring)192 Delete Appointment();185 if (!selectedDowntime.Recurring) 186 DeleteDowntime(); 193 187 else { 194 188 DialogResult res = MessageBox.Show("Delete all events in this series?", "Delete recurrences", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 195 189 if (res != DialogResult.Yes) 196 Delete Appointment();190 DeleteDowntime(); 197 191 else 198 DeleteRecurring Appointment(selectedAppointment.RecurringId);199 } 200 } 201 dvOnline.Invalidate(); 202 } 203 204 private void Delete Appointment() {192 DeleteRecurringDowntime(selectedDowntime.RecurringId); 193 } 194 } 195 dvOnline.Invalidate(); 196 } 197 198 private void DeleteDowntime() { 205 199 try { 206 Hive Appointment app = offlineTimes.First(s => s.Equals((HiveAppointment)dvOnline.SelectedAppointment));207 app.Deleted = true;200 HiveDowntime downtime = offlineTimes.First(s => s.Equals((HiveDowntime)dvOnline.SelectedAppointment)); 201 downtime.Deleted = true; 208 202 } 209 203 catch (InvalidOperationException) { … … 242 236 243 237 private void btnClearCal_Click(object sender, System.EventArgs e) { 244 foreach (Hive Appointmentapp in offlineTimes) {238 foreach (HiveDowntime app in offlineTimes) { 245 239 app.Deleted = true; 246 240 } … … 259 253 txttimeFrom.Text = dvOnline.SelectionStart.ToShortTimeString(); 260 254 txttimeTo.Text = dvOnline.SelectionEnd.ToShortTimeString(); 261 btCreate.Text = "Create Appointment";255 btCreate.Text = "Create Downtime"; 262 256 } 263 257 … … 274 268 if (dvOnline.Selection == SelectionType.None) { 275 269 //also change the caption of the save button 276 btCreate.Text = "Create Appointment";270 btCreate.Text = "Create Downtime"; 277 271 } 278 272 } … … 284 278 private void btCreate_Click(object sender, EventArgs e) { 285 279 if (dvOnline.Selection != SelectionType.Appointment) { 286 CreateAppointment(); 280 DowntimeType dtType; 281 DialogResult result; 282 DowntimeTypeDialog dialog = new DowntimeTypeDialog(); 283 result = dialog.ShowDialog(this); 284 dtType = dialog.AppointmentType; 285 dialog.Dispose(); 286 if (result == DialogResult.Cancel) return; 287 CreateDowntime(dtType); 287 288 } else { 288 289 //now we want to change an existing appointment 289 290 if (!dvOnline.SelectedAppointment.Recurring) { 290 if (Create Appointment())291 Delete Appointment();291 if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) 292 DeleteDowntime(); 292 293 } else { 293 294 //change recurring appointment … … 295 296 DialogResult res = MessageBox.Show("Change all events in this series?", "Change recurrences", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 296 297 if (res != DialogResult.Yes) { 297 if (Create Appointment())298 Delete Appointment();298 if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) 299 DeleteDowntime(); 299 300 } else 300 ChangeRecurrence Appointment(((HiveAppointment)dvOnline.SelectedAppointment).RecurringId);301 ChangeRecurrenceDowntime(((HiveDowntime)dvOnline.SelectedAppointment).RecurringId); 301 302 } 302 303 } … … 312 313 private void btnSaveCal_Click(object sender, EventArgs e) { 313 314 if (HiveAdminClient.Instance.DowntimeForResourceId == null || HiveAdminClient.Instance.DowntimeForResourceId == Guid.Empty) { 314 MessageBox.Show("You have to save the g oup before you can save the schedule. ", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Stop);315 MessageBox.Show("You have to save the group before you can save the schedule. ", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Stop); 315 316 } else { 316 List<Downtime> appointments = new List<Downtime>();317 foreach (Hive Appointment appin offlineTimes) {318 if ( app.Deleted && app.Id != Guid.Empty) {319 HiveAdminClient.Delete(ToDowntime( app));320 } else if ( app.Changed || app.Id == null || app.Id == Guid.Empty) {321 Downtime dt = ToDowntime( app);322 appointments.Add(dt);317 List<Downtime> downtimes = new List<Downtime>(); 318 foreach (HiveDowntime downtime in offlineTimes) { 319 if (downtime.Deleted && downtime.Id != Guid.Empty) { 320 HiveAdminClient.Delete(ToDowntime(downtime)); 321 } else if (downtime.Changed || downtime.Id == null || downtime.Id == Guid.Empty) { 322 Downtime dt = ToDowntime(downtime); 323 downtimes.Add(dt); 323 324 } 324 325 } 325 foreach (Downtime dt in appointments) {326 foreach (Downtime dt in downtimes) { 326 327 dt.Store(); 327 328 } … … 329 330 } 330 331 331 private Hive Appointment ToHiveAppointment(Downtime downtime) {332 Hive Appointment app = new HiveAppointment{332 private HiveDowntime ToHiveDowntime(Downtime downtime) { 333 HiveDowntime hiveDowntime = new HiveDowntime { 333 334 AllDayEvent = downtime.AllDayEvent, 334 335 EndDate = downtime.EndDate, … … 339 340 BorderColor = Color.Red, 340 341 Locked = true, 341 Subject = "Offline",342 Subject = downtime.DowntimeType.ToString(), 342 343 Changed = downtime.Modified, 343 344 Id = downtime.Id 344 345 }; 345 return app;346 } 347 348 private Downtime ToDowntime(Hive Appointment app) {346 return hiveDowntime; 347 } 348 349 private Downtime ToDowntime(HiveDowntime hiveDowntime) { 349 350 Downtime downtime = new Downtime { 350 AllDayEvent = app.AllDayEvent,351 EndDate = app.EndDate,352 StartDate = app.StartDate,353 Recurring = app.Recurring,354 RecurringId = app.RecurringId,351 AllDayEvent = hiveDowntime.AllDayEvent, 352 EndDate = hiveDowntime.EndDate, 353 StartDate = hiveDowntime.StartDate, 354 Recurring = hiveDowntime.Recurring, 355 RecurringId = hiveDowntime.RecurringId, 355 356 ResourceId = HiveAdminClient.Instance.DowntimeForResourceId, 356 Id = app.Id 357 Id = hiveDowntime.Id, 358 DowntimeType = (DowntimeType)Enum.Parse(typeof(DowntimeType), hiveDowntime.Subject) 357 359 }; 358 360 return downtime; 359 361 } 362 363 private DowntimeType GetDowntimeTypeOfSelectedDowntime() { 364 return (DowntimeType)Enum.Parse(typeof(DowntimeType), ((HiveDowntime)dvOnline.SelectedAppointment).Subject); 365 } 360 366 } 361 367 }
Note: See TracChangeset
for help on using the changeset viewer.