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++;
                    }
                }
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 4
0
        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 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++;
                }
            }
        }
Esempio n. 6
0
        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
        }