示例#1
0
        //инициализация
        private void EditCalendarEventItem_Load(object sender, EventArgs e)
        {
            this.calendar_weekTableAdapter.Fill(this.sportDataSet.calendar_week);
                this.beginTimeTextBox.ContextMenuStrip = tsc.timeSelector;
                this.endTimeTextBox.ContextMenuStrip = tsc.timeSelector;

                this.eventlistBindingSource.Sort = "EventTitle";

                this.eventlistTable = (sportDataSet.event_listDataTable)((DataView)this.eventlistBindingSource.List).Table;

                this.eventDataRowView = (DataRowView)this.eventsBindingSource.Current;
                this.dayDataRowView = (DataRowView)this.calendar_weekBindingSource.Current;

                this.eventListGrid.DataSource = this.eventlistBindingSource;

                this.eventTitleComboBox.DisplayMember = "EventTitle";
                this.eventTitleComboBox.ValueMember = "EventID";
                this.eventTitleComboBox.DataSource = this.eventlistBindingSource;
                this.eventTitleComboBox.DataBindings.Add("SelectedValue", this.eventsBindingSource, "EventID");

                if (this.eventDataRowView.IsNew)
                {
                    if (Properties.Settings.Default.lastEventSelected == -1)
                        this.eventTitleComboBox.SelectedIndex = 0;
                    else
                        this.eventTitleComboBox.SelectedValue = Properties.Settings.Default.lastEventSelected;

                    if (Properties.Settings.Default.lastCalendarEventDayID == 0)
                        this.DayTitleComboBox.SelectedIndex = 0;
                    else
                        this.DayTitleComboBox.SelectedValue = Properties.Settings.Default.lastCalendarEventDayID;

                    eventDataRowView["DayID"] = this.DayTitleComboBox.SelectedValue;
                    eventDataRowView["BeginTime"] = Properties.Settings.Default.lastEditEventBeginTime;
                    eventDataRowView["EndTime"] = Properties.Settings.Default.lastEditEventEndTime;
                }

                this.DayTitleComboBox.DataBindings.Add("SelectedValue", this.eventsBindingSource, "DayID");

                this.beginTimeTextBox.DataBindings.Add("Text", this.eventsBindingSource, "BeginTime", true, DataSourceUpdateMode.OnValidation);
                this.endTimeTextBox.DataBindings.Add("Text", this.eventsBindingSource, "EndTime", true, DataSourceUpdateMode.OnValidation);

                eventListGrid.HideColumns(0, 1, 3, 4);
                eventListGrid.Columns[2].FillWeight = 250;
                eventListGrid.Columns[2].HeaderText = "Мероприятие";
                eventListGrid.Columns[5].HeaderText = "Платные занятия";
                eventListGrid.Columns[6].HeaderText = "Отчет по часам";
                eventListGrid.NoSortColumns();

                eventListGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
示例#2
0
        /// <summary>
        /// Создает форму редактирования мероприятия
        /// </summary>
        public EditEventItem(BindingSource EventsBindingSource,
                               BindingSource EventListBindingSource, DateTime fDateTime, DateTime lDateTime, bool changeDate = true)
        {
            InitializeComponent();

            this.eventlistBindingSource = EventListBindingSource;
            this.eventlistTable = (sportDataSet.event_listDataTable)((DataView)this.eventlistBindingSource.List).Table;
            this.eventsBindingSource = EventsBindingSource;
            this.dt1 = fDateTime;
            this.dt2 = lDateTime;

            this.actionDateTextBox.Enabled = changeDate;

            cd = DateTime.Parse(Properties.Settings.Default.lastEditEventTextDate);
        }