public ActionResult Save(AllocateClass allocateClass) { ViewBag.Message = allocateClassRoomManager.Save(allocateClass); ViewBag.Departments = departmentManager.GetSelectListItemsForDropdown(); ViewBag.Rooms = roomManager.GetSelectListRoomsForDropdown(); ViewBag.Days = dayManager.GetSelectListDaysForDropdown(); return(View()); }
//------AllocateClassRoom------// public int Save(AllocateClass allocateClass) { string query = "INSERT INTO ClassAllocateTB(DepartmentId,CourseId,DayId,RoomId,FromTime,ToTime,Action) VALUES('" + allocateClass.DepartmentId + "','" + allocateClass.CourseId + "','" + allocateClass.DayId + "','" + allocateClass.RoomId + "','" + allocateClass.FromTime + "','" + allocateClass.ToTime + "','" + 1 + "')"; Command = new SqlCommand(query, Connection); Connection.Open(); int rowAffact = Command.ExecuteNonQuery(); Connection.Close(); return(rowAffact); }
public ActionResult UnallocatedClass(AllocateClass allocateClass) { if (allocateClassRoomManager.isActionExist()) { ViewBag.Message = allocateClassRoomManager.UpdateClass(); } else { ViewBag.Message = "Already Unallocate"; } return(View()); }
public string Save(AllocateClass allocateClass) { if (allocateClass.FromTime > allocateClass.ToTime) { return("This Time is not Avaiable"); } bool isTimeClassAllocateValid = IsTimeClassAllocateValid(allocateClass.DayId, allocateClass.RoomId, allocateClass.FromTime, allocateClass.ToTime); if (isTimeClassAllocateValid == false) { int rowAffect = allocateClassRoomGetway.Save(allocateClass); if (rowAffect > 0) { return("Save Successfully"); } else { return("Save Failed"); } } return("The Shedule Time Class Aleardy Exixts"); }
public JsonResult GetClassScheduleByDepartmentId(int departmentId) { AllocateClass allocateClass = new AllocateClass(); List <ClassScheduleView> courseBy = classScheduleManager.GetCourseByDepartmentId(departmentId); List <ClassScheduleView> GetCourseByDepartment = classScheduleManager.GetCourseByDepartmentId(departmentId); List <ClassScheduleView> schedules = classScheduleManager.GetClassSchedule(departmentId); //string getSchedule = classScheduleManager.GetAllSchedule(departmentId); //foreach (var course in GetCourseByDepartment) //{ // if (getSchedule == "") // { // getSchedule = "Not Scheduled Yet"; // } // ClassScheduleView schedule = new ClassScheduleView(); // schedule.CourseCode = course.CourseCode; // schedule.CourseName = course.CourseName; // schedule.Schedule = getSchedule; // schedules.Add(schedule); //} return(Json(schedules)); }
public List <AllocateClass> GetTimeAllocate(int dayId, int roomId, DateTime fromTime, DateTime toTime) { string query = "SELECT * FROM ClassAllocateTB WHERE RoomId=" + roomId + " AND DayId=" + dayId + " AND Action = 1"; Command = new SqlCommand(query, Connection); List <AllocateClass> allocateClassroomses = new List <AllocateClass>(); Connection.Open(); Reader = Command.ExecuteReader(); while (Reader.Read()) { AllocateClass allocate = new AllocateClass(); allocate.Id = Convert.ToInt32(Reader["Id"]); allocate.DepartmentId = Convert.ToInt32(Reader["DepartmentId"]); allocate.CourseId = Convert.ToInt32(Reader["CourseId"]); allocate.DayId = Convert.ToInt32(Reader["DayId"]); allocate.RoomId = Convert.ToInt32(Reader["RoomId"]); allocate.FromTime = Convert.ToDateTime(Reader["FromTime"]); allocate.ToTime = Convert.ToDateTime(Reader["ToTime"]); allocateClassroomses.Add(allocate); } Connection.Close(); return(allocateClassroomses); }
public ActionResult ClassSchedule(AllocateClass allocateClass) { ViewBag.Departments = departmentManager.GetSelectListItemsForDropdown(); return(View()); }