Exemplo n.º 1
0
        void treDept_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            ///部门班制
            string    deptNo      = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "代码");
            DataTable dtDeptClass = this.ds.Tables["部门班制"].Clone();

            dtDeptClass = FunShare.GetTable(dtDeptClass, this.ds.Tables["部门班制"].Select("部门='" + deptNo + "'"));
            this.grdClass.DataSource = dtDeptClass;
            //部门休息日
            DataTable deptHolidaysState = this.ds.Tables["部门休息日"].Clone();

            deptHolidaysState          = FunShare.GetTable(deptHolidaysState, this.ds.Tables["部门休息日"].Select("部门='" + deptNo + "'"));
            this.dbRestDept.DataSource = deptHolidaysState;
            //部门排班明细
            if (this.gridViewClass.RowCount == 0)
            {
                return;
            }
            string    classNo     = this.gridViewClass.GetDataRow(this.gridViewClass.FocusedRowHandle)["班制id"].ToString();
            string    tag         = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "ID");
            DataTable dtClassList = this.ds.Tables["排班明细"].Clone();

            dtClassList = FunShare.GetTable(dtClassList, this.ds.Tables["排班明细"].Select("部门='" + tag + "' and 班制='" + classNo + "'", " 日期 asc"));
            this.grdClassList.DataSource = dtClassList;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 树节点改变GridList 跟着改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treDept_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            foreach (DataTable tab in this.ds.Tables)
            {
                string tag = basefun.valtag(Convert.ToString(e.Node.Tag.ToString()), "ID");
                if (tag == string.Empty)
                {
                    return;
                }
                if (!tab.Columns.Contains("部门id"))
                {
                    continue;
                }
                DataRow[] drallInfo = tab.Select("部门id='" + tag + "'");
                DataTable tabInfo   = tab.Clone();
                tabInfo = FunShare.GetTable(tabInfo, drallInfo);
                string tabName = tabInfo.TableName;
                switch (tabName)
                {
                case "部门员工假期":
                    this.grdExchangeRelax.DataSource = tabInfo;
                    GetDeptEmployee(this.grdExchangeRelax, this.ds.Tables["部门员工假期"], tag);
                    break;

                case "员工出差":
                    this.grdEvection.DataSource = tabInfo;
                    GetDeptEmployee(this.grdEvection, this.ds.Tables["员工出差"], tag);
                    break;

                case "员工加班":
                    this.grdOvertime.DataSource = tabInfo;
                    GetDeptEmployee(this.grdOvertime, this.ds.Tables["员工加班"], tag);
                    break;

                case "员工签到":
                    this.grdSignIn.DataSource = tabInfo;
                    GetDeptEmployee(this.grdSignIn, this.ds.Tables["员工签到"], tag);
                    break;

                case "员工请假":
                    this.grdLeave.DataSource = tabInfo;
                    GetDeptEmployee(this.grdLeave, this.ds.Tables["员工请假"], tag);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 修改datatable里记录的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridViewCellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView focusView = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            string    gridViewName = focusView.Name.ToString();
            string    id           = focusView.GetDataRow(focusView.FocusedRowHandle)["ID"].ToString();
            string    tag          = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag.ToString()), "ID");
            DataTable dtTemp       = new DataTable();

            switch (gridViewName)
            {
            case "gridViewExchangeRelax":
                EditTabColValue(this.ds.Tables["部门员工假期"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["部门员工假期"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["部门员工假期"].Select("部门id='" + tag + "'"));
                this.grdExchangeRelax.DataSource = dtTemp;
                break;

            case "gridViewEvection":
                EditTabColValue(this.ds.Tables["员工出差"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工出差"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工出差"].Select("部门id='" + tag + "'"));
                this.grdEvection.DataSource = dtTemp;
                break;

            case "gridViewOvertime":
                EditTabColValue(this.ds.Tables["员工加班"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工加班"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工加班"].Select("部门id='" + tag + "'"));
                this.grdOvertime.DataSource = dtTemp;
                break;

            case "gridViewSignIn":
                EditTabColValue(this.ds.Tables["员工签到"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工签到"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工签到"].Select("部门id='" + tag + "'"));
                this.grdSignIn.DataSource = dtTemp;
                break;

            case "gridViewLeave":
                EditTabColValue(this.ds.Tables["员工请假"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工请假"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工请假"].Select("部门id='" + tag + "'"));
                this.grdLeave.DataSource = dtTemp;
                break;

            default:
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 循环初始化所有DataGrid
        /// </summary>
        private void FrmDataGrid()
        {
            if (this.treDept.FocusedNode == null)
            {
                return;
            }
            string    tag = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag.ToString()), "ID");
            DataTable dt  = new DataTable();

            foreach (DataTable tab in this.ds.Tables)
            {
                dt = tab.Clone();
                if (!dt.Columns.Contains("部门id"))
                {
                    continue;
                }
                dt = FunShare.GetTable(dt, tab.Select("部门id='" + tag + "'"));
                switch (tab.TableName)
                {
                case "部门员工假期":
                    this.grdExchangeRelax.DataSource = dt;
                    GetDeptEmployee(this.grdExchangeRelax, this.ds.Tables["部门员工假期"], tag);
                    break;

                case "员工出差":
                    this.grdEvection.DataSource = dt;
                    GetDeptEmployee(this.grdEvection, this.ds.Tables["员工出差"], tag);
                    break;

                case "员工加班":
                    this.grdOvertime.DataSource = dt;
                    GetDeptEmployee(this.grdOvertime, this.ds.Tables["员工加班"], tag);
                    break;

                case "员工签到":
                    this.grdSignIn.DataSource = dt;
                    GetDeptEmployee(this.grdSignIn, this.ds.Tables["员工签到"], tag);
                    break;

                case "员工请假":
                    this.grdLeave.DataSource = dt;
                    GetDeptEmployee(this.grdLeave, this.ds.Tables["员工请假"], tag);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除表里的记录
        /// </summary>
        /// <param name="dt">被删除记录的表</param>
        /// <param name="ColValue"></param>
        /// <returns></returns>
        private DataTable DelTabRow(DataTable dt, string FirColName, string FirColValue, string SecColName, string SecColValue)
        {
            string Expression = FirColName + "='" + FirColValue + "'";

            foreach (DataRow dr in dt.Select(Expression))
            {
                dr.BeginEdit();
                dr.Delete();
                dr.EndEdit();
            }
            DataTable tab = dt.Clone();

            Expression = SecColName + "='" + SecColValue + "'";
            tab        = FunShare.GetTable(tab, dt.Select(Expression));
            return(tab);
        }
Exemplo n.º 6
0
        private void gridViewClass_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            if (this.treDept.FocusedNode == null)
            {
                return;
            }
            if (this.gridViewClass.RowCount == 0)
            {
                return;
            }
            string    tag         = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "ID");
            string    ClassNo     = this.gridViewClass.GetDataRow(this.gridViewClass.FocusedRowHandle)["班制编号"].ToString();
            DataTable dtClassList = this.ds.Tables["排班明细"].Clone();

            dtClassList = FunShare.GetTable(dtClassList, this.ds.Tables["排班明细"].Select("部门='" + tag + "' and 班制编号='" + ClassNo + "'", " 日期 asc"));
            this.grdClassList.DataSource = dtClassList;
        }
Exemplo n.º 7
0
        private void BtCancel_Click(object sender, EventArgs e)
        {
            bool f*g = FunShare.CheckDataState(this.ds);

            if (!f*g)
            {
                this.Close();
            }
            else
            {
                DialogResult dr = XtraMessageBox.Show("您还有修改的数据未保存,确定退出吗?", "系统提示!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (DialogResult.OK == dr)
                {
                    this.Close();
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取分组的定时任务
        /// </summary>
        private void GetTask(string tag)
        {
            if (string.IsNullOrEmpty(tag))
            {
                return;
            }
            DataTable tab = this.ds.Tables["定时任务"] as DataTable;

            if (tab == null)
            {
                return;
            }
            DataTable temp = new DataTable();

            temp = tab.Clone();
            temp = FunShare.GetTable(temp, tab.Select(string.Format("分组ID='{0}'", tag)));
            this.gridTask.DataSource = temp;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 根据开始时间,结束时间查询开门记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtQuery_Click(object sender, EventArgs e)
        {
            if (this.dateStart.Text == string.Empty)
            {
                XtraMessageBox.Show("请输入开始时间", "系统提示!");
                return;
            }
            if (this.dateEnd.Text == string.Empty)
            {
                XtraMessageBox.Show("请输入结束时间", "系统提示!");
                return;
            }

            string dataStart = this.dateStart.Text.Trim();
            string dataEnd   = this.dateEnd.Text.Trim();

            string where = " 时间 >=  '" + dataStart + "' and 时间 <= '" + dataEnd + "' ";
            if (this.lookDoor.EditValue != null && this.lookDoor.EditValue.ToString() != "全部")
            {
                where += " and 门编号='" + this.lookDoor.EditValue.ToString() + "'";
            }
            this.paramwin = BindManager.getSystemParam();
            NameObjectList ps = new NameObjectList();

            ps["StartDate"] = this.dateStart.EditValue.ToString();
            ps["EndDate"]   = this.dateEnd.EditValue.ToString();
            ParamManager.MergeParam(ps, this.paramwin, false);
            this.unitItem = new UnitItem(DataAccRes.AppSettings("WorkConfig"), unitName);
            this.ds       = this.bindMgr.BuildDataset(this.unitItem, ps);
            DataTable dt       = this.ds.Tables["刷卡记录"].Clone();
            DataTable dtReport = FunShare.GetTable(dt, this.ds.Tables["刷卡记录"].Select(where));

            Report.viwReports View = new viwReports();
            View.ReportName = "刷卡报表";
            View.dt         = dt;
            View.StartTime  = this.dateStart.Text.Trim();
            View.EndTime    = this.dateEnd.Text.Trim();
            View.Activate();
            View.Dock = DockStyle.Fill;
            this.groReport.Controls.Clear();
            this.groReport.Controls.Add(View);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 通过制表控件的text值来判读用户选择的GridView.从而在选中的GridView中添加行
        /// 暂时这样写,有时间将case里面的语句抽象出来
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtAdd_Click(object sender, EventArgs e)
        {
            if (this.treDept.FocusedNode == null)
            {
                return;
            }
            string    tag        = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag.ToString()), "ID");
            string    id         = Guid.NewGuid().ToString();
            string    ColumnName = string.Empty;
            Hashtable hs         = new Hashtable();
            DataTable dtTemp     = new DataTable();
            string    TabTxt     = this.TabRegisterClassInfo.SelectedTabPage.Text.Trim();

            switch (TabTxt)
            {
            case "签到":
                ColumnName = this.gridViewSignIn.Columns["ID"].FieldName.ToString();
                hs.Add(ColumnName, id);
                hs.Add("部门id", tag);
                AddTabRow(this.ds.Tables["员工签到"], hs, "id", id);
                dtTemp = this.ds.Tables["员工签到"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工签到"].Select("部门id='" + tag + "'"));
                this.grdSignIn.DataSource = dtTemp;
                GetDeptEmployee(this.grdSignIn, this.ds.Tables["员工签到"], tag);
                break;

            case "加班":
                ColumnName = this.gridViewOvertime.Columns["ID"].FieldName.ToString();
                hs.Add(ColumnName, id);
                hs.Add("加班类别", "加班");
                hs.Add("部门id", tag);
                AddTabRow(this.ds.Tables["员工加班"], hs, "id", id);
                dtTemp = this.ds.Tables["员工加班"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工加班"].Select("部门id='" + tag + "'"));
                this.grdOvertime.DataSource = dtTemp;
                GetDeptEmployee(this.grdOvertime, this.ds.Tables["员工加班"], tag);
                break;

            case "出差":
                ColumnName = this.gridViewEvection.Columns["ID"].FieldName.ToString();
                hs.Add(ColumnName, id);
                hs.Add("出差类别", "出差");
                hs.Add("部门id", tag);
                AddTabRow(this.ds.Tables["员工出差"], hs, "id", id);
                dtTemp = this.ds.Tables["员工出差"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工出差"].Select("部门id='" + tag + "'"));
                this.grdEvection.DataSource = dtTemp;
                GetDeptEmployee(this.grdEvection, this.ds.Tables["员工出差"], tag);
                break;

            case "调休":
                ColumnName = this.gridViewExchangeRelax.Columns["ID"].FieldName.ToString();
                hs.Add(ColumnName, id);
                hs.Add("休假", CheckState.Checked);
                hs.Add("部门id", tag);
                AddTabRow(this.ds.Tables["部门员工假期"], hs, "id", id);
                dtTemp = this.ds.Tables["部门员工假期"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["部门员工假期"].Select("部门id='" + tag + "'"));
                this.grdExchangeRelax.DataSource = dtTemp;
                GetDeptEmployee(this.grdExchangeRelax, this.ds.Tables["部门员工假期"], tag);
                break;

            case "请假":
                ColumnName = this.gridViewLeave.Columns["ID"].FieldName.ToString();
                hs.Add(ColumnName, id);
                hs.Add("请假类别", "请假");
                hs.Add("部门id", tag);
                AddTabRow(this.ds.Tables["员工请假"], hs, "id", id);
                dtTemp = this.ds.Tables["员工请假"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工请假"].Select("部门id='" + tag + "'"));
                this.grdLeave.DataSource = dtTemp;
                GetDeptEmployee(this.grdLeave, this.ds.Tables["员工请假"], tag);
                break;

            default:
                break;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 绑定表格数据并且只根据部门来绑定过滤后的数据
        /// </summary>
        /// <param name="dbgrid">显示数据的表格</param>
        /// <param name="tab">数据表</param>
        /// <param name="tag">部门id</param>
        private void GetDeptEmployee(GridControl dbgrid, DataTable tab, string tag)
        {
            if (null == dbgrid || null == tab)
            {
                return;
            }
            GridView  gridview = (GridView)dbgrid.MainView;
            DataTable dt       = tab.Clone();

            if (!dt.Columns.Contains("部门id"))
            {
                return;
            }
            dt = FunShare.GetTable(dt, tab.Select("部门id='" + tag + "'"));
            dbgrid.DataSource = dt;
            DataColumnCollection dbcols = tab.Columns;

            if (null != gridview.Columns["ID"])
            {
                gridview.Columns["ID"].Visible = false;
            }
            foreach (DataColumn dbcol in dbcols)
            {
                //设置表格字典
                GridColumn gdcol = gridview.Columns.ColumnByFieldName(dbcol.ColumnName);
                if (null == gdcol)
                {
                    gdcol = gridview.Columns.ColumnByName(dbcol.ColumnName);
                }
                if (null == gdcol)
                {
                    continue;
                }
                string src = Convert.ToString(dbcol.ExtendedProperties[srcpro]);
                string txt = Convert.ToString(dbcol.ExtendedProperties[txtpro]);
                string val = Convert.ToString(dbcol.ExtendedProperties[valpro]);
                txt = string.IsNullOrEmpty(txt) ? val : txt;
                val = string.IsNullOrEmpty(val) ? txt : val;
                src = dbcol.ColumnName;
                if (null != tab.DataSet && !string.IsNullOrEmpty(src) && !string.IsNullOrEmpty(txt) && !string.IsNullOrEmpty(val) &&
                    tab.DataSet.Tables.Contains(src))
                {
                    DataTable tabdict = tab.DataSet.Tables[src];
                    if (tabdict.Columns.Contains(txt) && tabdict.Columns.Contains(val))
                    {
                        RepositoryItemGridLookUpEdit ri = new RepositoryItemGridLookUpEdit();
                        DataTable dtDict = tabdict.Clone();
                        if (dtDict.Columns.Contains("id"))
                        {
                            dtDict        = FunShare.GetTable(dtDict, tabdict.Select("id='" + tag + "'"));
                            ri.DataSource = dtDict;
                        }
                        else
                        {
                            ri.DataSource = tabdict;
                        }
                        //控制下拉的选项哪些可以显示,哪些不可以显示
                        if (ri.View.Columns.Contains(ri.View.Columns["ID"]))
                        {
                            ri.View.Columns["ID"].Visible = false;
                        }
                        ri.NullText      = "请选择";
                        ri.DisplayMember = txt;
                        ri.ValueMember   = val;
                        gdcol.ColumnEdit = ri;
                    }
                }
            }
        }
Exemplo n.º 12
0
        private void btMakeClass_Click(object sender, EventArgs e)
        {
            if (this.treDept.FocusedNode == null)
            {
                return;
            }
            if (this.gridViewClass.RowCount == 0)
            {
                return;
            }
            //状态 休息,上班
            string relaxState = "";

            this.ds.Tables["排班明细"].Clear();
            string startDate = string.Empty;
            string endDate   = string.Empty;
            string deptNo    = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "代码");
            string ClassNo   = this.gridViewClass.GetDataRow(this.gridViewClass.FocusedRowHandle)["班制编号"].ToString();
            string tag       = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "ID");

            if (this.ds.Tables["部门班制"].Select("部门='" + deptNo + "' and 班制编号='" + ClassNo + "'").Length == 0)
            {
                return;
            }
            //选中部门的班制
            DataRow drClass = this.ds.Tables["部门班制"].Select("部门='" + deptNo + "' and 班制编号='" + ClassNo + "'")[0];
            //选中部门的班制明细
            DataTable dtAllClassList = this.ds.Tables["班制明细"].Clone();

            dtAllClassList = FunShare.GetTable(dtAllClassList, this.ds.Tables["班制明细"].Select("编号='" + drClass["班制编号"] + "'", "班次 asc"));
            startDate      = drClass["启动日期"].ToString();
            endDate        = drClass["结束日期"].ToString();
            TimeSpan days      = DateTime.Parse(endDate).AddDays(1).Date - DateTime.Parse(startDate).Date;
            int      classDays = int.Parse(drClass["换班周期"].ToString());
            int      len       = this.ds.Tables["班制明细"].Select("编号='" + drClass["班制编号"] + "'", "班次 asc").Length;
            int      totalDays = days.Days;
            //正周期循环次数
            int classCircleTime = 0;
            //周期余数循环次数
            int classListCircleTime = 0;

            classCircleTime     = totalDays / classDays;
            classListCircleTime = totalDays % classDays;
            int count = classDays - len;
            int last  = 0;

            if (count < 0)
            {
                string deptName = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag), "名称");
                XtraMessageBox.Show(deptName + "设置的换班周期应当大于或等于班制明细,请重新设置!", "系统提示!");
                return;
            }
            //正周期循环次数
            for (int i = 1; i <= classCircleTime; i++)
            {
                int n = -1;
                int m = 0;
                #region 插入班制明细
                if (i == 1)
                {
                    SyncStartDayOfWeek(dtAllClassList, drClass, classDays, i, ref last, deptNo, startDate, relaxState);
                }
                else
                {
                    InsertCalssList(dtAllClassList, drClass, classDays, len, last, m, i, n, startDate, deptNo, tag, relaxState);
                }
                #endregion
            }
            //周期余数循环次数
            int day = -1;
            #region 插入班制明细
            foreach (DataRow drClassList in this.ds.Tables["班制明细"].Select("编号='" + drClass["班制编号"] + "'", "班次 asc"))
            {
                day++;
                if (day == classListCircleTime + last)
                {
                    break;
                }
                //计算日期,日期按天递增
                int k = classCircleTime * classDays - last + day;
                relaxState = dtAllClassList.Rows[day]["休假"].ToString();
                relaxState = DateJudge(relaxState, this.treDept.FocusedNode, DateTime.Parse(startDate).AddDays(k));
                BuidDate(this.treDept.FocusedNode, drClassList, drClass, k, startDate, relaxState);
            }

            #endregion
            DataTable dtTemp = this.ds.Tables["排班明细"].Clone();
            this.grdClassList.DataSource = FunShare.GetTable(dtTemp, this.ds.Tables["排班明细"].Select("部门='" + tag + "'"));
        }
Exemplo n.º 13
0
        /// <summary>
        ///  判断日期是否属于部门休息日跟法定休息日
        /// </summary>
        /// <param name="date">开始日期</param>
        /// <param name="state">是否允许部门节假日休假</param>
        /// <param name="state">是否允许法定节假日休假</param>
        /// <returns></returns>
        private string DateJudge(string workState, TreeListNode node, DateTime date)
        {
            string    f*g              = workState;
            string    deptNo           = basefun.valtag(Convert.ToString(node.Tag), "代码");
            bool      deptHolidayState = false;
            bool      HolidayState     = false;
            DateTime  startDate        = new DateTime();
            DateTime  endDate          = new DateTime();
            DataTable deptHolidays     = this.ds.Tables["部门休息日"].Clone();

            deptHolidays = FunShare.GetTable(deptHolidays, this.ds.Tables["部门休息日"].Select("部门='" + deptNo + "'"));
            DataTable[] tabList = { this.ds.Tables["法定休息日"], deptHolidays };
            foreach (DataTable tab in tabList)
            {
                int i = 0;
                foreach (DataRow drDept in tab.Rows)
                {
                    if (DateTime.Parse(drDept["开始日期"].ToString()) > date || DateTime.Parse(drDept["结束日期"].ToString()) < date)
                    {
                        bool state = bool.Parse(f*g);
                        switch (state)
                        {
                        case true:
                            f*g = workState;
                            break;

                        case false:
                            f*g = workState;
                            break;
                        }
                    }
                    else
                    {
                        if (tab.TableName == "部门休息日")
                        {
                            deptHolidayState = Boolean.Parse(drDept["休假"].ToString());
                        }
                        else
                        {
                            HolidayState = Boolean.Parse(drDept["休假"].ToString());
                        }
                        startDate = DateTime.Parse(drDept["开始日期"].ToString());
                        endDate   = DateTime.Parse(drDept["结束日期"].ToString());
                        for (DateTime sDate = startDate; sDate <= endDate; sDate = sDate.AddDays(1))
                        {
                            if (sDate.ToShortDateString() == date.ToShortDateString())
                            {
                                if (tab.TableName == "部门休息日" && deptHolidayState == true)
                                {
                                    f*g = "休息";
                                    return(f*g);
                                }
                                else if (tab.TableName == "部门休息日" && deptHolidayState == false)
                                {
                                    f*g = "上班";
                                    return(f*g);
                                }
                                else if (tab.TableName == "法定休息日" && HolidayState == true)
                                {
                                    f*g = "休息";
                                    return(f*g);
                                }
                                else if (tab.TableName == "法定休息日" && HolidayState == false)
                                {
                                    f*g = "上班";
                                    return(f*g);
                                }
                            }
                        }
                    }
                }
            }
            if (f*g.ToLower() == "true")
            {
                f*g = "休息";
            }
            else
            {
                f*g = "上班";
            }
            return(f*g);
        }