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(); } } }
/// <summary> /// 获取节假日信息列表 /// </summary> /// <returns>DataTable</returns> public static DataTable GetHolidayInfo(string CompanyID) { try { return(HolidayDBHelper.GetHolidayInfo(CompanyID)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 删除节假日信息 /// </summary> /// <param name="HolidayIDS">节假日IDS</param> /// <returns>删除是否成功 false:失败,true:成功</returns> public static bool DelHolidayInfo(string HolidayIDS) { return(HolidayDBHelper.DelHolidayInfo(HolidayIDS)); }
/// <summary> /// 更新节假日设置信息 /// </summary> /// <param name="HolidayM">节假日设置信息</param> /// <returns>更新是否成功 false:失败,true:成功</returns> public static bool UpdateHolidaySetInfo(HolidayModel HolidayM, string HolidayID) { return(HolidayDBHelper.UpdateHolidaySetInfo(HolidayM, HolidayID)); }
/// <summary> /// 添加节假日设置信息 /// </summary> /// <param name="HolidayM">节假日设置信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool AddHolidaySetInfo(HolidayModel HolidayM) { return(HolidayDBHelper.AddHolidaySetInfo(HolidayM)); }