public List <RoomAllocationInfo> GetAllRoomInfoByDepartmentId(int departmentId) { string query = "SELECT * FROM RoomAllocationInfo WHERE DepartmentId=@depId AND Type=1 Order By Code ASC"; SqlCommand command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@depId", departmentId); connection.Open(); reader = command.ExecuteReader(); List <RoomAllocationInfo> roomList = new List <RoomAllocationInfo>(); while (reader.Read()) { RoomAllocationInfo aRoom = new RoomAllocationInfo(); aRoom.CourseCode = (reader["Code"]).ToString(); aRoom.CourseName = (reader["Name"]).ToString(); aRoom.DepartmentName = (reader["DepartmentName"]).ToString(); aRoom.RoomNo = (reader["RoomNo"]).ToString(); aRoom.Day = (reader["Day"]).ToString(); aRoom.StartTime = (reader["StartTime"]).ToString(); aRoom.EndTime = (reader["EndTime"]).ToString(); if ((reader["AssignType"]).ToString() == "1") { aRoom.TotalSchedule = "Room No:" + aRoom.RoomNo + "," + aRoom.Day + "," + aRoom.StartTime + "-" + aRoom.EndTime; } else { aRoom.TotalSchedule = "Not Scheduled Yet"; } roomList.Add(aRoom); } connection.Close(); return(roomList); }
public ActionResult ViewClassSchedule(RoomAllocationInfo allocationInfo) { ViewBag.DepartmentList = aDepartmentManager.GetAllDepartmentForDropdown(); return(View()); }