protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); ViewItem item = View.FindItem("Label"); SchedulerLabelPropertyEditor editor = item != null ? item as SchedulerLabelPropertyEditor : null; if (editor != null && editor.Control != null) { ISchedulerStorage storage = ((AppointmentLabelEdit)editor.Control).Storage; IAppointmentLabelStorage labelStorage = storage.Appointments.Labels; labelStorage.Clear(); int i = 0; IAppointmentLabel label = labelStorage.CreateNewLabel(i, "Нет", "Нет"); label.SetColor(Color.White); labelStorage.Add(label); i++; using (IObjectSpace os = Application.CreateObjectSpace()) { IList <DoctorEventLabel> labels = os.GetObjects <DoctorEventLabel>(); foreach (var doctorEventLabel in labels) { label = labelStorage.CreateNewLabel(i, doctorEventLabel.Name, doctorEventLabel.Name); label.SetColor(doctorEventLabel.Color); labelStorage.Add(label); i++; } } } }
static void CustomLabelsAndStatusesAction(SchedulerControl scheduler) { #region #CustomLabelsAndStatuses scheduler.Storage.Appointments.Clear(); string[] IssueList = { "Consultation", "Treatment", "X-Ray" }; Color[] IssueColorList = { Color.Ivory, Color.Pink, Color.Plum }; string[] PaymentStatuses = { "Paid", "Unpaid" }; Color[] PaymentColorStatuses = { Color.Green, Color.Red }; IAppointmentLabelStorage labelStorage = scheduler.Storage.Appointments.Labels; labelStorage.Clear(); int count = IssueList.Length; for (int i = 0; i < count; i++) { IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]); label.SetColor(IssueColorList[i]); labelStorage.Add(label); } AppointmentStatusCollection statusColl = scheduler.Storage.Appointments.Statuses; statusColl.Clear(); count = PaymentStatuses.Length; for (int i = 0; i < count; i++) { AppointmentStatus status = statusColl.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]); status.SetBrush(new SolidBrush(PaymentColorStatuses[i])); statusColl.Add(status); } #endregion #CustomLabelsAndStatuses }
void AddAppointmentLabel(object id, string displayName, Color color) { IAppointmentLabel label = this.schedulerStorage1.Appointments.Labels.CreateNewLabel(id, displayName); label.SetColor(color); this.schedulerStorage1.Appointments.Labels.Add(label); }
public static void scheduler_InitAppointmentDisplayText(object sender, AppointmentDisplayTextEventArgs e) { SchedulerControl scheduler = sender as SchedulerControl; IAppointmentLabel label = scheduler.DataStorage.Appointments.Labels.GetById(e.Appointment.LabelKey); e.Description = String.Format("Label Info:\nDisplayName = '{0}'\nID = '{1}'", label.DisplayName, label.Id.ToString()); }
public override void DataBind() { base.DataBind(); AppointmentFormTemplateContainer container = (AppointmentFormTemplateContainer)Parent; Appointment apt = container.Appointment; IAppointmentStorageBase appointmentStorage = container.Control.Storage.Appointments; IAppointmentLabel label = appointmentStorage.Labels.GetById(apt.LabelKey); IAppointmentStatus status = appointmentStorage.Statuses.GetById(apt.StatusKey); edtLabel.SelectedIndex = appointmentStorage.Labels.IndexOf(label); edtStatus.SelectedIndex = appointmentStorage.Statuses.IndexOf(status); PopulateResourceEditors(apt, container); chkRecurrence.Visible = container.ShouldShowRecurrence; //AppointmentRecurrenceForm1.Visible = container.ShouldShowRecurrence; if (container.Appointment.HasReminder) { cbReminder.Value = container.Appointment.Reminder.TimeBeforeStart.ToString(); chkReminder.Checked = true; } else { cbReminder.ClientEnabled = false; } btnOk.ClientSideEvents.Click = container.SaveHandler; btnCancel.ClientSideEvents.Click = container.CancelHandler; btnDelete.ClientSideEvents.Click = container.DeleteHandler; }
void scheduler_AppointmentViewInfoCustomizing(object sender, DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs e) { AppointmentViewInfo viewInfo = e.ViewInfo; if (chkCustomText.IsChecked.GetValueOrDefault()) { UpdateText(viewInfo); } CustomAppointmentData data = new CustomAppointmentData(); data.Filtered = false; data.ShowImages = chkCustomImage.IsChecked.GetValueOrDefault(); viewInfo.CustomViewInfo = data; if (!IsEmptyFilter(cbSearch.Text)) { string searchText = cbSearch.Text.ToUpper(); if (IsAppointmentFiltered(searchText, e.ViewInfo.Appointment)) { data.Filtered = true; } } if (!data.Filtered) { IAppointmentLabel label = this.scheduler.Storage.AppointmentStorage.Labels.CreateNewLabel(string.Empty); label.SetColor(Colors.LightGray); viewInfo.Label = label; IAppointmentStatus status = this.scheduler.Storage.AppointmentStorage.Statuses.CreateNewStatus(string.Empty, string.Empty); status.Type = AppointmentStatusType.Custom; status.SetBrush(new SolidColorBrush(Colors.LightGray)); viewInfo.Status = status; } }
private void FillSportsComboBox() { cbSports.BeginInit(); for (int i = 0; i < scheduler.Storage.AppointmentStorage.Labels.Count; i++) { IAppointmentLabel lab = scheduler.Storage.AppointmentStorage.Labels.GetByIndex(i); int index = cbSports.Items.Add(lab.DisplayName); cbSports.SelectedItems.Add(cbSports.Items[index]); } cbSports.EndInit(); }
public override void DataBind() { base.DataBind(); AppointmentFormTemplateContainer container = (AppointmentFormTemplateContainer)Parent; Appointment apt = container.Appointment; IAppointmentStorageBase appointmentStorage = container.Control.Storage.Appointments; IAppointmentLabel label = appointmentStorage.Labels.GetById(apt.LabelKey); IAppointmentStatus status = appointmentStorage.Statuses.GetById(apt.StatusKey); edtLabel.ValueType = apt.LabelKey.GetType(); edtLabel.SelectedIndex = appointmentStorage.Labels.IndexOf(label); edtStatus.ValueType = apt.StatusKey.GetType(); edtStatus.SelectedIndex = appointmentStorage.Statuses.IndexOf(status); PopulateResourceEditors(apt, container); BindSubjectCombobox(); cbSubject.Value = container.Subject; tbCustomInfo.Text = container.Appointment.CustomFields["ApptCustomInfo"] != null ? container.Appointment.CustomFields["ApptCustomInfo"].ToString() : ""; AppointmentRecurrenceForm1.Visible = container.ShouldShowRecurrence; if (apt.HasReminder) { cbReminder.Value = apt.Reminder.TimeBeforeStart.ToString(); chkReminder.Checked = true; } else { cbReminder.ClientEnabled = false; } if (TimeZonesEnabled) { cbTimeZone.DataSource = TimeZoneInfo.GetSystemTimeZones(); cbTimeZone.ValueField = "Id"; cbTimeZone.TextField = "DisplayName"; cbTimeZone.DataBind(); cbTimeZone.Value = container.TimeZoneId; cbTimeZone.Enabled = apt.Type == AppointmentType.Normal || apt.Type == AppointmentType.Pattern; } //btnOk.ClientSideEvents.Click = container.SaveHandler; btnCancel.ClientSideEvents.Click = container.CancelHandler; btnDelete.ClientSideEvents.Click = container.DeleteHandler; JSProperties.Add("cpHasExceptions", apt.HasExceptions); //btnDelete.Enabled = !container.IsNewAppointment; }
static void CustomLabelsAndStatusesAction(SchedulerControl scheduler) { #region #CustomLabelsAndStatuses scheduler.Storage.AppointmentStorage.Clear(); string[] IssueList = { "Consultation", "Treatment", "X-Ray" }; Color[] IssueColorList = { Colors.Ivory, Colors.Pink, Colors.Plum }; string[] PaymentStatuses = { "Paid", "Unpaid" }; Color[] PaymentColorStatuses = { Colors.Green, Colors.Red }; IAppointmentLabelStorage labelStorage = scheduler.Storage.AppointmentStorage.Labels; labelStorage.Clear(); int count = IssueList.Length; for (int i = 0; i < count; i++) { IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]); label.SetColor(IssueColorList[i]); labelStorage.Add(label); } IAppointmentStatusStorage statusStorage = scheduler.Storage.AppointmentStorage.Statuses; statusStorage.Clear(); count = PaymentStatuses.Length; for (int i = 0; i < count; i++) { IAppointmentStatus status = statusStorage.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]); status.SetBrush(new SolidColorBrush(PaymentColorStatuses[i])); statusStorage.Add(status); } // Create a new appointment. Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Normal); apt.Subject = "Test"; apt.Start = DateTime.Now; apt.End = DateTime.Now.AddHours(2); apt.ResourceId = scheduler.Storage.ResourceStorage[0].Id; apt.LabelKey = labelStorage.GetByIndex(2).Id; scheduler.Storage.AppointmentStorage.Add(apt); #endregion #CustomLabelsAndStatuses }
private void FillLabelStorage(IAppointmentLabelStorage labelStorage) { labelStorage.Clear(); int i = 0; using (IObjectSpace os = Application.CreateObjectSpace()) { IAppointmentLabel label = labelStorage.CreateNewLabel(i, "Нет", "Нет"); label.SetColor(Color.White); labelStorage.Add(label); i++; IList <DoctorEventLabel> labels = os.GetObjects <DoctorEventLabel>(); foreach (var doctorEventLabel in labels) { label = labelStorage.CreateNewLabel(i, doctorEventLabel.Name, doctorEventLabel.Name); label.SetColor(doctorEventLabel.Color); labelStorage.Add(label); i++; } } }
public object Convert(object obj, Type targetType, object parameter) { IAppointmentLabel lbl = storage.Appointments.Labels.FirstOrDefault(label => label.GetColor().ToArgb() == (int)obj); return((lbl != null) ? lbl.Id : CreateNewLabel((int)obj)); }