public ClassScheduleModel(ClassScheduleView view) { _s = new InputSimulator(); //_classScheduleService = DependencyResolver.Current.GetService<IClassScheduleService>(); CourseViewList = new ObservableCollection <CourseViewModel>(); CourseList = new List <Course>(); _bmsService = DependencyResolver.Current.GetService <IBms>(); _scheduleView = view; LoadCommand = DelegateCommand.FromAsyncHandler(LoadingAsync); GoBackCommand = new DelegateCommand(GoBack); }
private async void GotoTimetable() { GlobalData.Instance.CurrentHomeMenu = MainMenuNames.Timetable; var classTable = await _classroomBms.GetClassTableInfoAsync(GlobalData.Instance.Classroom?.Id); ClassScheduleModel.DoUpdateCurriculumMeetingN0(classTable); var view = new ClassScheduleView(); view.Show(); _mainView.Close(); }
public List <ClassScheduleView> GetAllClassScheduleViews(int departmentId) { List <ClassScheduleView> list = new ClassScheduleViewManager().GetAllClassScheduleViewsByDeptId(departmentId); List <ClassScheduleView> myList = new List <ClassScheduleView>(); for (var i = 0; i < list.Count;) { ClassScheduleView classView = list[i]; ClassScheduleView temp = new ClassScheduleView(); temp.CourseCode = classView.CourseCode; temp.CourseName = classView.CourseName; temp.ScheduleInfo = ("R. No : " + classView.RoomName + ", " + classView.DayShortName + ", " + classView.TimeFrom + " - " + classView.TimeTo) + "</br>"; int ck = 0; i++; for (var j = i; j < list.Count; j++) { ck = 1; ClassScheduleView classView2 = list[j - 1]; ClassScheduleView classView3 = list[j]; if (classView2.CourseCode == classView3.CourseCode) { i++; temp.ScheduleInfo += ("R. No : " + classView3.RoomName + ", " + classView3.DayShortName + ", " + classView3.TimeFrom + " - " + classView3.TimeTo + "</br>"); //myList.Add(temp); } else { if (classView.RoomName == "") { temp.ScheduleInfo = "Not Assigned Yet"; } myList.Add(temp); break; } } if (ck == 0) { if (classView.RoomName == "") { temp.ScheduleInfo = "Not Assigned Yet"; } myList.Add(temp); } } return(myList); }
//<---Corse Schdule ---> //public List<ClassScheduleView> GetAllSchedule(int departmentId) //{ // string query = "SELECT * FROM ClassAllocatedView WHERE DepartmentId=" + departmentId + " "; // Command = new SqlCommand(query, Connection); // Connection.Open(); // Reader = Command.ExecuteReader(); // List<ClassScheduleView> scheduleList = new List<ClassScheduleView>(); // while (Reader.Read()) // { // ClassScheduleView schedule = new ClassScheduleView(); // schedule.CourseCode = Reader["CourseCode"].ToString(); // schedule.CourseName = Reader["CourseName"].ToString(); // schedule.RoomNo = Reader["RoomNo"].ToString(); // schedule.DayName = Reader["DayName"].ToString(); // schedule.FromTime = Convert.ToDateTime(Reader["FromTime"].ToString()); // schedule.ToTime = Convert.ToDateTime(Reader["ToTime"].ToString()); // scheduleList.Add(schedule); // } // Connection.Close(); // return scheduleList; //} public List <ClassScheduleView> GetClassSchedule(int departmentId) { string query = "SELECT * FROM ClassAllocatedView WHERE DepartmentId=" + departmentId + " AND Action = 1 "; Command = new SqlCommand(query, Connection); Connection.Open(); List <ClassScheduleView> scheduleList = new List <ClassScheduleView>(); Hashtable ht = new Hashtable(); Reader = Command.ExecuteReader(); ClassScheduleView schedule; while (Reader.Read()) { string courseCode = Reader["CourseCode"].ToString(); string courseName = Reader["CourseName"].ToString(); string roomNo = Reader["RoomNo"].ToString(); string dayName = Reader["DayName"].ToString(); string fromTime = Reader["FromTime"].ToString(); string toTime = Reader["ToTime"].ToString(); string scheduleInfo = "R.No: " + roomNo + ", " + dayName + ", " + fromTime + " - " + toTime + ";<br />"; if (scheduleInfo == "") { scheduleInfo = "Not Scheduled Yet"; } if (!ht.ContainsKey(courseCode)) { schedule = new ClassScheduleView(); schedule.CourseCode = courseCode; schedule.CourseName = courseName; schedule.Schedule = scheduleInfo; ht[courseCode] = schedule; scheduleList.Add(schedule); } else { schedule = (ClassScheduleView)ht[courseCode]; schedule.Schedule = schedule.Schedule + scheduleInfo; } } Connection.Close(); return(scheduleList); }
public List <ClassScheduleView> GetCourseIdByDepId(int departmentId) { string query = "SELECT * FROM ClassAllocatedView WHERE DepartmentId='" + departmentId + "' AND Action = 1"; Command = new SqlCommand(query, Connection); Connection.Open(); List <ClassScheduleView> GetCourse = new List <ClassScheduleView>(); Reader = Command.ExecuteReader(); while (Reader.Read()) { ClassScheduleView schedule = new ClassScheduleView(); schedule.CourseId = Convert.ToInt32(Reader["CourseId"]); GetCourse.Add(schedule); } Connection.Close(); return(GetCourse); }
public List <ClassScheduleView> GetAllocateInfoByDepartmentId(int?departmentId) { var allocateInfo = allocateClassRoomGateway.GetAllAllocateInfoByDepartmentId(departmentId); int count = -1; string code = ""; string scheduleInfo = ""; List <ClassScheduleView> classScheduleViews = new List <ClassScheduleView>(); foreach (AllocateClassRoomView value in allocateInfo) { ClassScheduleView classScheduleView = new ClassScheduleView(); classScheduleView.Code = value.CourseCode; classScheduleView.Name = value.CourseTitle; string roomNumber = value.RoomNumber; if (roomNumber == "Not Scheduled Yet") { scheduleInfo = value.RoomNumber; classScheduleView.Schedule = scheduleInfo; classScheduleViews.Add(classScheduleView); count++; } else if (code == classScheduleView.Code) { scheduleInfo = scheduleInfo + ";<br/>R. No: " + value.RoomNumber + ", " + value.Day + ", " + value.FromTime + " - " + value.ToTime; classScheduleView.Schedule = scheduleInfo; classScheduleViews.RemoveAt(count); classScheduleViews.Add(classScheduleView); } else { scheduleInfo = "R. No: " + value.RoomNumber + ", " + value.Day + ", " + value.FromTime + " - " + value.ToTime; classScheduleView.Schedule = scheduleInfo; classScheduleViews.Add(classScheduleView); count++; code = value.CourseCode; } } return(classScheduleViews); }
public List <ClassScheduleView> GetCourseByDepartmentId(int departmentId) { string query = "SELECT * FROM ClassAllocatedView WHERE DepartmentId='" + departmentId + "' AND CourseAction=1 AND Action = 1 "; Command = new SqlCommand(query, Connection); Connection.Open(); Reader = Command.ExecuteReader(); List <ClassScheduleView> departments = new List <ClassScheduleView>(); while (Reader.Read()) { ClassScheduleView course = new ClassScheduleView(); course.CourseId = Convert.ToInt32(Reader["CourseId"]); course.CourseName = Reader["CourseName"].ToString(); course.CourseCode = Reader["CourseCode"].ToString(); departments.Add(course); } Connection.Close(); return(departments); }
public List <ClassScheduleView> GetAllClassScheduleViewsByDeptId(int deptId) { string query = "SELECT CourseTable.CourseCode, CourseTable.CourseName,SevenDayWeekTable.DayShortName,ClassRoomAllocationTable.TimeFrom," + " ClassRoomAllocationTable.TimeTo,ClassRoomAllocationTable.Status,ClassRoomTable.RoomName" + " FROM ClassRoomAllocationTable" + " Left join SevenDayWeekTable ON SevenDayWeekTable.id=ClassRoomAllocationTable.SevenDayWeekID" + " Inner join ClassRoomTable ON ClassRoomTable.id=ClassRoomAllocationTable.RoomNoID" + " Right JOIN CourseTable ON CourseTable.id=ClassRoomAllocationTable.CourseID" + " where CourseTable.DepartmentID='" + deptId + "' order by CourseCode"; _command = new SqlCommand(query, _connection); _connection.Open(); _sqlDataReader = _command.ExecuteReader(); List <ClassScheduleView> listOfItems = new List <ClassScheduleView>(); while (_sqlDataReader.Read()) { if (_sqlDataReader["Status"].ToString() == "1") { continue; } ClassScheduleView item = new ClassScheduleView(); item.CourseCode = _sqlDataReader["CourseCode"].ToString(); item.CourseName = _sqlDataReader["CourseName"].ToString(); item.DayShortName = _sqlDataReader["DayShortName"].ToString(); item.TimeFrom = _sqlDataReader["TimeFrom"].ToString(); if (item.TimeFrom != "" && Convert.ToInt32(item.TimeFrom) >= 1200) { int temp1 = Convert.ToInt32(item.TimeFrom) - 1200; string timeFrom = ""; if (temp1.ToString().Length == 1) { timeFrom = "12:00" + " PM"; } else if (temp1.ToString().Length == 2) { timeFrom = "12:" + temp1 + " PM"; } else if (temp1.ToString().Length == 3) { string temp = temp1.ToString(); char[] array = temp.ToCharArray(); timeFrom = "0" + array[0] + ":" + array[1] + array[2] + " PM"; } else { string temp = temp1.ToString(); char[] array = temp.ToCharArray(); timeFrom = "" + array[0] + array[1] + ":" + array[2] + array[3] + " PM"; } item.TimeFrom = timeFrom; } else if (item.TimeFrom != "" && Convert.ToInt32(item.TimeFrom) < 1200) { string temp = item.TimeFrom.ToString(); char[] array = temp.ToCharArray(); item.TimeFrom = "" + array[0] + array[1] + ":" + array[2] + array[3] + " AM"; } item.TimeTo = _sqlDataReader["TimeTo"].ToString(); if (item.TimeTo != "" && Convert.ToInt32(item.TimeTo) >= 1200) { int temp1 = Convert.ToInt32(item.TimeTo) - 1200; string timeTo = ""; if (temp1.ToString().Length == 1) { timeTo = "12:00" + " PM"; } else if (temp1.ToString().Length == 2) { timeTo = "12:" + temp1 + " PM"; } else if (temp1.ToString().Length == 3) { string temp = temp1.ToString(); char[] array = temp.ToCharArray(); timeTo = "0" + array[0] + ":" + array[1] + array[2] + " PM"; } else { string temp = temp1.ToString(); char[] array = temp.ToCharArray(); timeTo = "" + array[0] + array[1] + ":" + array[2] + array[3] + " PM"; } item.TimeTo = timeTo; } else if (item.TimeTo != "" && Convert.ToInt32(item.TimeTo) < 1200) { string temp = item.TimeTo.ToString(); char[] array = temp.ToCharArray(); item.TimeTo = "" + array[0] + array[1] + ":" + array[2] + array[3] + " AM"; } item.RoomName = _sqlDataReader["RoomName"].ToString(); listOfItems.Add(item); } _connection.Close(); return(listOfItems); }