DevExpress XtraScheduler 自定义对话框

FrmEditSchedulInfo 是一个用于编辑 DevExpress XtraScheduler 中排课信息的窗体,允许用户自定义对话框。该窗体初始化组件并加载数据,如开始时间、结束时间、日期等,并提供了保存和加载排课数据的功能。同时,它还支持修改、新增排课信息,并处理预约冲突。窗体中的按钮事件如 Ok 和 Delete 分别对应保存和删除操作,RecurrenceButton 事件用于处理重复排课设置。
摘要由CSDN通过智能技术生成

using System;
using System.Drawing;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Localization;
using DevExpress.XtraScheduler.Native;
using DevExpress.XtraScheduler.UI;
using DevExpress.Utils;
using DevExpress.Utils.Menu;
using DevExpress.Utils.Internal;
using System.Collections.Generic;
using Common;

namespace Erp
{
    public partial class FrmEditSchedulInfo : XtraForm, IDXManagerPopupMenu
    {
        private UserRight UserRight;
        public string Sid = string.Empty;
        bool openRecurrenceForm;
        readonly ISchedulerStorage storage;
        readonly SchedulerControl control;
        Icon recurringIcon;
        Icon normalIcon;
        readonly AppointmentFormController controller;
        IDXMenuManager menuManager;

        [EditorBrowsable(EditorBrowsableState.Never)]
        public FrmEditSchedulInfo()
        {
            InitializeComponent();
        }

        public FrmEditSchedulInfo(SchedulerControl control, Appointment apt)
            : this(control, apt, false)
        {
        }
        public FrmEditSchedulInfo(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);
            InitializeComponent();
            SetupPredefinedConstraints();

            LoadIcons();

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

            SubscribeControllerEvents(Controller);
            BindControllerToControls();
            if (apt != null && apt.Id != null)
            {
                this.Sid = apt.Id.ToString();
            }

        }

        [Browsable(false)]
        public IDXMenuManager MenuManager { get { return this.menuManager; } private set { this.menuManager = value; } }
        protected internal AppointmentFormController Controller { get { return this.controller; } }
        protected internal SchedulerControl Control { get { return this.control; } }
        protected internal bool IsNewAppointment { get { return this.controller != null ? this.controller.IsNewAppointment : true; } }
        protected internal Icon RecurringIcon { get { return this.recurringIcon; } }
        protected internal Icon NormalIcon { get { return this.normalIcon; } }
        protected internal bool OpenRecurrenceForm { get { return this.openRecurrenceForm; } }
        [DXDescription("DevExpress.XtraScheduler.UI.AppointmentForm,ReadOnly")]
        [DXCategory(CategoryName.Behavior)]
        [DefaultValue(false)]

        /// <summary>
        /// 载入数据
        /// </summary>
        public virtual void LoadFormData(Appointment appointment)
        {
            this.Text = "排课信息";
            if (!string.IsNullOrEmpty(Sid))
            {
                Model.SchedulInfo model = Repository.SchedulInfo.Get(new Model.SchedulInfo { Id = Sid });
                if (model != null)
                {
                    this.dtStartTime.Text = model.StartTime.HasValue ? model.StartTime.Value.ToString("mm:ss") : null;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值