Beispiel #1
0
        //右边选择休假日期
        private void repositoryItemCheckEdit1_CheckedChanged(object sender, EventArgs e)
        {
            IntervalLeaveDayHelp curItem = this.bs_IntervalHoliday.Current as IntervalLeaveDayHelp;

            if (curItem.HolidayDate == null)
            {
                foreach (var item in this._IntervalLeaveDays)
                {
                    item.IsChecked = false;
                }
            }
            else
            {
                this._IntervalLeaveDays[0].IsChecked = false;
            }
            this.grid_MonthDate.RefreshDataSource();
        }
Beispiel #2
0
        private void LoadHolidayOfMonth()
        {
            //构建选中月份的休假日期
            //默认初始化一个不隔周休的选项
            this._IntervalLeaveDays.Clear();
            this._IntervalLeaveDays.Add(new IntervalLeaveDayHelp {
                IsChecked = false, HolidayDate = null
            });

            DateTime currentDT = DateTime.Parse(this.combox_anotherMonth.SelectedItem.ToString() + "-01").Date;
            DateTime EndDT     = currentDT.AddMonths(1);

            while (currentDT < EndDT)
            {
                if (currentDT.DayOfWeek == DayOfWeek.Saturday)
                {
                    IntervalLeaveDayHelp IntervalLeaveDay = new IntervalLeaveDayHelp
                    {
                        IsChecked   = false,
                        HolidayDate = currentDT
                    };
                    this._IntervalLeaveDays.Add(IntervalLeaveDay);
                }
                currentDT = currentDT.AddDays(1);
            }

            this.bs_IntervalHoliday.DataSource = this._IntervalLeaveDays;
            this.grid_MonthDate.RefreshDataSource();

            //如果不是本月则不让修改保存
            if (currentDT.AddMonths(-1).Year == DateTime.Now.Year && currentDT.AddMonths(-1).Month == DateTime.Now.Month)
            {
                this.btn_Save.Enabled = true;
            }
            else
            {
                this.btn_Save.Enabled = false;
            }
        }