/// <summary> /// 获取初始化数据 /// </summary> public void Bind() { List <ATDto> listATDto = AutofacConfig.attendanceService.GetAll(); gridATData.Rows.Clear();//清除考勤模板列表数据 //如果考勤模板数据条数大于0 if (listATDto.Count > 0) { List <AttendanceManager> listAT = new List <AttendanceManager>(); foreach (ATDto at in listATDto) { AttendanceManager atManager = new AttendanceManager(); atManager.AT_ID = at.AT_ID; atManager.AT_Name = at.AT_Name; atManager.AT_CommutingType = at.AT_CommutingType; atManager.AT_WeeklyWorkingDay = atManager.getWeekDesc(at.AT_WeeklyWorkingDay); switch ((WorkTimeType)Enum.Parse(typeof(WorkTimeType), at.AT_CommutingType)) { case WorkTimeType.一天一上下班: atManager.WorkDate = "上班:" + Convert.ToDateTime(at.AT_StartTime).ToString("HH:mm") + " 下班:" + Convert.ToDateTime(at.AT_EndTime).ToString("HH:mm"); break; case WorkTimeType.一天二上下班: atManager.WorkDate = "上午上班:" + Convert.ToDateTime(at.AT_AMStartTime).ToString("HH:mm") + " 上午下班:" + Convert.ToDateTime(at.AT_AMEndTime).ToString("HH:mm"); atManager.WorkDate1 = "下午上班:" + Convert.ToDateTime(at.AT_PMStartTime).ToString("HH:mm") + " 下午下班:" + Convert.ToDateTime(at.AT_PMEndTime).ToString("HH:mm"); break; } atManager.AT_EffectiveDesc = at.AT_EffectiveDate.ToString("yyyy年MM月dd日") + "考勤生效"; listAT.Add(atManager); } gridATData.DataSource = listAT; gridATData.DataBind(); } }
/// <summary> /// 更新工作日期 /// </summary> private void upATweeklyWorkingDay() { AttendanceManager atManager = new AttendanceManager(); btnDate.Text = atManager.getWeekDesc(ATemplate.AT_WeeklyWorkingDay); }