public ActionResult AllocateClassroom(AllocateClassroom allocateClassroom)
        {
            _allocateClassRoomManager.IsRoomAllocated(allocateClassroom);

            if (_allocateClassRoomManager.Message == "")
            {
                bool result = _allocateClassRoomManager.Save(allocateClassroom);
                if (result)
                {
                    ViewBag.SuccessMessage = "Class Room Allocated Successfully";
                }
                else
                {
                    ViewBag.ErrorMessage = "Class Room Allocation Failed";
                }
            }
            else
            {
                ViewBag.ErrorMessage = _allocateClassRoomManager.Message;
            }



            ViewBag.Department = _departmentManager.GetAllDepartments();
            ViewBag.Classroom  = _classroomManager.GetAllRooms();
            ViewBag.Day        = _dayManager.GetAllDays();
            return(View());
        }
Example #2
0
 public ActionResult AllocateClassRoom(AllocateClassRoom allocateClassRoom)
 {
     if (ModelState.IsValid)
     {
         string   message;
         DateTime fromTime = DateTime.Parse(allocateClassRoom.FromTime);
         DateTime toTime   = DateTime.Parse(allocateClassRoom.ToTime);
         if (fromTime > toTime)
         {
             message         = "Invalid time range!";
             ViewBag.Message = message;
         }
         else
         {
             message         = allocateClassRoomManager.Save(allocateClassRoom);
             ViewBag.Message = message;
         }
         ModelState.Clear();
     }
     else
     {
         ViewBag.Message = "Model state is invalid!";
     }
     ViewBag.Rooms       = allocateClassRoomManager.GetAllRooms();
     ViewBag.Days        = allocateClassRoomManager.GetAllDays();
     ViewBag.Departments = departmentManager.GetAllDepartments();
     return(View());
 }
 public ActionResult Save(AllocateClass allocateClass)
 {
     ViewBag.Message     = allocateClassRoomManager.Save(allocateClass);
     ViewBag.Departments = departmentManager.GetSelectListItemsForDropdown();
     ViewBag.Rooms       = roomManager.GetSelectListRoomsForDropdown();
     ViewBag.Days        = dayManager.GetSelectListDaysForDropdown();
     return(View());
 }
Example #4
0
 public ActionResult Save(AllocateClassRoom allocateClassRoom)
 {
     ViewBag.Message     = allocateClassRoomManager.Save(allocateClassRoom);
     ViewBag.Departments = GetDepartments();
     ViewBag.Courses     = GetCourses();
     ViewBag.Rooms       = GetRooms();
     ViewBag.Days        = GetDays();
     return(View());
 }
Example #5
0
 public ActionResult Save(AllocateClassroom allocateClassroom)
 {
     if (ModelState.IsValid)
     {
         string message = allocateClassRoomManager.Save(allocateClassroom);
         ViewBag.Message     = message;
         ViewBag.Departments = departmentManager.GetAllDepartmentsForDropdown();
         ViewBag.Courses     = courseManager.GetAllCoursesForDropdown();
         ViewBag.Rooms       = roomManager.GetAllRoomsforDropDown();
         ViewBag.Days        = dayManager.GetAllDayList();
         return(View());
     }
     else
     {
         ViewBag.Message = "Model State is Invalid";
         return(View());
     }
 }
Example #6
0
        public ActionResult SaveClassRooms(AllocateClassrooms allocateClassrooms)
        {
            ViewBag.departments = departmentManager.GetAllDepartment();
            ViewBag.courses     = courseManager.GetAllCourse();
            ViewBag.days        = getAllDays();
            ViewBag.rooms       = getAllRooms();
            // List<Course> courseList= courseManager.GetAllCourse();
            if (ModelState.IsValid)
            {
                int    id         = allocateClassrooms.CourseId;
                Course courseList = courseManager.GetOneCourseById(id);
                allocateClassrooms.CourseCode = courseList.Code;
                allocateClassrooms.CourseName = courseList.Name;

                string message = allocateClassRoomManager.Save(allocateClassrooms);
                ViewBag.Message = message;
            }

            return(View());
        }
Example #7
0
        public ActionResult Allocate(AllocateClassRoom allocateClassRoom)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Message = allocateClassRoomManager.Save(allocateClassRoom);
            }
            else
            {
                ViewBag.Message = "Model State is Invalid";
            }

            List <Department> departments = departmentManager.GetAllDepartments();

            departments.Insert(0, new Department()
            {
                Id   = 0,
                Code = "--Select--"
            });
            List <Course> courses = new List <Course>()
            {
                new Course()
                {
                    Id = 0, Code = "--Select--", DepartmentId = 0
                }
            };
            List <ClassRoom> classRooms = new List <ClassRoom>()
            {
                new ClassRoom()
                {
                    Id = 0, DepartmentId = 0, Name = "--Select--"
                }
            };
            List <string> days = GetDays();

            ViewBag.Departments = departments;
            ViewBag.ClassRooms  = classRooms;
            ViewBag.Courses     = courses;
            ViewBag.Days        = days;
            return(View());
        }