private void LoadTodayAttendance() { TodayAttendanceList.Clear(); try { var sqlData = new AttendanceQuery().SelectWithToday(); while (sqlData.Read()) { AttendanceDTO dto = new AttendanceDTO { ATTENDANCE_BUSINESS_DAY = sqlData["businessday"].ToString(), ATTENDANCE_NAME = sqlData["name"].ToString(), ATTENDANCE_IDNUMBER = sqlData["idnumber"].ToString(), ATTENDANCE_IN_TIME = sqlData["in_time"].ToString(), ATTENDANCE_OUT_TIME = sqlData["out_time"].ToString(), ATTENDANCE_OVERTIME = sqlData["overtime"].ToString(), ATTENDANCE_OFF_DAY = sqlData["off_day"].ToString(), ATTENDANCE_ETC = sqlData["etc"].ToString() }; TodayAttendanceList.Add(new AttendanceModel(dto)); } sqlData.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); var sqlData2 = new AttendanceQuery().SelectTwoWeeksAgo(); while (sqlData2.Read()) { AttendanceDTO dto = new AttendanceDTO { ATTENDANCE_BUSINESS_DAY = sqlData2["businessday"].ToString(), ATTENDANCE_NAME = sqlData2["name"].ToString(), ATTENDANCE_IDNUMBER = sqlData2["idnumber"].ToString(), ATTENDANCE_IN_TIME = sqlData2["in_time"].ToString(), ATTENDANCE_OUT_TIME = sqlData2["out_time"].ToString(), ATTENDANCE_OVERTIME = sqlData2["overtime"].ToString(), ATTENDANCE_OFF_DAY = sqlData2["off_day"].ToString(), ATTENDANCE_ETC = sqlData2["etc"].ToString() }; TodayAttendanceList.Add(new AttendanceModel(dto)); } sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); } catch (Exception e) { SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("오늘 출결 상황을 읽어오지 못했습니다. 관리자에게 문의하세요.\n에러 내용 : " + e.Message); } }
private void LoadTodayAttendance(UserControl uc) { if (Conditions == "All") { SharedPreference.Instance.SelectedDept = null; SharedPreference.Instance.SelectedStaff = null; TodayAttendanceList.Clear(); var sqlData = new AttendanceQuery().SelectWithAllStaffAndDay(StartDate, EndDate); if (sqlData.HasRows) { while (sqlData.Read()) { AttendanceDTO dto = new AttendanceDTO { ATTENDANCE_BUSINESS_DAY = sqlData["businessday"].ToString(), ATTENDANCE_NAME = sqlData["name"].ToString(), ATTENDANCE_IDNUMBER = sqlData["idnumber"].ToString(), ATTENDANCE_IN_TIME = sqlData["in_time"].ToString(), ATTENDANCE_OUT_TIME = sqlData["out_time"].ToString(), ATTENDANCE_OVERTIME = sqlData["overtime"].ToString(), ATTENDANCE_OFF_DAY = sqlData["off_day"].ToString(), ATTENDANCE_ETC = sqlData["etc"].ToString() }; TodayAttendanceList.Add(new AttendanceModel(dto)); } sqlData.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); } else { sqlData.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); } } else if (Conditions == "Selection") { if (SharedPreference.Instance.SelectedDept != null) { TodayAttendanceList.Clear(); var sqlData = new AttendanceQuery().SelectWithDeptAndDay(SharedPreference.Instance.SelectedDept.DEPT_CODE, StartDate, EndDate); if (SharedPreference.Instance.SelectedStaff != null) { sqlData.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); sqlData = new AttendanceQuery().SelectWithIdnumberAndDay(SharedPreference.Instance.SelectedStaff.STAFF_IDNUMBER, StartDate, EndDate); } if (sqlData.HasRows) { while (sqlData.Read()) { AttendanceDTO dto = new AttendanceDTO { ATTENDANCE_BUSINESS_DAY = sqlData["businessday"].ToString(), ATTENDANCE_NAME = sqlData["name"].ToString(), ATTENDANCE_IDNUMBER = sqlData["idnumber"].ToString(), ATTENDANCE_IN_TIME = sqlData["in_time"].ToString(), ATTENDANCE_OUT_TIME = sqlData["out_time"].ToString(), ATTENDANCE_OVERTIME = sqlData["overtime"].ToString(), ATTENDANCE_OFF_DAY = sqlData["off_day"].ToString(), ATTENDANCE_ETC = sqlData["etc"].ToString() }; TodayAttendanceList.Add(new AttendanceModel(dto)); } } sqlData.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); } else { MessageBox.Show("부서 또는 사원을 선택해주세요."); Window.GetWindow(uc).DialogResult = false; } } }