// 엑셀로 시간표 저장 public void SaveTimeTable(HandleExcel.ExcelHandler excelHandler, List <List <int> > timetable) { worksheet.Cells[1, 2 + ConstNumber.MONDAY] = "월요일"; worksheet.Cells[1, 2 + ConstNumber.TUESDAY] = "화요일"; worksheet.Cells[1, 2 + ConstNumber.WENSDAY] = "수요일"; worksheet.Cells[1, 2 + ConstNumber.THURSDAY] = "목요일"; worksheet.Cells[1, 2 + ConstNumber.FRIDAY] = "금요일"; for (int i = 0; i < 12; i++) { worksheet.Cells[2 + i * 2, 1] = (9 + i) + ":00-" + (9 + i) + ":30"; worksheet.Cells[3 + i * 2, 1] = (9 + i) + ":30-" + (10 + i) + ":00"; } // 시간표 내용 저장 for (int day = 0; day < timetable.Count; day++) { for (int time = 0; time < timetable[0].Count; time++) { if (timetable[day][time] != 0) { worksheet.Cells[time + 2, day + 2] = excelHandler.ReturnSubject(timetable[day][time]); } } } workbook.Save(); }
// 학생 시간표에 강의를 추가함 public bool AddTimeTable(HandleExcel.ExcelHandler excelHandler, List <List <int> > timetable, int record) { string time = excelHandler.ReturnTime(record); // 실습수업이 있으면 길이가 2, 아니면 1 string[] subTime = time.Split(','); int dayInt = 0, startTime = 0, endTime = 0; List <char> day = null; bool overlap = false; // 수업시간, 실습시간 for (int i = 0; i < subTime.Length; i++) { day = new List <char>(new char[] { subTime[i][0], subTime[i][1] }); // 요일이 하나이면 if (day[1] >= '0' && day[1] <= '9') { day.Remove(day[1]); } // 시작 시간, 끝나는 시간 string[] lectureTime = subTime[i].Substring(day.Count).Split('-'); startTime = ConvertTimeToIndex(lectureTime[0]); endTime = ConvertTimeToIndex(lectureTime[1]) - 1; for (int j = 0; j < day.Count; j++) { dayInt = ConvertCharToIntAtDay(day[j]); for (int idx = startTime; idx <= endTime; idx++) { if (timetable[dayInt][idx] != 0) { overlap = true; break; } } } } // 시간이 중복되는 신청이 아니라면 if (!overlap) { // 시간표에 강의 시간 표시 for (int j = 0; j < day.Count; j++) { dayInt = ConvertCharToIntAtDay(day[j]); for (int idx = startTime; idx <= endTime; idx++) { timetable[dayInt][idx] = record; } } return(true); } else { return(false); } }
public List <int> LectureListScreen(HandleExcel.ExcelHandler LectureData, string[] conditions, List <int> appliedCredit, int dataCount) { int[] stringLimits = new int[] { 4, 18, 10, 6, 32, 10, 6, 6, 29, 12, 32, 8 }; List <int> searchedTuple; // 검색 조건에 맞는 강의 목록 출력 searchedTuple = LectureData.ReturnSearchResult(conditions, appliedCredit, dataCount); PrintLectureList(LectureData, searchedTuple); return(searchedTuple); }
// 생성자 public MainLectureManagement(StudentManagement.Student student) { // 로그인된 학생의 계정 this.student = student; Console.Clear(); Console.WriteLine("\n Loading Excel Data"); // 모든 강의를 담고 있는 excelhandler allLectureData = new HandleExcel.ExcelHandler("LectureSchedule2018-1.xlsx", "강의시간표(schedule)"); allLectureData.SetDataRange("A1", "L167"); managementTool = new ManagementTool(allLectureData, student); // 학생의 수강신청 엑셀을 생성 또는 로드한다. studentLectureData = new HandleExcel.ExcelHandler(student.StudentNo + ".xlsx", "sheet1"); studentLectureData.SetDataRange("A1", "F25"); // 메뉴 루프 진입 LectureMenu(); }
public void PrintLectureList(HandleExcel.ExcelHandler LectureData, List <int> searchedTuple) { int[] stringLimits = new int[] { 4, 18, 10, 6, 32, 10, 6, 6, 29, 12, 32, 8 }; // 속성명 출력 Console.Write(" ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n "); for (int idx = ConstNumber.NO; idx <= ConstNumber.LANGUAGE; idx++) { Console.Write(PrintFixString(LectureData.ToStringPresentData(1, idx), stringLimits[idx - 1])); } Console.Write("\n ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"); foreach (int record in searchedTuple) { Console.Write(" "); for (int idx = ConstNumber.NO; idx <= ConstNumber.LANGUAGE; idx++) { Console.Write(PrintFixString(LectureData.ToStringPresentData(record, idx), stringLimits[idx - 1])); } Console.WriteLine(); } }
public void TimeTableScreen(HandleExcel.ExcelHandler excelHandler, List <List <int> > timetable) { int cursorLeft = 14, cursorTop = 3; ConsoleUI.PrintTimeTable(); for (int time = 0; time < timetable[0].Count; time++) { Console.SetCursorPosition(cursorLeft, cursorTop++); for (int day = ConstNumber.MONDAY; day <= ConstNumber.FRIDAY; day++) { if (timetable[day][time] != 0) { Console.Write(PrintFixString(excelHandler.ReturnSubject(timetable[day][time]), 32)); } else { Console.Write(PrintFixString(" ", 32)); } Console.Write(" "); } Console.WriteLine(); } Console.ReadKey(); }
public ManagementTool(HandleExcel.ExcelHandler lectureData, StudentManagement.Student student) { outputProcessor = new IOException.OutputProcessor(); allLectureData = lectureData; this.student = student; }