public void InsertAttendance(AttendanceDTO dto) { var today = DateTime.Now; SqlDataReader sqlData2 = new AttendanceQuery().SelectWithIdnumberAndToday(dto.ATTENDANCE_IDNUMBER, today.ToString("yyyy-MM-dd")); // 오늘 이미 출근 기록이 있을 경우 if (sqlData2.HasRows) { SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("오늘은 이미 출근 처리가 되어있습니다."); } else { try { Defines.STAFF_PATH = Defines.CAPTURE_PATH + @"\Staff\" + SharedPreference.Instance.SelectedStaff.STAFF_NameAndIdnumber + @"\"; if (!Directory.Exists(Defines.STAFF_PATH)) { Directory.CreateDirectory(Defines.STAFF_PATH); } CaptureScreen(Defines.STAFF_PATH + today.ToString("yyyyMMddHHmmss") + "_Attendance_" + dto.ATTENDANCE_IDNUMBER + ".png"); var popup = new object(); var time = new TimeSpan(8, 30, 00); if (DateTime.Now.DayOfWeek.ToString() == "Monday") { time = new TimeSpan(8, 00, 00); } sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); if (DateTime.Now.TimeOfDay > time) { popup = new LatePopup(); if (WindowHelper.CreatePopup(popup as LatePopup, "지각", true) == true) { Attendance(dto); } } else { popup = new AttendancePopup(); if (WindowHelper.CreatePopup(popup as AttendancePopup, "출근", true) == true) { Attendance(dto); } } //(popup.DataContext as CapturePopupViewModel).Message = "정상적으로 출근처리 되었습니다.\n즐거운 하루 되세요!"; ////(popup.DataContext as CapturePopupViewModel).Image = bitmap as BitmapImage; //(popup.DataContext as CapturePopupViewModel).Image = image as BitmapImage; } catch (Exception e) { sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("출근 실패하셨습니다. 관리자에게 문의하세요.\n에러내용 : " + e.Message); } } }