Beispiel #1
0
def faculty_notifications():
	try:
		if session['type']!="faculty":
			return redirect(url_for("logout"))
	except:
		return redirect(url_for("logout"))
	db_conn = mysql.connector.connect(host = "localhost", port = 3306, user = "******",password="******", database = "pesuapp")
	# db_conn = mysql.connector.connect(host = "localhost", port = 3306, user = "******", database = "pesuapp")
	A1 = Faculty(db_conn, session['email'])
	all_announcements = A1.ViewAnnouncements(db_conn)
	#all_announcements = session['obj'].ViewAnnouncements(db_conn)
	return render_template("faculty_notifications.html", all_announcements = all_announcements)
Beispiel #2
0
def faculty_courses():
	try:
		if session['type']!="faculty":
			return redirect(url_for("logout"))
	except:
		return redirect(url_for("logout"))
	db_conn = mysql.connector.connect(host = "localhost", port = 3306, user = "******",password="******", database = "pesuapp")
	# db_conn = mysql.connector.connect(host = "localhost", port = 3306, user = "******", database = "pesuapp")
	F1=Faculty(db_conn,session['email'])
	number_of_courses,course_list=F1.GetStats(db_conn)
	#number_of_courses,course_list=session['obj'].GetStats(db_conn)
	return render_template("faculty_courses.html",number_of_courses=number_of_courses,course_list=course_list)
Beispiel #3
0
 def addFaculty(self, id, name, courses):
     faculty = Faculty()
     faculty.setId(id)
     faculty.setName(name)
     faculty.setCourseNames(courses)
     print(faculty.id)
     print(faculty.name)
     print(faculty.courseNames)
Beispiel #4
0
class Department:
    ''
    name = ""
    numberOfMembers = -1
    university = ""
    currentFaculty = Faculty()

    def __init__(self):
        self.name = "?"
        self.numberOfMembers = 0
        self.university = "?"

    def getDeptName(self):
        return self.name

    def getNumberOfMembers(self):
        return self.numberOfMembers

    def getUniversity(self):
        return self.university

    def getCurrentFaculty(self):
        return self.currentFaculty

    def setDeptName(self, d_name):
        self.name = d_name

    def setNumberOfMembers(self, n_members):
        self.numberOfMembers = n_members

    def setUniversity(self, univ):
        self.university = univ

    def setCurrentFaculty(self, firstName, lastName, academicLevel):
        self.currentFaculty = Faculty()
        self.currentFaculty.setFirstName(firstName)
        self.currentFaculty.setLastName(lastName)
        self.currentFaculty.setAcademicLevel(academicLevel)

    def __repr__(self):
        return "\nDepartment Name:\t\t" + self.name + "\nNumber of Members:\t" + str(
            self.numberOfMembers
        ) + "\nUniversity:\t\t" + self.university + "\nFaculty:\t\t" + str(
            self.currentFaculty) + "\n\n"
Beispiel #5
0
class Department:

    # Constructor
    def __init__(self, deptname, university, numofmembers, firstname, lastname,
                 academiclevel):
        self.deptname = deptname
        self.university = university
        self.numofmembers = numofmembers
        self.currentfaculty = Faculty(firstname, lastname, academiclevel)

    # Getters
    def getdeptname(self):
        return self.deptname

    def getuniversity(self):
        return self.university

    def getnumofmembers(self):
        return self.numofmembers

    def getfaculty(self):
        return self.currentfaculty

    # Setters
    def setdeptname(self, a):
        self.deptname = str(a)

    def setnumofmembers(self, a):
        self.numofmembers = int(a)

    def setuniversity(self, a):
        self.university = str(a)

    def setfaculty(self, firstname, lastname, academiclevel):
        self.currentfaculty.setfirstname(str(firstname))
        self.currentfaculty.setlastname(str(lastname))
        self.currentfaculty.setacademiclevel(str(academiclevel))

    def __repr__(self):
        return ("\nDept. Name:\t\t" + self.deptname + "\n" +
                "University:\t\t" + self.university + "\n" +
                "# of Members:\t" + str(self.numofmembers) + "\n" +
                "Faculty:\t\t" + str(self.currentfaculty) + "\n")
Beispiel #6
0
         break
     batch.setFacultyName(input("Enter Faculty name\n"))
     faculty = studentScheduler.getFaculty(batch.getFacultyName())
     if (faculty == None):
         print("Faculty name not found")
         continue
     batch.setNoOfStudents(input("Enter no of students\n"))
     for count in range(batch.getNoOfStudents()):
         student=studentScheduler.getStudent(input("Enter roll number\n"))
         if(student==None):
             print("Invalid Roll number")
             count-=1
         batch.setStudents(student)
     studentScheduler.addBatch(batch)
 elif (choice == "5"):
     faculty=Faculty()
     faculty.setId(input("Enter Faculty id\n"))
     faculty.setName(input("Enter Faculty name\n"))
     faculty.setCourseNames(input("Enter Course name\n"))
     studentScheduler.addFaculty(faculty)
 elif (choice == "6"):
     while(1):
         choice2=input("Enter your choice\n1. Student details by roll number\n2. Batch details by batch id\n3. Batch details by roll number\n4. Exit\n")
         if(choice2=="1"):
             rollNum = input("Enter roll number\n")
             student = studentScheduler.getStudent(rollNum)
             if (student == None):
                 print("No student found")
             else:
                 print(student)
         elif(choice2=="2"):
Beispiel #7
0
    def start(self):
        while True:
            action = input(
                "Enter your choice\n1. Add Student\n2. Show Students\n3. Add Faculty\n4. Add Batch\n5. Exit\n"
            )

            if action == 1:
                quantity = input("How many students you want to add")
                for i in range(0, quantity):
                    print "Student", (i + 1)
                    student = Student()
                    student.setName(raw_input("Enter student name"))
                    while (True):
                        rollNumber = input("Enter roll number")
                        if self.__scheduler.validateRollNumber(rollNumber):
                            print "Roll Number already exists"
                            continue
                        else:
                            student.setRollNumber(rollNumber)
                            break
                    noOfCourses = input("How many course you want to attend")
                    for j in range(0, noOfCourses):
                        print "Course", (j + 1)
                        student.addCourses(raw_input("Enter courseName"))
                        self.__scheduler.addStudent(student)
                print "Students added successfully, what do you want to do now\n"

            elif action == 2:
                self.__scheduler.showAllStudents()

            elif action == 3:
                faculty = Faculty()
                faculty.setId(raw_input("Enter Faculty Id"))
                faculty.setName(raw_input("Enter Faculty Name"))
                noOfCourses = input("How many course you want to attend")
                for j in range(0, noOfCourses):
                    print "Course", (j + 1)
                    faculty.addCourses(raw_input("Enter courseName"))
                    self.__scheduler.addFaculty(faculty)

            elif action == 4:
                batch = Batch()
                batch.setId(raw_input("Enter Batch Id"))
                batch.setCourseName(raw_input("Enter Course Name"))
                batch.setFacultyName(raw_input("Enter Faculty Name"))
                noOfStudents = input("How many students you want to attend\n")
                self.__scheduler.showAllStudents()
                for j in range(0, noOfStudents):
                    print "Student", (j + 1)
                    while True:
                        rollNumber = input("Enter Student Roll Number to add")
                        if self.__scheduler.validateRollNumber(rollNumber):
                            batch.addStudents(
                                self.__scheduler.getStudentByRollNumber(
                                    rollNumber))
                            break
                        else:
                            print "Entered rollNumber does not exists, Try Again"
                            continue
                            self.__scheduler.addBatch(batch)
                print "Batch created successfully"

            elif action == 5:
                exit(0)
Beispiel #8
0
 def setCurrentFaculty(self, firstName, lastName, academicLevel):
     self.currentFaculty = Faculty()
     self.currentFaculty.setFirstName(firstName)
     self.currentFaculty.setLastName(lastName)
     self.currentFaculty.setAcademicLevel(academicLevel)
class studentScheduler:
    def __init__(self):
         self.Student=""
         self.Students={}
         self.Course=""
         self.Courses = []
         self.Faculty = ""
         self.Faculties = []
         self.Batch =""
         self.Batches ={}

    def validate(self,rollNo):
        if rollNo in self.Students.keys():
            print("Student already exists with the same roll number")
            return True
        else:
            return False

    def getStudentByRollNo(self,rollNo):
        self.Student=self.Students[rollNo]
        print(self.Student.rollNo)
        print(self.Student.name)
        print(self.Student.courseNames)
        return self.Student

    def addStudent(self,rollNo,name,courseNames):
        self.Student=student()
        self.Student.setRollNo(rollNo)
        self.Student.setName(name)
        self.Student.setCourseNames(courseNames)
        self.Students.update({rollNo:self.Student})


    def addCourse(self,courseName):
        self.Course = Course()
        self.Course.setCourseName(courseName)
        self.Courses.append(self.Course)

    def addFaculty(self,facultyId,facultyName,facultyCourses):
        self.Faculty = Faculty()
        self.Faculty.setFacultyName(facultyName)
        self.Faculty.setFacultyId(facultyId)
        self.Faculty.setFacultyCourses(facultyCourses)
        self.Faculties.append(self.Faculty)

    def addBatch(self,batchId,batchCourseName,batchFacultyName,batchStudents):
        self.Batch=batch()
        self.Batch.setBatchId(batchId)
        self.Batch.setBatchCourseName(batchCourseName)
        self.Batch.setBatchFacultyName(batchFacultyName)
        self.Batch.setBatchStudents(batchStudents)
        self.Batches.update({batchId:self.Batch})

    def showAllStudents(self):
        sortedStudentRollNos=sorted(self.Students, key=self.Students.get, reverse=True)
        for rolNo in sortedStudentRollNos:
             self.Student=self.Students[rolNo]
             print(self.Student.rollNo)
             print(self.Student.name)
             print(self.Student.courseNames)

    def getBatchDetailsByBatchId(self,batchId):
        self.Batch = self.Batches[batchId]
        print(self.Batch.batchId)
        print(self.Batch.batchCourseName)
        print(self.Batch.batchFacultyName)
        print(self.Batch.batchStudents)
        return self.Batch

    def getBatchDetailsByRollNo(self,rollNo):
        keys=self.Batches.keys()
        for batchId in keys:
                if rollNo in self.Batches[batchId].batchStudents.keys():
                    print(self.Batches[batchId].batchId)
                    print(self.Batches[batchId].batchCourseName)
                    print(self.Batches[batchId].batchFacultyName)
                    print(self.Batches[batchId].batchStudents)
                    break
 def addFaculty(self,facultyId,facultyName,facultyCourses):
     self.Faculty = Faculty()
     self.Faculty.setFacultyName(facultyName)
     self.Faculty.setFacultyId(facultyId)
     self.Faculty.setFacultyCourses(facultyCourses)
     self.Faculties.append(self.Faculty)
Beispiel #11
0
 def __init__(self, deptname, university, numofmembers, firstname, lastname,
              academiclevel):
     self.deptname = deptname
     self.university = university
     self.numofmembers = numofmembers
     self.currentfaculty = Faculty(firstname, lastname, academiclevel)