コード例 #1
0
        public JarsDefaultAppointmentEditForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm)
        {
            Guard.ArgumentNotNull(control, "control");
            Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage");
            Guard.ArgumentNotNull(apt, "apt");

            this.openRecurrenceForm = openRecurrenceForm;
            this.controller         = CreateController(control, apt);
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SetupPredefinedConstraints();

            LoadIcons();

            this.control = control;
            this.storage = control.DataStorage;

            this.riAppointmentResource.SchedulerControl = control;
            this.riAppointmentResource.Storage          = storage;
            this.riAppointmentStatus.Storage            = storage;

            this.riAppointmentLabel.Storage = storage;

            BindControllerToControls();

            LookAndFeel.ParentLookAndFeel = control.LookAndFeel;

            this.supressCancelCore = false;
        }
コード例 #2
0
        public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm)
        {
            Guard.ArgumentNotNull(control, "control");
            Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage");
            Guard.ArgumentNotNull(apt, "apt");

            this.openRecurrenceForm = openRecurrenceForm;
            this.controller         = CreateController(control, apt);
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SetupPredefinedConstraints();

            LoadIcons();

            this.control = control;
            this.storage = control.DataStorage;

            this.edtShowTimeAs.Storage         = this.storage;
            this.edtLabel.Storage              = this.storage;
            this.edtResource.SchedulerControl  = control;
            this.edtResource.Storage           = this.storage;
            this.edtResources.SchedulerControl = control;

            SubscribeControllerEvents(Controller);
            SubscribeEditorsEvents();
            BindControllerToControls();
        }
コード例 #3
0
        public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm)
        {
            abc = apt;
            Guard.ArgumentNotNull(control, "control");
            Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage");
            Guard.ArgumentNotNull(apt, "apt");

            this.openRecurrenceForm = openRecurrenceForm;
            this.controller         = CreateController(control, apt);
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SetupPredefinedConstraints();
            veri.Database.Connection.ConnectionString = AnaForm.cstr;

            LoadIcons();

            this.control = control;
            this.storage = control.DataStorage;


            this.edtLabel.Storage = this.storage;



            SubscribeControllerEvents(Controller);
            SubscribeEditorsEvents();
            BindControllerToControls();
            this.Load += CustomAppointmentForm_Load;
        }
コード例 #4
0
        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++;
                    }
                }
            }
        }
コード例 #5
0
        protected override void LoadResources()
        {
            base.LoadResources();

            if (this.schedulerData == null)
            {
                return;
            }

            ISchedulerStorage <IResource> resourceStorage = this.schedulerData.GetResourceStorage();

            this.listResources.Items.Clear();

            if (this.schedulerData.GroupType == GroupType.None)
            {
                RadListDataItem item = new RadListDataItem("None");
                item.Value = -1;
                this.listResources.Items.Add(item);
            }

            foreach (IResource resource in resourceStorage)
            {
                if (resource.Visible)
                {
                    RadListDataItem item = new RadListDataItem(resource.Name);
                    item.Value = resource.Id;
                    this.listResources.Items.Add(item);
                }
            }

            if (this.listResources.Items.Count > 0)
            {
                this.listResources.SelectedIndex = 0;
            }
        }
 public static void GenerateAppointments(ISchedulerStorage storage, int aptsPerDay) {
     storage.BeginUpdate();
     Random rnd = new Random();
     DateTime start = DateTime.Today.AddDays(-DAY_COUNT / 2);
     for (int i = 0; i <= DAY_COUNT * aptsPerDay; i++) {
         storage.Appointments.Add(CreateNewAppointment(storage, i, aptsPerDay, rnd, start));
     }
     storage.EndUpdate();
 }
        static Appointment CreateNewAppointment(ISchedulerStorage storage, int index, int aptsPerDay, Random rnd, DateTime start) {
            int day = index / aptsPerDay;

            Appointment apt = storage.CreateAppointment(AppointmentType.Normal);
            apt.SetId(index + 1);
            apt.Start = start.AddDays(day).AddHours(GetRandomDouble(rnd, 0, 18));
            apt.End = apt.Start.AddHours(GetRandomDouble(rnd, 0.5, 6.0));
            int subjectIndex = rnd.Next(0, subjects.Length);
            apt.Subject = subjects[subjectIndex];
            apt.LabelKey = rnd.Next(1, 12);
            apt.ResourceId = rnd.Next(0, resources.Length);
            return apt;
        }
 public static void FillResources(ISchedulerStorage storage, int count) {
     ResourceCollection resources = storage.Resources.Items;
     storage.BeginUpdate();
     try {
         int cnt = Math.Min(count, SchedulerHelper.resources.Length);
         for (int i = 1; i <= cnt; i++) {
             Resource resource = storage.CreateResource(i);
             resource.Caption = SchedulerHelper.resources[i - 1];
             resources.Add(resource);
         }
     }
     finally {
         storage.EndUpdate();
     }
 }
コード例 #9
0
        public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm)
        {
            Guard.ArgumentNotNull(control, "control");
            Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage");
            Guard.ArgumentNotNull(apt, "apt");

            this.openRecurrenceForm = openRecurrenceForm;
            this.controller         = CreateController(control, apt);
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            LoadIcons();

            this.control = control;
            this.storage = control.DataStorage;

            SubscribeControllerEvents(Controller);
            BindControllerToControls();
        }
コード例 #10
0
        public OutlookAppointmentForm(DevExpress.XtraScheduler.SchedulerControl control, Appointment apt, String parentTaskTemplateId, bool openRecurrenceForm)
        {
            Guard.ArgumentNotNull(control, "control");
            Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage");
            Guard.ArgumentNotNull(apt, "apt");

            this.openRecurrenceForm = openRecurrenceForm;
            this.controller         = CreateController(control, apt);
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SetupPredefinedConstraints();

            LoadIcons();

            this.control = control;
            this.storage = control.DataStorage;

            this.edtResource.SchedulerControl  = control;
            this.edtResource.Storage           = this.storage;
            this.edtResources.SchedulerControl = control;

            this.riAppointmentResource.SchedulerControl = control;
            this.riAppointmentResource.Storage          = this.storage;
            this.riAppointmentStatus.Storage            = this.storage;

            this.riAppointmentLabel.Storage = this.storage;

            BindControllerToControls();

            LookAndFeel.ParentLookAndFeel = control.LookAndFeel;

            this.supressCancelCore = false;

            //  取得上级任务节点
            this.parentTaskTemplateId = parentTaskTemplateId;
        }
コード例 #11
0
        private void LoadStatuses()
        {
            if (this.schedulerData == null)
            {
                return;
            }

            ISchedulerStorage <IAppointmentStatusInfo> statusStorage = this.schedulerData.GetStatusStorage();

            this.cmbShowTimeAs.BeginUpdate();
            this.cmbShowTimeAs.Items.Clear();
            foreach (IAppointmentStatusInfo status in statusStorage)
            {
                this.cmbShowTimeAs.Items.Add(new RadListDataItem(status.DisplayName, status.Id));
            }

            if (this.cmbShowTimeAs.Items.Count > 0)
            {
                this.cmbShowTimeAs.SelectedIndex = 0;
            }

            this.cmbShowTimeAs.EndUpdate();
        }
コード例 #12
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();

            ListView   listView   = View as ListView;
            DetailView detailView = View as DetailView;

            if (listView != null)
            {
                IObjectSpace os = Application.CreateObjectSpace();
                listView.CollectionSource.CriteriaApplied += (o, e) =>
                {
                    // Предварительная загрузка расписаний докторов
                    var collectionSB = (CollectionSourceBase)o;
                    if (collectionSB.Criteria != null)
                    {
                        var events = new List <DoctorEvent>(os.GetObjects <DoctorEvent>(collectionSB.Criteria[FILTERKEY]));
                        eventsDict = events.ToDictionary(de => de.Oid, de => de);
                    }
                };

                SchedulerListEditor listEditor = ((ListView)View).Editor as SchedulerListEditor;
                if (listEditor != null)
                {
                    SchedulerControl scheduler = listEditor.SchedulerControl;
                    if (scheduler != null)
                    {
                        // Кастомизация надписи в расписании доктора
                        scheduler.InitAppointmentDisplayText += (o, e) =>
                        {
                            Guid guid = (Guid)e.Appointment.Id;
                            if (eventsDict.ContainsKey(guid))
                            {
                                var doctorEvent = eventsDict[guid];
                                e.Text = doctorEvent != null && doctorEvent.Pacient != null ? doctorEvent.Pacient.FullName : string.Empty;
                            }
                        };

                        #region Кастомизация Тултипа расписания доктора

                        // https://documentation.devexpress.com/WindowsForms/118551/Controls-and-Libraries/Scheduler/Visual-Elements/Scheduler-Control/Appointment-Flyout
                        scheduler.OptionsView.ToolTipVisibility = ToolTipVisibility.Always;
                        scheduler.OptionsCustomization.AllowDisplayAppointmentFlyout = false;
                        scheduler.ToolTipController             = new ToolTipController();
                        scheduler.ToolTipController.ToolTipType = ToolTipType.SuperTip;
                        scheduler.ToolTipController.BeforeShow += (o, e) =>
                        {
                            var toolTipController           = (ToolTipController)o;
                            AppointmentViewInfo aptViewInfo = null;
                            try
                            {
                                aptViewInfo = (AppointmentViewInfo)toolTipController.ActiveObject;
                            }
                            catch
                            {
                                return;
                            }

                            if (aptViewInfo == null)
                            {
                                return;
                            }

                            Guid guid = (Guid)aptViewInfo.Appointment.Id;
                            if (!eventsDict.ContainsKey(guid))
                            {
                                // В словаре нет ключа т.к. расписание было только что создано
                                var events = new List <DoctorEvent>(ObjectSpace.GetObjects <DoctorEvent>(listView.CollectionSource.Criteria[FILTERKEY]));
                                eventsDict = events.ToDictionary(de => de.Oid, de => de);
                            }
                            DoctorEvent doctorEvent = eventsDict[guid];
                            // Вид талона (метка)
                            AppointmentLabel label = scheduler.Storage.Appointments.Labels.GetById(doctorEvent.Label);
                            StringBuilder    sb    = new StringBuilder();
                            sb.AppendLine(string.Format("Время: с {0:HH:mm} по {1:HH:mm}", doctorEvent.StartOn, doctorEvent.EndOn));
                            sb.AppendLine(string.Format("Пациент: {0}", doctorEvent.Pacient != null ? doctorEvent.Pacient.FullName : null));
                            sb.AppendLine(string.Format("Кем создано: {0}", doctorEvent.CreatedBy != null ? doctorEvent.CreatedBy.FullName : null));
                            sb.AppendLine(string.Format("Кто записал: {0}", doctorEvent.EditedBy != null ? doctorEvent.EditedBy.FullName : null));
                            sb.AppendLine(string.Format("Вид талона: {0}", label.DisplayName));
                            if (doctorEvent.Pacient != null)
                            {
                                sb.AppendLine(string.Format("Источник записи: {0}", CaptionHelper.GetDisplayText(doctorEvent.SourceType)));
                            }

                            SuperToolTip          SuperTip = new SuperToolTip();
                            SuperToolTipSetupArgs args     = new SuperToolTipSetupArgs();
                            args.Contents.Text = sb.ToString();
                            args.Contents.Font = new Font("Times New Roman", 11);
                            SuperTip.Setup(args);
                            e.SuperTip = SuperTip;
                        };

                        #endregion

                        // Кастомизация коллекции меток
                        var storage = scheduler.Storage;
                        IAppointmentLabelStorage labelStorage = storage.Appointments.Labels;
                        FillLabelStorage(labelStorage);

                        #region Кастомизация всплывающего меню на расписании врача
                        DoctorEvent recordedEvent = null;
                        VisitCase   visitCase     = null;

                        // Всплывающее меню на расписании врача
                        scheduler.PopupMenuShowing += (o, e) =>
                        {
                            Pacient pacient = listView.Tag as Pacient;
                            AppointmentBaseCollection appoinments = (o as SchedulerControl).SelectedAppointments;
                            Appointment appoinment = appoinments.Count == 1 ? appoinments[0] : null;
                            if (appoinment == null)
                            {
                                return;
                            }

                            Guid        key    = (Guid)appoinment.Id;
                            DoctorEvent dEvent = appoinment != null && eventsDict.ContainsKey(key) ? eventsDict[key] : null;

                            if (e.Menu.Id != DevExpress.XtraScheduler.SchedulerMenuItemId.AppointmentMenu)
                            {
                                return;
                            }
                            if (pacient != null && dEvent.Pacient == null & recordedEvent == null && dEvent.StartOn > DateTime.Now)
                            {
                                e.Menu.Items.Insert(0, new SchedulerMenuItem("Записать пациента", (o_, e_) =>
                                {
                                    IObjectSpace dEventObjectSpace = XPObjectSpace.FindObjectSpaceByObject(dEvent);
                                    dEvent.Pacient = dEventObjectSpace.GetObject(pacient);
                                    dEventObjectSpace.CommitChanges();
                                    // Обновление списочного представления
                                    listView.CollectionSource.Reload();
                                    // Расписание на которое записан пациент
                                    recordedEvent = dEvent;
                                    // Создание посещения для пациента
                                    visitCase = VisitCase.CreateVisitCase(dEventObjectSpace,
                                                                          dEventObjectSpace.GetObject(pacient),
                                                                          dEvent.AssignedTo, dEvent.StartOn);
                                    dEventObjectSpace.CommitChanges();
                                }));
                            }
                            else if (dEvent != null && dEvent.Pacient != null)
                            {
                                e.Menu.Items.Insert(0, new SchedulerMenuItem("Отменить запись", (o_, e_) =>
                                {
                                    IObjectSpace dEventObjectSpace = XPObjectSpace.FindObjectSpaceByObject(dEvent);
                                    dEvent.Pacient = null;
                                    dEventObjectSpace.CommitChanges();
                                    // Обновление списочного представления
                                    listView.CollectionSource.Reload();
                                    // Отмена записи пациента на выбранное расписание
                                    if (recordedEvent != null && recordedEvent.Oid == dEvent.Oid)
                                    {
                                        recordedEvent = null;
                                    }
                                    if (visitCase != null)
                                    {
                                        dEventObjectSpace.Delete(visitCase);
                                        dEventObjectSpace.CommitChanges();
                                    }
                                }));
                            }
                        };

                        #endregion

                        // Кастомизация цвета фона расписания:
                        // Если выбранный пациент уже записан, то цвет расписания окрашивается в светло-розовый.
                        // Если в расписании записан другой пациент, то цвет расписания окрашивается в морковный.
                        scheduler.AppointmentViewInfoCustomizing += (o_, e_) =>
                        {
                            Pacient pacient = listView.Tag as Pacient;
                            if (pacient != null)
                            {
                                Guid guid = (Guid)e_.ViewInfo.Appointment.Id;
                                if (eventsDict.ContainsKey(guid) && eventsDict[guid].Pacient != null)
                                {
                                    e_.ViewInfo.Appearance.BackColor = eventsDict[guid].Pacient.Oid == pacient.Oid ?
                                                                       Color.FromArgb(255, 192, 192) : Color.FromArgb(255, 128, 0);
                                }
                            }
                        };
                    }
                }
            }
            else if (detailView != null)
            {
                // Кастомизация коллекции меток
                foreach (SchedulerLabelPropertyEditor pe in ((DetailView)View).GetItems <SchedulerLabelPropertyEditor>())
                {
                    if (pe.Control != null)
                    {
                        ISchedulerStorage        storage      = ((AppointmentLabelEdit)pe.Control).Storage;
                        IAppointmentLabelStorage labelStorage = storage.Appointments.Labels;
                        FillLabelStorage(labelStorage);
                    }
                }
            }
        }
コード例 #13
0
ファイル: RemindersForm.cs プロジェクト: xyyhqq/eXpand
 public RemindersForm(XafApplication xafApplication, ISchedulerStorage storage)
     : base(storage)
 {
     _xafApplication = xafApplication;
 }
 public static void FillStorageData(ISchedulerStorage storage)
 {
     FillStorageCollection(storage.Resources.Items, resDataResourceName);
     FillStorageCollection(storage.Appointments.Items, aptDataResourceName);
 }