private void BindWorkShift() { CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; Employeeid = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; date = System.DateTime.Now.ToShortDateString(); string xh = GetWorkShiftIndex(); DataTable DtHoliday = HolidayDBHelper.GetHolidayInfo(CompanyCD);//是否节假日 if (DtHoliday != null) { if (DtHoliday.Rows.Count != 0) { for (int j = 0; j < DtHoliday.Rows.Count; j++) { if (Convert.ToDateTime(date) >= Convert.ToDateTime(DtHoliday.Rows[j]["StartDate"].ToString()) && Convert.ToDateTime(date) <= Convert.ToDateTime(DtHoliday.Rows[j]["EndDate"].ToString())) { HiddenEmployeeAttendanceSetID.Value = "节假日"; return; } } } } if (xh.Trim() != "" && xh.Trim() != "-1") { DataTable workshifttable = new DataTable(); if (!xh.EndsWith(",")) { DataTable IsRestDT = DailyAttendanceDBHelper.IsRestDay(CompanyCD, Employeeid, date, xh);//是否休息日 if (IsRestDT != null) { if (IsRestDT.Rows.Count > 0) { if (IsRestDT.Rows[0]["WorkShiftNo"].ToString() == "休息") { HiddenEmployeeAttendanceSetID.Value = "休息"; return; } } } workshifttable = DailyAttendanceDBHelper.GetWorkShiftInfo(CompanyCD, Employeeid, date, Convert.ToInt32(xh));//获取人员当前日期下的考勤班次下拉列表 } else { workshifttable = DailyAttendanceDBHelper.GetWorkShiftInfo(CompanyCD, xh.TrimEnd(',')); //获取人员当前日期下的考勤班次下拉列表 } DataTable EmployeeAttendanceSetInfo = DailyAttendanceDBHelper.GetEmployeeAttendanceSetInfo(CompanyCD, Employeeid, date); //获取人员当前日期下的考勤设置信息 if (workshifttable.Rows.Count > 0) { ddlworkshift.DataTextField = "ShiftTimeName"; ddlworkshift.DataValueField = "ID"; ddlworkshift.DataSource = workshifttable; ddlworkshift.DataBind(); } if (EmployeeAttendanceSetInfo.Rows.Count > 0) { HiddenEmployeeAttendanceSetID.Value = EmployeeAttendanceSetInfo.Rows[0]["ID"].ToString() + "," + EmployeeAttendanceSetInfo.Rows[0]["AttendanceType"].ToString(); } } }