Example #1
0
 private void FrmAskForLeave_Load(object sender, EventArgs e)
 {
     tbNO.Text           = ASK_For_Leave_Helper.getLastedNO();
     this.dgv.DataSource = ASK_For_Leave_Helper.getAllVacationList();
     DGVHelper.AutoSizeForDGV(dgv);
     dtStartPicker.Value   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
     dtEndPicker.Value     = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
     timeStartPicker.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0);
     timeEndPicker.Value   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0);
 }
Example #2
0
        /// <summary>
        /// 提交请假
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!checkName())
            {
                return;
            }
            if (tbName.Text.Trim() == "")
            {
                return;
            }
            startDateTime = new DateTime(_start_year, _start_month, _start_day, _start_hour, _start_minute, _start_second);
            endDateTime   = new DateTime(_end_year, _end_month, _end_day, _end_hour, _end_minute, _end_second);
            if (startDateTime >= endDateTime)
            {
                ShowResult.show(lblResult, "结束时间需比起始时间大!", false);
                timerClsResult.Enabled = true;
                return;
            }
            string startTime = startDateTime.ToString("yyyy-MM-dd HH:mm:ss");
            string endTime   = endDateTime.ToString("yyyy-MM-dd HH:mm:ss");

            a_F_L_H = new ASK_For_Leave_Helper(tbName.Text.Trim(), startTime, endTime, tbNO.Text.Trim());
            //先判断是否有日期范围的假条
            if (a_F_L_H.ifExistsAtRange())
            {
                ShowResult.show(lblResult, "已存在该日期范围的假条!", false);
                timerClsResult.Enabled = true;
                return;
            }
            if (a_F_L_H.ifExistsVacationAtRange())
            {
                ShowResult.show(lblResult, "所设定的范围,涵盖公司休假日,请分段请假!", false);
                timerClsResult.Enabled = true;
                return;
            }
            a_F_L_H.save();
            tbNO.Text           = ASK_For_Leave_Helper.getLastedNO();
            this.dgv.DataSource = ASK_For_Leave_Helper.getAllVacationList();
            DGVHelper.AutoSizeForDGV(dgv);
        }