public LeaveInfo(LeaveInfo leaveinfo)
 {
     nID         = leaveinfo.nID;
     tDUEDATE    = leaveinfo.tDUEDATE;
     tLEAVEDATE  = leaveinfo.tLEAVEDATE;
     tRETURNDATE = leaveinfo.tRETURNDATE;
     strReason   = leaveinfo.strReason;
     ISBACK      = leaveinfo.ISBACK;
     ISOVERDATE  = leaveinfo.ISOVERDATE;
 }
 /// <summary>
 /// Çë¼Ùʼþ
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonTAKINGLEAVE_Click(object sender, EventArgs e)
 {
     LeaveInfo            = new LeaveInfo();
     LeaveInfo.nID        = textEditID.Text;
     LeaveInfo.tLEAVEDATE = dateTimePickerFROM.Value;
     LeaveInfo.tDUEDATE   = dateTimePickerTO.Value;
     LeaveInfo.strReason  = radioGroupREASON.Properties.Items[radioGroupREASON.SelectedIndex].Description;
     LeaveInfo.InsertLeaveRecord(LeaveInfo);
     gridControlLEAVES.DataSource = LeaveInfo.GetPersonLeavesTable();
 }
        /// <summary>
        /// 插入请假信息
        /// </summary>
        /// <param name="leaveInfo"></param>
        public void InsertLeaveRecord(LeaveInfo leaveInfo)
        {
            string    str = "select ID from StudentLeaveRecords where StudentLeaveRecords.ID= '" + leaveInfo.nID + "' and StudentLeaveRecords.ISBACK=false";
            DataTable dt  = db.ExecuteDataTable(str, oleConn);

            if (dt.Rows.Count == 0)
            {
                string str1   = "false";
                string strSQL = "insert into StudentLeaveRecords(ID,LEAVEDATE,DUEDATE,ISBACK,REASON) values('" + leaveInfo.nID + "',#" + leaveInfo.tLEAVEDATE + "#,#" + leaveInfo.tDUEDATE + "#," + str1 + ",'" + leaveInfo.strReason + "')";
                db.ExecuteNonQuery(strSQL, oleConn);
            }
            else
            {
                MessageBox.Show("该学员未销假");
            }
        }
        /// <summary>
        /// 销假
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCANCELLEAVES_Click(object sender, EventArgs e)
        {
            int rowcount = gridView2007.RowCount; //获取选中的行标

            if (rowcount > 0)                     //选中所选的行
            {
                for (int i = 0; i < rowcount - 1; i++)
                {
                    string s = gridView2007.GetRowCellDisplayText(i, gridColumn17);
                    if (s == "Checked")//是否被选中
                    {
                        leaveInfo = new LeaveInfo();
                        string text = gridView2007.GetRowCellDisplayText(i, gridColumn11);
                        leaveInfo.CancelLeaveRecord(text);
                    }
                }
                UpdateAwayPersonDataTable();
            }
        }
        /// <summary>
        ///  //批量请假
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCONFIRM_Click(object sender, EventArgs e)
        {
            int rowcount = gridView2007.RowCount; //获取选中的行标

            if (rowcount > 0)                     //选中所选的行
            {
                for (int i = 0; i < rowcount - 1; i++)
                {
                    string s = gridView2007.GetRowCellDisplayText(i, gridColumn17);
                    if (s == "Checked")//是否被选中
                    {
                        leaveInfo            = new LeaveInfo();
                        leaveInfo.nID        = gridView2007.GetRowCellDisplayText(i, gridColumn11);
                        leaveInfo.tLEAVEDATE = dateTimePickerFROM.Value;
                        leaveInfo.tDUEDATE   = dateTimePickerTO.Value;
                        leaveInfo.strReason  = comboBoxMARK.Text;
                        leaveInfo.InsertLeaveRecord(leaveInfo);
                    }
                }
                UpdateStayPersonDataTable();
            }
        }
Example #6
0
 /// <summary>
 /// 界面初始化
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CP_LEAVESQUERY_Load(object sender, EventArgs e)
 {
     leavInfo   = new LeaveInfo();
     personInfo = new PersonInfo();
     FillDatagridView(leavInfo.GetAllPersonLeavesTable());
 }