public void AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e, AppointmentStatusDataStorage statuses) { try { //apply the colours according to the value of the location. //e.ViewInfo.Appearance.BackColor <-- this is label colour //e.ViewInfo.Status <-- this is status strip colour (we set it on the appointment, not on the entity in "ENTITY" custom field. if (e.ViewInfo.Appointment.CustomFields != null) { if (e.ViewInfo.Appointment.CustomFields["ENTITY"] is IEntityWithProgressStatus) { Appointment appt = e.ViewInfo.Appointment; DataTable table = appt.CustomFields["ENTITY"].ConvertToDataTable();//TempDataTableCreator.CreateDataTableFromEntity(appt.CustomFields["ENTITY"]); ApptLabel label = GetApptLabel(table); ApptStatus status = GetApptStatus(table); if (label != null) { e.ViewInfo.Appearance.BackColor = Color.FromArgb(label.ColourRGB); } else { e.ViewInfo.Appearance.BackColor = Color.FromArgb(SchedulerLabels.First(l => l.SortIndex == 99).ColourRGB); } if (status != null) { e.ViewInfo.Status = statuses.Items.Find(s => s.Id.ToString() == status.Id.ToString()); } else { e.ViewInfo.Status = statuses.Items.CreateNewStatus(Guid.NewGuid(), "", "", new SolidBrush(Color.FromArgb(SchedulerStatuses.First(s => s.SortIndex == 99).ColourRGB))); } } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw ex; #endif } }
public void AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e, AppointmentStatusDataStorage statuses) { try { if (e.ViewInfo.Appointment.CustomFields != null) { if (e.ViewInfo.Appointment.CustomFields["ENTITY"] is IEntityWithStatusLabels) { Appointment appt = e.ViewInfo.Appointment; DataTable table = appt.CustomFields["ENTITY"].ConvertToDataTable(); ApptLabel label = GetApptLabel(table); ApptStatus status = GetApptStatus(table); if (label != null) { e.ViewInfo.Appearance.BackColor = Color.FromArgb(label.ColourRGB); } else { e.ViewInfo.Appearance.BackColor = Color.FromArgb(SchedulerLabels.First(l => l.SortIndex == 99).ColourRGB); } if (status != null) { e.ViewInfo.Status = statuses.Items.Find(s => s.Id.ToString() == status.Id.ToString()); } else { e.ViewInfo.Status = statuses.Items.CreateNewStatus(Guid.NewGuid(), "", "", new SolidBrush(Color.FromArgb(SchedulerStatuses.First(s => s.SortIndex == 99).ColourRGB))); } } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw ex; #endif } }