private void btnSaveCal_Click(object sender, EventArgs e) { if (HiveAdminClient.Instance.DowntimeForResourceId == null || HiveAdminClient.Instance.DowntimeForResourceId == Guid.Empty) { MessageBox.Show("You have to save the group before you can save the schedule. ", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { List <Downtime> downtimes = new List <Downtime>(); foreach (HiveDowntime downtime in offlineTimes) { if (downtime.Deleted && downtime.Id != Guid.Empty) { HiveAdminClient.Delete(ToDowntime(downtime)); } else if (downtime.Changed || downtime.Id == null || downtime.Id == Guid.Empty) { Downtime dt = ToDowntime(downtime); downtimes.Add(dt); } } foreach (Downtime dt in downtimes) { dt.Store(); } } }
public static void ToEntity(DT.Downtime source, Downtime target) { if ((source != null) && (target != null)) { target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; } }
public int CompareTo(Solution b) { int cmp = AllTime.CompareTo(b.AllTime); if (cmp != 0) { return(cmp); } return(Downtime.CompareTo(b.Downtime)); }
public static Downtime ToEntity(DT.Downtime source) { if (source == null) { return(null); } var entity = new Downtime(); ToEntity(source, entity); return(entity); }
public static DT.Downtime ToDto(Downtime source) { if (source == null) { return(null); } return(new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate }); }
private Downtime ToDowntime(HiveDowntime hiveDowntime) { Downtime downtime = new Downtime { AllDayEvent = hiveDowntime.AllDayEvent, EndDate = hiveDowntime.EndDate, StartDate = hiveDowntime.StartDate, Recurring = hiveDowntime.Recurring, RecurringId = hiveDowntime.RecurringId, ResourceId = HiveAdminClient.Instance.DowntimeForResourceId, Id = hiveDowntime.Id, DowntimeType = (DowntimeType)Enum.Parse(typeof(DowntimeType), hiveDowntime.Subject) }; return(downtime); }
private HiveDowntime ToHiveDowntime(Downtime downtime) { HiveDowntime hiveDowntime = new HiveDowntime { AllDayEvent = downtime.AllDayEvent, EndDate = downtime.EndDate, StartDate = downtime.StartDate, Recurring = downtime.Recurring, RecurringId = downtime.RecurringId, Deleted = false, BorderColor = Color.Red, Locked = true, Subject = downtime.DowntimeType.ToString(), Changed = downtime.Modified, Id = downtime.Id }; return(hiveDowntime); }
private Downtime ToDowntime(HiveDowntime hiveDowntime) { Downtime downtime = new Downtime { AllDayEvent = hiveDowntime.AllDayEvent, EndDate = hiveDowntime.EndDate, StartDate = hiveDowntime.StartDate, Recurring = hiveDowntime.Recurring, RecurringId = hiveDowntime.RecurringId, ResourceId = HiveAdminClient.Instance.DowntimeForResourceId, Id = hiveDowntime.Id, DowntimeType = (DowntimeType)Enum.Parse(typeof(DowntimeType), hiveDowntime.Subject) }; return downtime; }
private HiveDowntime ToHiveDowntime(Downtime downtime) { HiveDowntime hiveDowntime = new HiveDowntime { AllDayEvent = downtime.AllDayEvent, EndDate = downtime.EndDate, StartDate = downtime.StartDate, Recurring = downtime.Recurring, RecurringId = downtime.RecurringId, Deleted = false, BorderColor = Color.Red, Locked = true, Subject = downtime.DowntimeType.ToString(), Changed = downtime.Modified, Id = downtime.Id }; return hiveDowntime; }