Exemplo n.º 1
0
 public ActionResult SaveDepartment(Department aDepartment)
 {
     if (aDepartment.Code == null || aDepartment.Name == null)
     {
         ViewBag.message = "Input Values";
     }
     else
     {
         if (aDepartment.Code.Length < 2 || aDepartment.Code.Length > 7)
         {
             ViewBag.message = "Code Length Must be 2 to 7 characters";
         }
         else
         {
             List <Department> alist = aDepartmentManager.GetAllDepartmentInfo();
             var departmnetcode      = alist.FirstOrDefault(c => c.Code == aDepartment.Code);
             var departmentname      = alist.FirstOrDefault(n => n.Name == aDepartment.Name);
             if (departmnetcode != null || departmentname != null)
             {
                 if (departmnetcode != null && departmentname != null)
                 {
                     ViewBag.message = "Code and Name Already Exist";
                 }
                 else if (departmnetcode != null)
                 {
                     ViewBag.message = "Code Already Exist";
                 }
                 else if (departmentname != null)
                 {
                     ViewBag.message = "Name Already Exist";
                 }
             }
             else
             {
                 if (aDepartmentManager.SaveDepartment(aDepartment) > 0)
                 {
                     ViewBag.message = "Department Saved Successfully";
                 }
                 else
                 {
                     ViewBag.message = "Save Failed";
                 }
             }
         }
     }
     ModelState.Clear();
     return(View());
 }
Exemplo n.º 2
0
        // GET: CourseStatics
        public ActionResult ViewCourseStatics()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            return(View());
        }
Exemplo n.º 3
0
        // GET: Schedule
        public ActionResult ViewClassroom()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();

            ViewBag.departmentlist = aDepartmentManager.GetAllDepartmentInfo();
            return(View());
        }
        // GET: CourseAssignToTeacher
        public ActionResult AssignToTeacher()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult Allocate(AllocateClassroom allocate)
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            RoomManager       aRoomManager       = new RoomManager();
            sevendaysManager  aSevendaysManager  = new sevendaysManager();

            ViewBag.aldepartments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.allrooms      = aRoomManager.GetAllRooms();
            ViewBag.sevendays     = aSevendaysManager.GetAllDays();
            AllocateClassRoomManager allocateClassRoomManager = new AllocateClassRoomManager();
            bool allocateRoom = allocateClassRoomManager.GetRoomCheck(allocate);

            if (allocate.From > allocate.To)
            {
                ViewBag.message = "Your Time Formate isn't Right";
            }

            else if (allocateRoom)
            {
                ViewBag.message = "Room Is Not Free";
            }
            else
            {
                if (allocateClassRoomManager.SaveAllocateClassRoom(allocate) > 0)
                {
                    ViewBag.message = "Room Is Allocated";
                }
                else
                {
                    ViewBag.message = "Failed To Allocated";
                }
            }

            return(View());
        }
Exemplo n.º 6
0
        public ActionResult CLassroomAllocation(ClassAllocation aClassAllocation)
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            CourseManager     aCourseManager     = new CourseManager();
            RoomManager       aRoomManager       = new RoomManager();
            DayManager        aDayManager        = new DayManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.courses     = aCourseManager.GetAllCourse();
            ViewBag.rooms       = aRoomManager.GetAllRoom();
            ViewBag.days        = aDayManager.GetAllDay();
            ClassAllocationManager aClassAllocationManager = new ClassAllocationManager();

            List <ClassAllocation> alist = aClassAllocationManager.GetAllocatedClassInfo();

            if (aClassAllocationManager.CLassroomAllocation(aClassAllocation) > 0)
            {
                ViewBag.message = "Classrooms are Successfully allocated";
            }
            else
            {
                ViewBag.message = "Allocation Failed";
            }
            return(View());
        }
        public ActionResult SaveCourse()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            SemesterManager   aSemesterManager   = new SemesterManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.semesters   = aSemesterManager.GetAllSemester();
            return(View());
        }
Exemplo n.º 8
0
        public ActionResult SaveTeacher()
        {
            DesignationManager aDesignationManager = new DesignationManager();
            DepartmentManager  aDepartmentManager  = new DepartmentManager();

            ViewBag.designations = aDesignationManager.GetAllDesignations();
            ViewBag.departments  = aDepartmentManager.GetAllDepartmentInfo();
            return(View());
        }
        public ActionResult CourseStatistics(CourseStatistics aCourseStatics)
        {
            DepartmentManager       aDepartmentManager   = new DepartmentManager();
            CourseStatisticsManager aCourseStaticManager = new CourseStatisticsManager();

            ViewBag.departments      = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.Coursestatistics = aCourseStaticManager.GetAllCourseStatistics();
            return(View());
        }
        public ActionResult AssignToTeacher(CourseAssignToTeacher assign)
        {
            Teacher                      aTeacher               = new Teacher();
            DepartmentManager            aDepartmentManager     = new DepartmentManager();
            CourseAssignToTeacherManager assignToTeacherManager = new CourseAssignToTeacherManager();
            TeacherManager               aTeacherManager        = new TeacherManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            aTeacherManager.GetAllTeachers();
            if (aTeacher.RemainingCredit < assign.CourseCredit)
            {
            }
            var assinglist            = assignToTeacherManager.GetAllCourseassinAssignToTeachers();
            var assingcoursttoteacher = assinglist.FirstOrDefault(t => t.CourseId == assign.CourseId);
            var assigntrue            = assignToTeacherManager.GetAllCourseassinAssignToTeachersTrue();
            var assigntruefind        = assigntrue.FirstOrDefault(c => c.CourseId == assign.CourseId);
            var assignfalse           = assignToTeacherManager.GetAllCourseassinAssignToTeachersFalse();
            var assigntfalsefind      = assignfalse.FirstOrDefault(c => c.CourseId == assign.CourseId);

            if (assign.CourseCredit == 0.0)
            {
                ViewBag.message = "Input Values";
            }
            else
            {
                if (assigntruefind != null)
                {
                    ViewBag.message = "Course Already Assigned";
                }
                else if (assigntfalsefind != null)
                {
                    if (assignToTeacherManager.UpdateAssignCourse(assign) > 0)
                    {
                        ViewBag.message = "Assign Successfull";
                    }
                    else
                    {
                        ViewBag.message = "Assign Failed";
                    }
                }
                else
                {
                    if (assignToTeacherManager.AssignCourseToTeacher(assign) > 0)
                    {
                        assignToTeacherManager.UpdateRemainingCredit(assign.CourseCredit, assign.TeacherId);

                        ViewBag.message = "Assign Successfull";
                    }
                    else
                    {
                        ViewBag.message = "Failed to Assign";
                    }
                }
            }
            return(View());
        }
Exemplo n.º 11
0
        // GET: Student
        public ActionResult RegisterStudent()
        {
            Student aStudent = new Student();

            aStudent.Date = DateTime.Today;
            DepartmentManager aDepartmentManager = new DepartmentManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            return(View(aStudent));
        }
Exemplo n.º 12
0
        // GET: AllocateClassroom
        public ActionResult Allocate()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            RoomManager       aRoomManager       = new RoomManager();
            sevendaysManager  aSevendaysManager  = new sevendaysManager();

            ViewBag.aldepartments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.allrooms      = aRoomManager.GetAllRooms();
            ViewBag.sevendays     = aSevendaysManager.GetAllDays();
            return(View());
        }
        public ActionResult SaveDepartment(Department aDepartment)
        {
            List <Department> alist = aDepartmentManager.GetAllDepartmentInfo();
            var departmnetcode      = alist.FirstOrDefault(c => c.Code == aDepartment.Code);
            var departmentname      = alist.FirstOrDefault(n => n.Name == aDepartment.Name);

            //if (aDepartment.Code == " " && aDepartment.Name == " ")
            //{
            //    return ViewBag.message = "Insert Both Values";
            //}
            //else
            //{
            if (departmnetcode != null || departmentname != null)
            {
                if (departmnetcode != null && departmentname != null)
                {
                    ViewBag.message = "Code and Name Already Exist";
                }
                else if (departmnetcode != null)
                {
                    ViewBag.message = "Code Already Exist";
                }
                else
                {
                    ViewBag.message = "Name Already Exist";
                }
            }
            else
            {
                if (aDepartmentManager.SaveDepartment(aDepartment) > 0)
                {
                    ViewBag.message = "Department Saved Successfully";
                }
                else
                {
                    ViewBag.message = "Save Failed";
                }
            }
            return(View());
            //}
        }
Exemplo n.º 14
0
        public ActionResult ViewCourseStatics(CourseStatics aCourseStatics)
        {
            DepartmentManager   aDepartmentManager   = new DepartmentManager();
            CourseStaticManager aCourseStaticManager = new CourseStaticManager();

            ViewBag.departments   = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.coursestatics = aCourseStaticManager.GetAllCourseStaticses();
            var courselist = aCourseStaticManager.GetAllCourseStaticsesbyDepartmentId(aCourseStatics.DepartmentId);

            ViewBag.clist = courselist;
            return(View());
        }
Exemplo n.º 15
0
        //
        // GET: /ClassAllocate/
        public ActionResult CLassroomAllocation()
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            //CourseManager aCourseManager = new CourseManager();
            RoomManager aRoomManager = new RoomManager();
            DayManager  aDayManager  = new DayManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.courses     = aCourseManager.GetAllCourse();
            ViewBag.rooms       = aRoomManager.GetAllRoom();
            ViewBag.days        = aDayManager.GetAllDay();
            return(View());
        }
        public ActionResult SaveTeacher(Teacher aTeacher)
        {
            DesignationManager aDesignationManager = new DesignationManager();
            DepartmentManager  aDepartmentManager  = new DepartmentManager();
            TeacherManager     aTeacherManager     = new TeacherManager();

            ViewBag.designations = aDesignationManager.GetAllDesignations();
            ViewBag.departments  = aDepartmentManager.GetAllDepartmentInfo();

            if (aTeacher.Name == null || aTeacher.Address == null || aTeacher.Email == null ||
                aTeacher.ContactNo == null || aTeacher.DesignationId == 0 || aTeacher.DepartmentId == 0 ||
                aTeacher.CreditTobeTaken == 0.0)
            {
                ViewBag.message = "Input Values";
            }
            else
            {
                List <Teacher> aList        = aTeacherManager.GetAllTeachers();
                var            teacheremail = aList.FirstOrDefault(e => e.Email == aTeacher.Email);

                if (aTeacher.CreditTobeTaken < 0 || teacheremail != null)
                {
                    if (aTeacher.CreditTobeTaken < 0 && teacheremail != null)
                    {
                        ViewBag.message = "Credit must contain a non-negative value And Email Already Exist";
                    }
                    else if (aTeacher.CreditTobeTaken < 0)
                    {
                        ViewBag.message = "Credit must contain a non-negative value";
                    }
                    else if (teacheremail != null)
                    {
                        ViewBag.message = "Email Already Exist";
                    }
                }
                else
                {
                    if (aTeacherManager.SaveTeacher(aTeacher) > 0)
                    {
                        ViewBag.message = "Teacher Saved Successfully";
                    }
                    else
                    {
                        ViewBag.message = "Save Failed";
                    }
                }
            }

            return(View());
        }
        public ActionResult SaveCourse(Course aCourse)
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            SemesterManager   aSemesterManager   = new SemesterManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.semesters   = aSemesterManager.GetAllSemester();
            CourseManager aCourseManager = new CourseManager();

            List <Course> alist      = aCourseManager.GetAllCourse();
            var           coursecode = alist.FirstOrDefault(c => c.Code == aCourse.Code);
            var           coursename = alist.FirstOrDefault(n => n.Name == aCourse.Name);

            if (coursecode != null || coursename != null)
            {
                if (coursecode != null && coursename != null)
                {
                    ViewBag.message = "Code and Name Already Exist";
                }
                else if (coursecode != null)
                {
                    ViewBag.message = "Code Already Exist";
                }
                else
                {
                    ViewBag.message = "Name Already Exist";
                }
            }
            else
            {
                if (aCourseManager.SaveCourse(aCourse) > 0)
                {
                    ViewBag.message = "Course Saved Successfully";
                }
                else
                {
                    ViewBag.message = "Save Failed";
                }
            }
            return(View());
        }
Exemplo n.º 18
0
        public ActionResult RegisterStudent(Student aStudent)
        {
            Department aDepartment = new Department();

            aStudent.Code = aDepartment.Code;
            DepartmentManager aDepartmentManager = new DepartmentManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            StudentManager aStudentManager = new StudentManager();
            int            totalNo         = aStudentManager.NoOfRegistraion();
            var            code            = aStudentManager.GetDepartmentCodeById(aStudent.DepartmentId);
            var            Year            = aStudent.Date.Year;
            int            no    = 1;
            string         RegNo = "";
            //= (code + "-" + Year + "-") + (no.ToString().PadLeft(3, '0'));
            string codeyear      = (code + "-" + Year);
            int    codeyearcount = codeyear.Length;
            int    abc           = 1;

            if (totalNo > 0)
            {
                abc = aStudentManager.NoOfCodeAndYear(codeyearcount, codeyear);
                if (abc > 0)
                {
                    abc  += 1;
                    RegNo = (code + "-" + Year + "-") + abc.ToString().PadLeft(3, '0');
                }
                else
                {
                    RegNo = (code + "-" + Year + "-") + no.ToString().PadLeft(3, '0');
                }
            }
            else
            {
                RegNo = (code + "-" + Year + "-") + no.ToString().PadLeft(3, '0');
            }

            aStudent.RegistrarionNo = RegNo;
            var alStudents = aStudentManager.GetAllStudents();

            if (aStudent.Name == null || aStudent.Email == null || aStudent.ContactNo == null ||
                aStudent.Address == null || aStudent.DepartmentId == 0)
            {
                ViewBag.message = "Input Values";
            }
            else
            {
                var studentlist  = aStudentManager.GetAllStudents();
                var studentemail = studentlist.FirstOrDefault(s => s.Email == aStudent.Email);
                if (studentemail != null)
                {
                    ViewBag.message = "Email Already Exist";
                }
                else
                {
                    if (aStudentManager.SaveStudent(aStudent) > 0)
                    {
                        ViewBag.message = "Student Info Saved Successfully";
                    }
                    else
                    {
                        ViewBag.message = "Failed insertion";
                    }
                }
            }

            return(View());
        }
        public ActionResult SaveCourse(Course aCourse)
        {
            DepartmentManager aDepartmentManager = new DepartmentManager();
            SemesterManager   aSemesterManager   = new SemesterManager();

            ViewBag.departments = aDepartmentManager.GetAllDepartmentInfo();
            ViewBag.semesters   = aSemesterManager.GetAllSemester();
            CourseManager aCourseManager = new CourseManager();

            if (aCourse.Credit == 0.0 || aCourse.Code == null || aCourse.Name == null || aCourse.DepartmentId == 0 ||
                aCourse.SemesterId == 0)
            {
                ViewBag.message = "Input Values";
            }
            else
            {
                if (aCourse.Code.Length < 5 || (aCourse.Credit < 0.5 || aCourse.Credit > 5.0))
                {
                    if (aCourse.Code.Length < 5 && (aCourse.Credit < 0.5 || aCourse.Credit > 5.0))
                    {
                        ViewBag.message = "Code length must be at least 5 characters and \n Credit range is from 0.5 to 5.0";
                    }

                    else if (aCourse.Code.Length < 5)
                    {
                        ViewBag.message = "Code length must be at least 5 characters";
                    }
                    else if (aCourse.Credit < 0.5 || aCourse.Credit > 5.0)
                    {
                        ViewBag.message = "Credit range is from 0.5 to 5.0";
                    }
                }
                else
                {
                    List <Course> alist      = aCourseManager.GetAllCourse();
                    var           coursecode = alist.FirstOrDefault(c => c.Code == aCourse.Code);
                    var           coursename = alist.FirstOrDefault(n => n.Name == aCourse.Name);
                    if (coursecode != null || coursename != null)
                    {
                        if (coursecode != null && coursename != null)
                        {
                            ViewBag.message = "Code and Name Already Exist";
                        }
                        else if (coursecode != null)
                        {
                            ViewBag.message = "Code Already Exist";
                        }
                        else if (coursename != null)
                        {
                            ViewBag.message = "Name Already Exist";
                        }
                    }
                    else
                    {
                        if (aCourseManager.SaveCourse(aCourse) > 0)
                        {
                            ViewBag.message = "Course Saved Successfully";
                        }
                        else
                        {
                            ViewBag.message = "Save Failed";
                        }
                    }
                }
            }
            return(View());
        }
Exemplo n.º 20
0
 public ActionResult ViewDepartment()
 {
     ViewBag.departmentList = manage.GetAllDepartmentInfo();;
     return(View());
 }