{"id":4522,"date":"2025-06-09T14:13:25","date_gmt":"2025-06-09T14:13:25","guid":{"rendered":"https:\/\/thecompanyboy.com\/?p=4522"},"modified":"2025-06-09T14:13:25","modified_gmt":"2025-06-09T14:13:25","slug":"college-and-home-automation-system-project-iot-using","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/drive\/college-and-home-automation-system-project-iot-using\/","title":{"rendered":"College And Home Automation System Project Using IOT (Python &amp; Machine Learning)"},"content":{"rendered":"<h1 style=\"text-align: center\"><span style=\"color: #ff6600\">PROJECT \u2013 REPORT<\/span><\/h1>\n<p style=\"text-align: center\">\n<span style=\"font-size: 36px\">College and Home Automation System Project Using IOT (Python &amp; Machine Learning)<\/span><\/p>\n<h2>\nCOLLEGE AUTOMATION SYSTEM<\/h2>\n<p>This report introduces the management system which is designed to automate the entire operations of a college and in reducing time in activities using centralized data handling and paperless work with reduced manpower. This Desktop Application has functionality that is basic requirement for college staff. It will help the college staff to access the application and keep record of college data like Student, their marks details and attendance etc. This general application is planned for aiding the students about details on the Courses, Subjects, Marks, Attendance.<\/p>\n<h2>INTRODUCTION<\/h2>\n<h3>1.1 INTRODUCTION TO PROJECT<\/h3>\n<p>\nPresently, each and every day, a novel application or software is being introduced in the economy that serves to enhance and uplift the lifestyle of the people in innumerable ways. College Automation System (CAS) is an application which aims to make the work load of college staff less. <br \/>\nCAS is a Desktop Application. Users have better experience with desktop application as compared to Web applications. CAS provides basic functionality to the users (in this case teachers) to maintain the records of the students. After login the user is redirected to the home page.<br \/>\nThe homepage or gateway displays a tree-view of the students according to their session, course. The gateway also consist of a menubar which can be used to navigate to different pages in the application like New Registration, View Students, Add marks, update marks, view marks, Mark attendance etc.<br \/>\nNew registrations can be made through the New Registration Form, user have to enter all the required details of the student and the student\u2019s details will be added to the database. The students can be enrolled to different semesters by using the Semester Registration Page. All the details of already saved students can be accessed by the View Students Page.<br \/>\nTeachers can add or update or view the marks of the students using the Add\/Update\/View Page. The teacher has to enter the session, course and semester and the students who fall into these conditions will be displayed in a tree-view. Teacher can select any student and click on the add marks button to add the marks of the student. If the marks of that particular student has been already added, the teacher will be redirected to the update marks page where they can update the marks of the student. There also a view button which displays the entered marks of the students, total marks obtained and percentage of the student.<br \/>\nCAS also provides the functionality of marking attendance of the students and maintain the record of the same. The teachers can marks the attendance from the mark attendance page which can be accessed through the submenu of the Attendance. Students present in selected session, course and semester will be displayed. If the student is present checkbox will be checked else it will be left unchecked. The record of the attendance can also be viewed through the view attendance page.<br \/>\nCAS also provide a master records which can be used to add a new session or new course or a new subject to the database. Already present sessions, courses and subjects can also be viewed and deleted. Masters records also provides Semester Subject Page which can be used to add different subjects to different semesters.<br \/>\nThe project is easy to use and has a friendly user interface so anyone with basic knowledge of computers can use the website and get benefited. Hence, the motto \u201cEducation must be accessible to anyone anytime and everywhere\u201d is fulfilled.<\/p>\n<h3>\n1.2 PROJECT CATEGORY<\/h3>\n<p>\nThe project presented in this paper belongs to the \u201cDesktop Applications\u201d. The simplest for a desktop application can be:<br \/>\nit runs on a PC operating system (Windows, Mac, Linux, etc.)<br \/>\nit has a graphical user interface<br \/>\nit does not run inside a web browser. <br \/>\nAn Internet connection is not required to run to this application.<br \/>\nThe application is developed in Python using Tkinter framework. This kind of application contains different forms and widgets. A python desktop application can be deployed as exe file. An EXE file contains an executable program for Windows. EXE is short for &#8220;executable,&#8221; and it is the standard file extension used by Windows programs.<\/p>\n<h3>\n1.3 PROBLEM FORMULATION<\/h3>\n<p>\nTeachers have to maintain records of every student on paper which leads to huge paper work. Sometimes, it is hard to find record of some student through huge pile of papers. The idea mainly focuses on making the reducing the workload of teachers by using centralized database from where every teacher has access to the records and they can add, update or remove information.<\/p>\n<h3>1.4 EXISTING SYSTEMS<\/h3>\n<p>\nCurrently, teachers maintain records on papers. Different information is stored in different registers etc. For marks, there is different register or papers, for attendance there is different. This makes the job more time consuming to maintain records at different places. Further, it is difficult to find records of students. Sometimes, if some information of student say contact number is changed, is has to be updated everywhere where contact number of the student is written. Again, this is very tedious task, finding where contact number is stored and updating it.<\/p>\n<h3>\n1.5 PROPOSED SYSTEM<\/h3>\n<p>\nThe current scenario presented a few major issues which are resolved in the proposed system. These include:<br \/>\n\u2981 This system reduces the paperwork. Records can be maintained in different pages of the application. It is less time consuming. It reduces the after work of maintaining record liking compiling marks of students. In this system, with a click of button it is possible.<br \/>\n\u2981 Besides, reducing paperwork it also reduces the efforts to find the records of students. Records of present students or existing student can be found by entering their registration id.<br \/>\n\u2981 If some detail of student is to be updated, it can be easily done and we done have to update it manually everywhere, the system will do it itself.<br \/>\n\u2981 The proposed system works on centralised database which means every teacher can access the data of students.<br \/>\n\u2981 The system interface is very user friendly, anyone can use this who has basic knowledge of English and computer and take the maximum benefit.<\/p>\n<h2>\n<p>SYSTEM DESIGN<\/h2>\n<h3>DESIGN APPROACH<\/h3>\n<p>\nObject Oriented Approach has been followed throughout the development of the project. Object oriented design works around the entities and their characteristics instead of functions involved in the software system. This design strategies focuses on entities and its characteristics. The whole concept of software solution revolves around the engaged entities.<\/p>\n<h3>\nThe important concepts of Object Oriented Design:<\/h3>\n<p>\n\uf0b7 Objects &#8211; All entities involved in the solution design are known as objects. For example, person, banks, company and customers are treated as objects. Every entity has some attributes associated to it and has some methods to perform on the attributes.<br \/>\n\uf0b7 Classes &#8211; A class is a generalized description of an object. An object is an instance of a class. Class defines all the attributes, which an object can have and methods, which defines the functionality of the object.<br \/>\nIn the solution design, attributes are stored as variables and functionalities are defined by means of methods or procedures. <br \/>\n\uf0b7 Encapsulation &#8211; In OOD, the attributes (data variables) and methods (operation on the data) are bundled together is called encapsulation. Encapsulation not only bundles important information of an object together, but also restricts access of the data and methods from the outside world. This is called information hiding.<br \/>\n\uf0b7 Inheritance &#8211; OOD allows similar classes to stack up in hierarchical manner where the lower or sub-classes can import, implement and re-use allowed variables and methods from their immediate super classes. This property of OOD is known as inheritance. This makes it easier to define specific class and to create generalized classes from specific ones.<br \/>\n\uf0b7 Polymorphism &#8211; OOD languages provide a mechanism where methods performing similar tasks but vary in arguments, can be assigned same name. This is called polymorphism, which allows a single interface performing tasks for different types. Depending upon how the function is invoked, respective portion of the code gets executed.<\/p>\n<h2>\nDATABASE DESIGN<\/h2>\n<p>\nStudent Table<\/p>\n<p>Course Table<\/p>\n<p>\nSession Table<\/p>\n<p>\nSubject Table<\/p>\n<p>\nSemester Subject Table<\/p>\n<p>\nEnrollments Table<\/p>\n<p>\nMarks Table<\/p>\n<p>\nAttendance Table<\/p>\n<p>\n<\/p>\n<h2>Software Requirements:<\/h2>\n<p>\u2981 Python : Python is an in high-level, interpreted, interactive and object-oriented programming language programming language. Python is designed to be highly readable. Python offers much more structure and support for large programs. Created by Guido van Rossum and first released in 1991. Board standard library .Python has a huge library that contains reusable code. The huge library helps the developer to develop application in less time. Python\u2019s bulk of the library is portable and cross-platform. It is compatible on UNIX, Windows, and Macintosh.<br \/>\nPython language can be used to create different types of applications: Console, Web, Desktop, Enterprise etc.<\/p>\n<p>\u2981 Tkinter: Tkinter is Python\u2019s de-facto standard GUI(Graphical User Interface) package. It is a thin object-oriented layer on top of Tcl\/Tk. Tkinter is not the only Gui Programming toolkit for Python. It is however the most commonly used one.<br \/>\n\u2981 Pyodbc: pyodbc is an open source Python module that makes accessing ODBC databases simple. It implements the \u2981 DB API 2.0 specification but is packed with even more Pythonic convenience.<\/p>\n<p>\n\u2981 IDE<br \/>\nSpyder is a powerful scientific environment written in Python, for Python. It offers a unique combination of the advanced editing, analysis, debugging, and profiling functionality of a comprehensive development tool with the data exploration, interactive execution, deep inspection, and beautiful visualization capabilities of a scientific package.<br \/>\nBeyond its many built-in features, its abilities can be extended even further via its plugin system and API. Furthermore, Spyder can also be used as a PyQt5 extension library, allowing developers to build upon its functionality and embed its components, such as the interactive console, in their own PyQt software.<\/p>\n<p>\u2981 Database<br \/>\nMicrosoft SQL Server <br \/>\nSnapshots<\/p>\n<p>Login Page<\/p>\n<p>Homepage<\/p>\n<p>\nNew Registration<\/p>\n<p>Semester Registration or Enrollment<\/p>\n<p>\nView Students<\/p>\n<p>Mark Attendance<\/p>\n<p>\nMasters \u2013 Add Course<\/p>\n<p>\nMasters \u2013 Add Subject<\/p>\n<h2>\nConclusion<\/h2>\n<p>We have proposed a application which can help the teachers to reduce their work load. If teachers are busy in dealing with records, they might not able to give time to the students. This application will automate the things which teachers had to do manually. They do not have to sit all day and deal with lot of papers, there work will be done in just few clicks.<br \/>\nOur long term goal is to add more functionality to the current application and automate more functions, so paper work will be reduced to zero and will help the teachers.<\/p>\n<h1>College Automation System Python Code<\/h1>\n<h2>1.gateway.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Treeview<br \/>\nfrom datalayer import DBSessions<br \/>\n#from RegistrationForm import RegistrationForm<br \/>\n#from ViewStudents import ViewStudents<br \/>\n#from Enrollments import Enrollments<br \/>\n#from DisplayStudentsForm import DisplayStudentForm<br \/>\n#from Attendance import Attendance<br \/>\nfrom AddSession import AddSession<br \/>\nfrom ViewSessions import ViewSessions<br \/>\nfrom AddSubject import AddSubject<br \/>\nfrom ViewSubjects import ViewSubjects<br \/>\nfrom AddCourse import AddCourse<br \/>\nfrom ViewCourses import ViewCourses<br \/>\n#from SemesterSubjects import SemesterSubjectsForm<br \/>\nfrom datalayer import DBCourse, DBStudents<br \/>\n#from ViewAttendance import ViewAttendance<br \/>\nfrom datetime import date<\/p>\n<p>class Gateway:<br \/>\ndef __init__(self,username):<br \/>\nself.root = tk.Toplevel()<\/p>\n<p>self.root.geometry(&#8220;625&#215;450&#8221;)<br \/>\nself.root.title(&#8220;CAS&#8221;)<br \/>\nself.root.resizable(&#8216;false&#8217;,&#8217;false&#8217;)<\/p>\n<p>self.Menu = tk.Menu(self.root)<\/p>\n<p>dt = date.today()<br \/>\nself.welcomeuser = tk.Label(self.root, text = &#8220;Welcome, &#8221; + username)<br \/>\nself.welcomeuser.place(x = 10 , y = 425)<br \/>\nself.datetimelabel = tk.Label(self.root, text = dt)<br \/>\nself.datetimelabel.place(x = 550, y = 425)<\/p>\n<p>studentmenu = tk.Menu(self.Menu, tearoff = 0) <br \/>\nstudentmenu.add_command(label = &#8220;New Registration&#8221;, command = self.NewRegistrationClick)<br \/>\nstudentmenu.add_command(label = &#8220;View Students&#8221;, command = self.ViewStudentsClick)<br \/>\nstudentmenu.add_separator()<br \/>\nstudentmenu.add_command(label= &#8220;Semester Registration&#8221;, command = self.SemesterRegistrationClick)<\/p>\n<p>self.Menu.add_cascade(label = &#8220;Students&#8221;, menu = studentmenu)<\/p>\n<p>marksmenu = tk.Menu(self.Menu, tearoff = 0)<br \/>\nmarksmenu.add_command(label= &#8220;Add\/View\/Update&#8221;, command = self.MarksClick)<br \/>\nself.Menu.add_cascade(label = &#8220;Marks&#8221;, menu = marksmenu)<\/p>\n<p>attendancemenu = tk.Menu(self.Menu, tearoff = 0)<br \/>\nattendancemenu.add_command(label = &#8220;Mark Attendance&#8221;, command = self.AttendanceClick)<br \/>\nattendancemenu.add_command(label = &#8220;View Attendance&#8221;, command = self.ViewAttendanceClick)<br \/>\nself.Menu.add_cascade(label = &#8220;Attendance&#8221;, menu = attendancemenu)<\/p>\n<p>master = tk.Menu(self.Menu, tearoff = 0)<\/p>\n<p>session = tk.Menu(master, tearoff = 0)<br \/>\nsession.add_command(label = &#8220;Add Session&#8221;, command = self.AddSessionClick)<br \/>\nsession.add_command(label = &#8220;View Session&#8221;, command = self.ViewSessionClick)<br \/>\nmaster.add_cascade(label = &#8220;Session&#8221;, menu = session)<\/p>\n<p>course = tk.Menu(master, tearoff = 0)<br \/>\ncourse.add_command(label = &#8220;Add Course&#8221;, command = self.AddCourseClick)<br \/>\ncourse.add_command(label = &#8220;View Course&#8221;, command = self.ViewCourseClick)<br \/>\nmaster.add_cascade(label = &#8220;Course&#8221;, menu = course)<\/p>\n<p>subject = tk.Menu(master, tearoff = 0)<br \/>\nsubject.add_command(label = &#8220;Add Subject&#8221;, command = self.AddSubjectClick)<br \/>\nsubject.add_command(label = &#8220;View Subject&#8221;, command = self.ViewSubjectClick)<br \/>\nmaster.add_cascade(label = &#8220;Subject&#8221;, menu = subject)<br \/>\nmaster.add_separator()<br \/>\nmaster.add_command(label = &#8220;Semester Subject&#8221;, command = self.SemesterSubjectClick)<br \/>\nself.Menu.add_cascade(label = &#8220;Masters Record&#8221;, menu = master)<\/p>\n<p>self.root.config(menu = self.Menu)<\/p>\n<p>\nself.Tree = Treeview(self.root)<br \/>\nself.Tree[&#8216;columns&#8217;] = [&#8216;col1&#8217;, &#8216;col2&#8217;]<br \/>\nself.Tree.place(x = 10, y = 20, height=400)<\/p>\n<p>dbsession = DBSessions()<br \/>\nallcourses = DBCourse().GetCourse()<br \/>\nobjDALStudent = DBStudents()<\/p>\n<p>sessioncounter = 1<br \/>\ncoursecounter=1<br \/>\nstudentcounter = 1<\/p>\n<p>for session in dbsession.GetSession():<br \/>\nsessionnode = self.Tree.insert(&#8220;&#8221;, sessioncounter, text=session.Session, values=(&#8220;&#8221;,&#8221;&#8221;))<\/p>\n<p>coursecounter=1<br \/>\nfor course in allcourses:<br \/>\ncoursenode = self.Tree.insert(sessionnode, coursecounter, text=course.CourseName, values=(&#8220;&#8221;,&#8221;&#8221;))<br \/>\ncoursecounter+=1<\/p>\n<p>studentcounter = 1<br \/>\nfor student in objDALStudent.ViewStudents(course.CourseId, session.SessionId):<br \/>\nself.Tree.insert(coursenode, studentcounter, text=str(studentcounter), values=(student.RollNo, student.Name))<br \/>\nstudentcounter+=1<\/p>\n<p>\nsessioncounter+=1<\/p>\n<p>def NewRegistrationClick(self):<br \/>\nobj = RegistrationForm()<br \/>\nobj.showDialog()<\/p>\n<p>def ViewStudentsClick(self):<br \/>\nobj = ViewStudents()<br \/>\nobj.showDialog()<\/p>\n<p>def SemesterRegistrationClick(self):<br \/>\nobj = Enrollments()<br \/>\nobj.showDialog()<\/p>\n<p>def MarksClick(self):<br \/>\nobj = DisplayStudentForm()<br \/>\nobj.showDialog()<\/p>\n<p>def AttendanceClick(self):<br \/>\nobj = Attendance()<br \/>\nobj.showDiaog()<\/p>\n<p>def ViewAttendanceClick(self):<br \/>\nobj = ViewAttendance()<br \/>\nobj.showDialog()<\/p>\n<p>def AddSessionClick(self):<br \/>\nobj = AddSession()<br \/>\nobj.showDialog()<\/p>\n<p>def ViewSessionClick(self):<br \/>\nobj = ViewSessions()<br \/>\nobj.showDialog()<\/p>\n<p>def AddSubjectClick(self):<br \/>\nobj = AddSubject()<br \/>\nobj.showDialog()<\/p>\n<p>def ViewSubjectClick(self):<br \/>\nobj = ViewSubjects()<br \/>\nobj.showDialog()<\/p>\n<p>def AddCourseClick(self):<br \/>\nobj = AddCourse()<br \/>\nobj.showDialog()<\/p>\n<p>def ViewCourseClick(self):<br \/>\nobj = ViewCourses()<br \/>\nobj.showDialog()<\/p>\n<p>def SemesterSubjectClick(self):<br \/>\nobj = SemesterSubjectsForm()<br \/>\nobj.showDialog()<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>2.login.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter import messagebox<br \/>\nfrom gateway import Gateway<\/p>\n<p>class Login():<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Tk()<br \/>\nself.user = tk.StringVar()<br \/>\nself.password = tk.StringVar()<br \/>\nself.count = 0<\/p>\n<p>self.show = tk.PhotoImage(file = r&#8221;C:\\Users\\daljeet\\Desktop\\Project &#8211; CAS\\TrainingProject &#8211; CAS\\Images\\show2.png&#8221;)<br \/>\nself.hide = tk.PhotoImage(file = r&#8221;C:\\Users\\daljeet\\Desktop\\Project &#8211; CAS\\TrainingProject &#8211; CAS\\Images\\hide1.png&#8221;)<\/p>\n<p>\nself.welcome = tk.Label(self.root, text = &#8220;CAS&#8221;, font=(28))<br \/>\nself.welcome.place(x = 120, y = 10)<\/p>\n<p>self.accLabel = tk.Label(self.root, text = &#8220;Enter Usename&#8221;)<br \/>\nself.accLabel.place(x = 10, y = 50)<br \/>\nself.accEntry = tk.Entry(self.root, textvariable = self.user)<br \/>\nself.accEntry.place(x = 110 , y = 50)<br \/>\nself.errorLabel1 = tk.Label(self.root, text = &#8220;&#8221; ,fg = &#8216;red&#8217;) <br \/>\nself.errorLabel1.place(x = 110, y =70)<\/p>\n<p>self.passLabel = tk.Label(self.root, text = &#8220;Enter password&#8221;)<br \/>\nself.passLabel.place(x = 10, y = 90)<br \/>\nself.passEntry = tk.Entry(self.root, textvariable = self.password , show = &#8220;*&#8221;)<br \/>\nself.passEntry.place(x = 110 , y = 90)<br \/>\nself.errorLabel2 = tk.Label(self.root, text = &#8220;&#8221; ,fg = &#8216;red&#8217;) <br \/>\nself.errorLabel2.place(x = 110, y =110)<br \/>\nself.shButton = tk.Button(self.root, image = self.show , command =self.showhidePassword)<br \/>\nself.shButton.place(x = 250 , y = 85)<\/p>\n<p>self.logButton = tk.Button(self.root, text = &#8220;LogIn&#8221; , command = self.loginClicked, width = 10)<br \/>\nself.logButton.place(x = 40, y = 140)<br \/>\nself.eButton = tk.Button(self.root, text = &#8220;Exit&#8221; , command = self.exitClicked, width = 10)<br \/>\nself.eButton.place(x = 180, y = 140)<\/p>\n<p>self.root.geometry(&#8220;295&#215;180&#8221;)<br \/>\nself.root.title(&#8220;LogIn&#8221;)<br \/>\nself.root.resizable(&#8216;false&#8217;,&#8217;false&#8217;)<\/p>\n<p>def loginClicked(self):<br \/>\ncheck = self.validate()<br \/>\nif check == True:<br \/>\nif self.user.get() == &#8216;cas&#8217; and int(self.password.get()) == 1234 :<br \/>\nobj = Gateway(self.user.get())<br \/>\nobj.showDialog()<\/p>\n<p>else:<br \/>\nmessagebox.showerror(&#8220;LogIn&#8221;, &#8220;Wrong username or password.Please Try Again&#8221;)<\/p>\n<p>def exitClicked(self):<br \/>\na = messagebox.askyesno(&#8220;LogIn&#8221;, &#8220;Do you want to exit?&#8221;)<br \/>\nif a == True:<br \/>\nself.root.destroy()<\/p>\n<p>def validate(self):<br \/>\nval = True<\/p>\n<p>self.errorLabel1.config(text = &#8220;&#8221;)<br \/>\nself.errorLabel2.config(text = &#8220;&#8221;)<\/p>\n<p>if self.password.get().isdigit() == False:<br \/>\nval = False<br \/>\nself.errorLabel2.config(text = &#8220;*Alphabets not allowed&#8221;)<\/p>\n<p>if len(self.user.get()) == 0:<br \/>\nval = False<br \/>\nself.errorLabel1.config(text = &#8220;*Field Required&#8221;)<\/p>\n<p>if len(self.password.get()) == 0:<br \/>\nval = False<br \/>\nself.errorLabel2.config(text = &#8220;*Field Required&#8221;)<\/p>\n<p>return val<\/p>\n<p>def showhidePassword(self):<br \/>\nif self.count % 2 ==0:<br \/>\nself.passEntry.config(show = &#8220;&#8221;)<br \/>\nself.shButton.config(image = self.hide)<\/p>\n<p>else:<br \/>\nself.passEntry.config(show = &#8220;*&#8221;)<br \/>\nself.shButton.config(image = self.show)<br \/>\nself.count += 1<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<p>obj = Login()<br \/>\nobj.showDialog()<\/p>\n<h2>3.login.spec<\/h2>\n<p># -*- mode: python ; coding: utf-8 -*-<\/p>\n<p>block_cipher = None<\/p>\n<p>\na = Analysis([&#8216;login.py&#8217;],<br \/>\npathex=[&#8216;D:\\\\Python\\\\TrainingProject&#8217;],<br \/>\nbinaries=[],<br \/>\ndatas=[],<br \/>\nhiddenimports=[],<br \/>\nhookspath=[],<br \/>\nruntime_hooks=[],<br \/>\nexcludes=[],<br \/>\nwin_no_prefer_redirects=False,<br \/>\nwin_private_assemblies=False,<br \/>\ncipher=block_cipher,<br \/>\nnoarchive=False)<br \/>\npyz = PYZ(a.pure, a.zipped_data,<br \/>\ncipher=block_cipher)<br \/>\nexe = EXE(pyz,<br \/>\na.scripts,<br \/>\na.binaries,<br \/>\na.zipfiles,<br \/>\na.datas,<br \/>\n[],<br \/>\nname=&#8217;login&#8217;,<br \/>\ndebug=False,<br \/>\nbootloader_ignore_signals=False,<br \/>\nstrip=False,<br \/>\nupx=True,<br \/>\nupx_exclude=[],<br \/>\nruntime_tmpdir=None,<br \/>\nconsole=True )<\/p>\n<h2>4.Enrollments.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Combobox<br \/>\nfrom tkinter import messagebox<br \/>\nfrom datalayer import DBEnrollment<br \/>\nfrom datetime import date<\/p>\n<p>class Enrollments:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;590&#215;340&#8221;)<br \/>\nself.root.title(&#8220;Enrollment&#8221;)<\/p>\n<p>self.rollno = tk.StringVar()<br \/>\nself.registrationid = tk.StringVar()<br \/>\nself.redistrationdate = tk.StringVar()<br \/>\nself.name = tk.StringVar()<br \/>\nself.dob = tk.StringVar()<br \/>\nself.gender = tk.StringVar()<br \/>\nself.contact = tk.StringVar()<br \/>\nself.father = tk.StringVar()<br \/>\nself.mother = tk.StringVar()<br \/>\nself.city = tk.StringVar()<br \/>\nself.email = tk.StringVar()<br \/>\nself.course = tk.StringVar()<br \/>\nself.session = tk.StringVar()<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Roll No.&#8221;)<br \/>\nself.lbl1.place(x = 140, y =10)<br \/>\nself.ent1 = tk.Entry(self.root, textvariable = self.rollno)<br \/>\nself.ent1.place(x = 200, y = 10)<\/p>\n<p>self.FindButton = tk.Button(self.root, text = &#8220;Find&#8221;, width = 12, command = self.FindClicked)<br \/>\nself.FindButton.place(x = 360, y = 10)<\/p>\n<p>self.MiddleFrame = tk.Frame(self.root, width = 570, height = 210)<br \/>\nself.MiddleFrame.place(x = 10, y = 60)<br \/>\nself.MiddleFrame.config(highlightbackground = &#8220;Black&#8221;, highlightcolor = &#8220;Black&#8221;, highlightthickness = 1, bd= 0)<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;RegistrationId&#8221;)<br \/>\nself.lbl2.place(x = 30 , y = 80)<br \/>\nself.ent2 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.registrationid)<br \/>\nself.ent2.place(x = 130, y = 80)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Registration Date&#8221;)<br \/>\nself.lbl3.place(x = 330, y = 80)<br \/>\nself.ent3 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.redistrationdate)<br \/>\nself.ent3.place(x = 430, y = 80)<\/p>\n<p>self.lbl4 = tk.Label(self.root, text = &#8220;Name&#8221;)<br \/>\nself.lbl4.place(x = 30, y = 110)<br \/>\nself.ent4 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.name)<br \/>\nself.ent4.place(x = 130, y = 110)<\/p>\n<p>self.lbl5 = tk.Label(self.root, text = &#8220;D.O.B&#8221;)<br \/>\nself.lbl5.place(x = 330, y = 110)<br \/>\nself.ent5 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.dob)<br \/>\nself.ent5.place(x = 430, y = 110)<\/p>\n<p>self.lbl6 = tk.Label(self.root, text = &#8220;Gender&#8221;)<br \/>\nself.lbl6.place(x = 30, y = 140)<br \/>\nself.ent6 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.gender)<br \/>\nself.ent6.place(x = 130, y = 140)<\/p>\n<p>self.lbl7 = tk.Label(self.root, text = &#8220;Contact Number&#8221;)<br \/>\nself.lbl7.place(x = 330, y = 140)<br \/>\nself.ent7 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.contact)<br \/>\nself.ent7.place(x = 430, y = 140)<\/p>\n<p>self.lbl8 = tk.Label(self.root, text = &#8220;Father Name&#8221;)<br \/>\nself.lbl8.place(x = 30, y = 170)<br \/>\nself.ent8 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.father)<br \/>\nself.ent8.place(x = 130, y = 170)<\/p>\n<p>self.lbl9 = tk.Label(self.root, text = &#8220;Mother Name&#8221;)<br \/>\nself.lbl9.place(x = 330, y = 170)<br \/>\nself.ent9 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.mother)<br \/>\nself.ent9.place(x = 430, y = 170)<\/p>\n<p>self.lbl10 = tk.Label(self.root, text = &#8220;City&#8221;)<br \/>\nself.lbl10.place(x = 30, y = 200)<br \/>\nself.ent10 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.city)<br \/>\nself.ent10.place(x = 130, y = 200)<\/p>\n<p>self.lbl11 = tk.Label(self.root, text = &#8220;E-mail&#8221;)<br \/>\nself.lbl11.place(x = 330, y = 200)<br \/>\nself.ent11 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.email)<br \/>\nself.ent11.place(x = 430, y = 200)<\/p>\n<p>self.lbl12 = tk.Label(self.root, text = &#8220;Course&#8221;)<br \/>\nself.lbl12.place(x = 30, y = 230)<br \/>\nself.ent12 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.course)<br \/>\nself.ent12.place(x = 130, y = 230)<\/p>\n<p>self.lbl13 = tk.Label(self.root, text = &#8220;Session&#8221;)<br \/>\nself.lbl13.place(x = 330, y = 230)<br \/>\nself.ent13 = tk.Entry(self.root, state = &#8220;readonly&#8221;, textvariable = self.session)<br \/>\nself.ent13.place(x = 430, y = 230)<\/p>\n<p>self.lbl14 = tk.Label(self.root, text = &#8220;Semester&#8221;)<br \/>\nself.lbl14.place(x = 140, y = 300)<br \/>\nself.cmb1 = Combobox(self.root)<br \/>\nself.cmb1.place(x = 200, y = 300)<br \/>\nself.cmb1[&#8216;values&#8217;] = [&#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;,&#8217;4&#8242;,&#8217;5&#8242;,&#8217;6&#8242;,&#8217;7&#8242;,&#8217;8&#8242;]<\/p>\n<p>self.RegisterButton = tk.Button(self.root, text = &#8220;Register&#8221;, width = 12, command = self.RegisterClicked)<br \/>\nself.RegisterButton.place(x = 360, y = 300)<\/p>\n<p>def FindClicked(self):<br \/>\nroll = int(self.rollno.get())<br \/>\ndb = DBEnrollment()<br \/>\nAllData = db.FindRoll(roll)<\/p>\n<p>for data in AllData:<br \/>\nself.registrationid.set(data.RegistrationId)<br \/>\nself.redistrationdate.set(data.RegistrationDate)<br \/>\nself.name.set(data.Name)<br \/>\nself.dob.set(data.Dob)<br \/>\nself.gender.set(data.Gender)<br \/>\nself.contact.set(data.ContactNo)<br \/>\nself.father.set(data.FatherName)<br \/>\nself.mother.set(data.MotherName)<br \/>\nself.city.set(data.City)<br \/>\nself.email.set(data.EmailId)<br \/>\nself.course.set(data.CourseId)<br \/>\nself.session.set(data.SessionID)<\/p>\n<p>def RegisterClicked(self):<br \/>\nsem = self.cmb1.get()<br \/>\nrid = int(self.registrationid.get())<br \/>\ntoday = str(date.today())<br \/>\ndb = DBEnrollment()<br \/>\ndb.Register(today,sem,rid)<\/p>\n<p>messagebox.showinfo(&#8220;Enrollment&#8221;, &#8220;Student was enrolled successfully.&#8221;)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>5.MarksForm.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom datalayer import DBMarks<br \/>\nfrom tkinter import messagebox<\/p>\n<p>\nclass MarksForm:<br \/>\ndef __init__(self,regid,sessid,cid,sem,name):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;475&#215;400&#8221;)<br \/>\nself.root.title(&#8220;Add Marks&#8221;)<br \/>\nself.Date = tk.StringVar()<\/p>\n<p>self.regID = regid<br \/>\nself.y = 130<br \/>\nself.reg = tk.StringVar()<br \/>\nself.nam = tk.StringVar()<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;RegistrationId&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 40)<br \/>\nself.ent1 = tk.Entry(self.root, textvariable = self.reg, state = &#8220;readonly&#8221;, width = 10)<br \/>\nself.ent1.place(x = 110, y = 40)<br \/>\nself.reg.set(self.regID)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Name&#8221;)<br \/>\nself.lbl3.place(x = 240 , y = 40)<br \/>\nself.ent2 = tk.Entry(self.root, textvariable = self.nam, state = &#8220;readonly&#8221;, width = 20)<br \/>\nself.ent2.place(x = 370, y = 40)<br \/>\nself.nam.set(name)<\/p>\n<p>self.lbl5 = tk.Label(self.root, text = &#8220;Subject&#8221;)<br \/>\nself.lbl5.place(x = 110 , y =100)<br \/>\nself.lbl6 = tk.Label(self.root, text = &#8220;Marks&#8221;)<br \/>\nself.lbl6.place(x = 200 , y = 100)<\/p>\n<p>db = DBMarks()<br \/>\nself.AllSubjects = db.GetSubjects(sessid,cid,sem)<br \/>\nself.MarksList = []<\/p>\n<p>for a in self.AllSubjects:<br \/>\nlistvar = tk.StringVar()<br \/>\nself.MarksList.append((listvar,a.SemesterSubjectId))<br \/>\nlbl = tk.Label(self.root, text = a.Subject)<br \/>\nlbl.place(x = 110, y = self.y)<br \/>\nent = tk.Entry(self.root, textvariable = listvar)<br \/>\nent.place(x = 200, y = self.y)<br \/>\nself.y += 40<\/p>\n<p>self.AddButton = tk.Button(self.root, text = &#8220;Add&#8221;, command = self.AddMarks, width = 12)<br \/>\nself.AddButton.place(x = 150, y = self.y + 20)<\/p>\n<p>def AddMarks(self):<br \/>\ndb = DBMarks()<br \/>\nfor marks in self.MarksList:<br \/>\nssid = marks[1]<br \/>\nrid = self.regID<br \/>\nmarks = marks[0].get()<br \/>\ndate = self.Date.get()<br \/>\nmessagebox.showinfo(&#8220;Add Marks&#8221;, &#8220;Marks was added successfully.&#8221;)<\/p>\n<p>\ndb.AddMarks(ssid,rid,marks,date)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>6.RegistrationForm.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter import messagebox<br \/>\nfrom tkinter.ttk import Combobox<br \/>\nfrom components import Student,Course, Session<br \/>\nfrom datalayer import DBStudents, DBCourse, DBSessions<\/p>\n<p>class RegistrationForm:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;650&#215;390&#8221;)<br \/>\nself.root.title(&#8220;Registration&#8221;)<\/p>\n<p>self.CourseId = 0<br \/>\nself.SessionID = 0<br \/>\nself.RegistrationDate = tk.StringVar()<br \/>\nself.RollNo = tk.StringVar()<br \/>\nself.Name = tk.StringVar()<br \/>\nself.Dob = tk.StringVar()<br \/>\nself.Gender = tk.StringVar()<br \/>\nself.FatherName = tk.StringVar()<br \/>\nself.MotherName = tk.StringVar()<br \/>\nself.Address = tk.StringVar()<br \/>\nself.City = tk.StringVar()<br \/>\nself.Nationality = tk.StringVar()<br \/>\nself.ContactNo = tk.StringVar()<br \/>\nself.EmailId = tk.StringVar()<\/p>\n<p>\nself.lbl1 = tk.Label(self.root, text = &#8220;Course&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 10)<\/p>\n<p>self.cmb1 = Combobox(self.root, state = &#8220;readonly&#8221;, width = 20)<br \/>\nself.cmb1.place(x = 110, y = 10)<\/p>\n<p>\ndbcourse = DBCourse()<br \/>\nself.AllCourses = dbcourse.GetCourse()<\/p>\n<p>courseslist = []<br \/>\nfor c in self.AllCourses:<br \/>\ncourseslist.append(c.CourseName)<\/p>\n<p>self.cmb1[&#8216;values&#8217;] = courseslist<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;Session&#8221;)<br \/>\nself.lbl2.place(x = 350 , y = 10)<\/p>\n<p>self.cmb2 = Combobox(self.root, state = &#8220;readonly&#8221;, width = 20)<br \/>\nself.cmb2.place(x = 460, y = 10)<\/p>\n<p>\ndbsession = DBSessions()<br \/>\nself.AllSessions = dbsession.GetSession()<\/p>\n<p>sessionlist = []<\/p>\n<p>for s in self.AllSessions:<br \/>\nsessionlist.append(s.Session)<\/p>\n<p>self.cmb2[&#8216;values&#8217;] = sessionlist<\/p>\n<p>\nself.lbl13 = tk.Label(self.root, text = &#8220;Registration Date&#8221;)<br \/>\nself.lbl13.place(x = 10 , y = 70)<br \/>\nself.ent13 = tk.Entry(self.root , textvariable = self.RegistrationDate, width = 25)<br \/>\nself.ent13.place(x = 110, y = 70)<\/p>\n<p>self.lbl14 = tk.Label(self.root, text = &#8220;Name&#8221;)<br \/>\nself.lbl14.place(x = 350 , y = 70)<br \/>\nself.ent14 = tk.Entry(self.root, textvariable = self.Name, width = 25)<br \/>\nself.ent14.place(x = 460, y = 70)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Roll Number&#8221;)<br \/>\nself.lbl3.place(x = 10 , y = 110)<br \/>\nself.ent3 = tk.Entry(self.root, textvariable = self.RollNo, width = 25)<br \/>\nself.ent3.place(x = 110, y = 110)<\/p>\n<p>self.lbl4 = tk.Label(self.root, text = &#8220;D.O.B&#8221;)<br \/>\nself.lbl4.place(x = 350 , y = 110)<br \/>\nself.ent4 = tk.Entry(self.root, textvariable = self.Dob, width = 25)<br \/>\nself.ent4.place(x = 460, y = 110)<\/p>\n<p>self.lbl5 = tk.Label(self.root, text = &#8220;Gender&#8221;)<br \/>\nself.lbl5.place(x = 10, y = 150)<br \/>\nself.rbn1 = tk.Radiobutton(self.root, text = &#8220;Male&#8221;, variable = self.Gender, value = &#8220;Male&#8221;)<br \/>\nself.rbn1.place(x = 110, y = 150)<br \/>\nself.rbn2 = tk.Radiobutton(self.root, text = &#8220;Female&#8221;, variable = self.Gender, value = &#8220;Female&#8221;)<br \/>\nself.rbn2.place(x = 210, y = 150)<br \/>\nself.rbn3 = tk.Radiobutton(self.root, text = &#8220;Others&#8221;, variable = self.Gender, value = &#8220;Others&#8221;)<br \/>\nself.rbn3.place(x = 310, y = 150)<\/p>\n<p>self.lbl6 = tk.Label(self.root, text = &#8220;Father Name&#8221;)<br \/>\nself.lbl6.place(x = 10 , y = 190)<br \/>\nself.ent6 = tk.Entry(self.root, textvariable = self.FatherName, width = 25)<br \/>\nself.ent6.place(x = 110, y = 190)<\/p>\n<p>self.lbl7 = tk.Label(self.root, text = &#8220;Mother Name&#8221;)<br \/>\nself.lbl7.place(x = 350 , y = 190)<br \/>\nself.ent7 = tk.Entry(self.root, textvariable = self.MotherName, width = 25)<br \/>\nself.ent7.place(x = 460, y = 190)<\/p>\n<p>self.lbl8 = tk.Label(self.root, text = &#8220;Address&#8221;)<br \/>\nself.lbl8.place(x = 10 , y = 230)<br \/>\nself.ent8 = tk.Entry(self.root, textvariable = self.Address, width = 25)<br \/>\nself.ent8.place(x = 110, y = 230)<\/p>\n<p>self.lbl9 = tk.Label(self.root, text = &#8220;City&#8221;)<br \/>\nself.lbl9.place(x = 350 , y = 230)<br \/>\nself.ent9 = tk.Entry(self.root, textvariable = self.City, width = 25)<br \/>\nself.ent9.place(x = 460, y = 230)<\/p>\n<p>self.lbl10 = tk.Label(self.root, text = &#8220;Nationality&#8221;)<br \/>\nself.lbl10.place(x = 10 , y = 270)<br \/>\nself.ent10 = tk.Entry(self.root, textvariable = self.Nationality, width = 25)<br \/>\nself.ent10.place(x = 110, y = 270)<\/p>\n<p>self.lbl11 = tk.Label(self.root, text = &#8220;Contact Number&#8221;)<br \/>\nself.lbl11.place(x = 350 , y = 270)<br \/>\nself.ent11 = tk.Entry(self.root, textvariable = self.ContactNo, width = 25)<br \/>\nself.ent11.place(x = 460, y = 270)<\/p>\n<p>self.lbl12 = tk.Label(self.root, text = &#8220;Email Id&#8221;)<br \/>\nself.lbl12.place(x = 10 , y = 310)<br \/>\nself.ent12 = tk.Entry(self.root, textvariable = self.EmailId, width = 25)<br \/>\nself.ent12.place(x = 110, y = 310)<\/p>\n<p>self.btn = tk.Button(self.root, text = &#8220;Submit&#8221;, width = 20, command = self.SubmitClicked)<br \/>\nself.btn.place(x = 250 , y = 350)<\/p>\n<p>\ndef SubmitClicked(self):<\/p>\n<p>comp = Student()<br \/>\ncomp.CourseId = self.AllCourses[self.cmb1.current()].CourseId<br \/>\ncomp.SessionID = self.AllSessions[self.cmb2.current()].SessionId<br \/>\ncomp.RegistrationDate = self.RegistrationDate.get()<br \/>\ncomp.RollNo = self.RollNo.get()<br \/>\ncomp.Name = self.Name.get()<br \/>\ncomp.Dob = self.Dob.get()<br \/>\ncomp.Gender = self.Gender.get()<br \/>\ncomp.FatherName = self.FatherName.get()<br \/>\ncomp.MotherName = self.MotherName.get()<br \/>\ncomp.Address = self.Address.get()<br \/>\ncomp.City = self.City.get()<br \/>\ncomp.Nationality = self.Nationality.get()<br \/>\ncomp.ContactNo = self.ContactNo.get()<br \/>\ncomp.EmailId = self.EmailId.get()<br \/>\ndb = DBStudents()<br \/>\ndb.AddStudent(comp)<br \/>\nmessagebox.showinfo(&#8220;Registration&#8221;, &#8220;Registration successful.&#8221;)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>7.SemesterSubjects.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Combobox, Treeview<br \/>\nfrom datalayer import DBSessions, DBCourse, DBSubjects, DBSemesterSubjects<br \/>\nfrom components import SemesterSubjects<\/p>\n<p>class SemesterSubjectsForm:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;625&#215;330&#8221;)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Session&#8221;)<br \/>\nself.lbl1.place(x = 10 , y =10)<br \/>\nself.cmb1 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb1.place(x = 70, y = 10)<br \/>\ndbsessions = DBSessions()<br \/>\nself.AllSessions = dbsessions.GetSession()<br \/>\nSessionList = []<br \/>\nfor sess in self.AllSessions:<br \/>\nSessionList.append(sess.Session)<br \/>\nself.cmb1[&#8216;values&#8217;] = SessionList<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;Semester&#8221;)<br \/>\nself.lbl2.place(x = 270 , y =10)<br \/>\nself.cmb2 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb2.place(x = 330, y = 10)<br \/>\nself.cmb2[&#8216;values&#8217;] = [&#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;]<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Course&#8221;)<br \/>\nself.lbl3.place(x = 10 , y =40)<br \/>\nself.cmb3 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb3.place(x = 70, y = 40)<br \/>\ndbcourses = DBCourse()<br \/>\nself.AllCourses = dbcourses.GetCourse()<br \/>\nCourseList = []<br \/>\nfor cour in self.AllCourses:<br \/>\nCourseList.append(cour.CourseName)<br \/>\nself.cmb3[&#8216;values&#8217;] = CourseList<\/p>\n<p>self.lbl4 = tk.Label(self.root, text = &#8220;Subject&#8221;)<br \/>\nself.lbl4.place(x = 270 , y =40)<br \/>\nself.cmb4 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb4.place(x = 330, y = 40)<br \/>\ndbsubjects = DBSubjects()<br \/>\nself.AllSubjects = dbsubjects.GetSubjects()<br \/>\nSubjectList = [] <br \/>\nfor sub in self.AllSubjects:<br \/>\nSubjectList.append(sub.Subject)<br \/>\nself.cmb4[&#8216;values&#8217;] = SubjectList<\/p>\n<p>self.AddButton = tk.Button(self.root, text = &#8220;Show&#8221; , width = 12, command = self.ShowClicked)<br \/>\nself.AddButton.place(x = 520, y = 10)<\/p>\n<p>self.AddButton = tk.Button(self.root, text = &#8220;Add&#8221; , width = 12, command = self.AddClicked)<br \/>\nself.AddButton.place(x = 520, y = 40)<\/p>\n<p>self.Tree = Treeview(self.root)<br \/>\nself.Tree.place(x = 10, y = 90)<br \/>\nself.Tree[&#8216;columns&#8217;] = [&#8216;c1&#8242;,&#8217;c2&#8217;]<br \/>\nself.Tree.heading(&#8220;#0&#8221;, text = &#8220;SemesterSubjectId&#8221;)<br \/>\nself.Tree.heading(&#8220;c1&#8221;,text = &#8220;Semester&#8221;)<br \/>\nself.Tree.heading(&#8220;c2&#8221;,text = &#8220;Subject&#8221;)<\/p>\n<p>def ShowClicked(self):<br \/>\nself.Tree.delete(*self.Tree.get_children())<br \/>\nsessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb3.current()].CourseId<br \/>\nsubid = self.AllSubjects[self.cmb4.current()].SubjectId<br \/>\nss = SemesterSubjects()<br \/>\nss.SessionId = sessid<br \/>\nss.CourseId = cid<br \/>\nss.SubjectId = subid<br \/>\nss.Semester = self.cmb2.get()<\/p>\n<p>db = DBSemesterSubjects()<br \/>\nAllSemesterSubjects = db.Getdata(ss)<\/p>\n<p>i = 0<br \/>\nfor allss in AllSemesterSubjects:<br \/>\nself.Tree.insert(&#8220;&#8221;,i,text = allss.SemesterSubjectId, values = (allss.Semester, allss.SubjectId))<br \/>\ni += 1<\/p>\n<p>def AddClicked(self):<br \/>\nsessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb3.current()].CourseId<br \/>\nsubid = self.AllSubjects[self.cmb4.current()].SubjectId<br \/>\nss = SemesterSubjects()<br \/>\nss.SessionId = sessid<br \/>\nss.CourseId = cid<br \/>\nss.SubjectId = subid<br \/>\nss.Semester = self.cmb2.get()<\/p>\n<p>db = DBSemesterSubjects()<br \/>\ndb.StoreValues(ss)<\/p>\n<p>self.Tree.delete(*self.Tree.get_children())<br \/>\nAllSemesterSubjects = db.Getdata(ss)<\/p>\n<p>i = 0<br \/>\nfor allss in AllSemesterSubjects:<br \/>\nself.Tree.insert(&#8220;&#8221;, i, text = allss.SemesterSubjectId, values = (allss.Semester, allss.SubjectId))<br \/>\ni += 1<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>8.UpdateMarksForms.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom datalayer import DBMarks<br \/>\nfrom tkinter import messagebox<\/p>\n<p>class UpdateMarksForm:<br \/>\ndef __init__(self,regid,sessid,cid,sem,name, Marks):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;455&#215;400&#8221;)<br \/>\nself.root.title(&#8220;Add Marks&#8221;)<\/p>\n<p>self.regID = regid<br \/>\nself.y = 130<br \/>\nself.reg = tk.StringVar()<br \/>\nself.nam = tk.StringVar()<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;RegistrationId&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 40)<br \/>\nself.ent1 = tk.Entry(self.root, textvariable = self.reg, state = &#8220;readonly&#8221;, width = 10)<br \/>\nself.ent1.place(x = 110, y = 40)<br \/>\nself.reg.set(self.regID)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Name&#8221;)<br \/>\nself.lbl3.place(x = 270 , y = 40)<br \/>\nself.ent2 = tk.Entry(self.root, textvariable = self.nam, state = &#8220;readonly&#8221;, width = 10)<br \/>\nself.ent2.place(x = 370, y = 40)<br \/>\nself.nam.set(name)<\/p>\n<p>self.lbl5 = tk.Label(self.root, text = &#8220;Subject&#8221;)<br \/>\nself.lbl5.place(x = 110 , y =100)<br \/>\nself.lbl6 = tk.Label(self.root, text = &#8220;Marks&#8221;)<br \/>\nself.lbl6.place(x = 200 , y = 100)<\/p>\n<p>dbsubjects = DBMarks()<br \/>\nself.AllSubjects = dbsubjects.GetSubjects(sessid,cid,sem)<br \/>\nself.MarksList = []<\/p>\n<p>for a,m in zip(self.AllSubjects,Marks):<br \/>\nlistvar = tk.StringVar()<br \/>\nself.MarksList.append((listvar,a.SemesterSubjectId))<br \/>\nlbl = tk.Label(self.root, text = a.Subject)<br \/>\nlbl.place(x = 110, y = self.y)<br \/>\nent = tk.Entry(self.root, textvariable = listvar)<br \/>\nent.place(x = 200, y = self.y)<br \/>\nself.y += 40<br \/>\nlistvar.set(m)<\/p>\n<p>self.AddButton = tk.Button(self.root, text = &#8220;Update&#8221;, command = self.UpdateMarks, width = 12)<br \/>\nself.AddButton.place(x = 150, y = self.y + 20)<\/p>\n<p>def UpdateMarks(self):<br \/>\ndb = DBMarks()<br \/>\nfor marks in self.MarksList:<br \/>\nmarks = marks[0].get()<br \/>\nssid = marks[1]<br \/>\nregid = self.regID<br \/>\nmessagebox.showinfo(&#8221; UpdateMarks&#8221;, &#8220;Marks was Updated successfully.&#8221;)<\/p>\n<p>\ndb.UpdateMarks(marks, regid, ssid)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>9.DisplayStudentsForm.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Combobox, Treeview<br \/>\nfrom datalayer import DBSessions, DBCourse, DBStudents, DBMarks<br \/>\nfrom MarksForm import MarksForm<br \/>\nfrom UpdateMarksForms import UpdateMarksForm<br \/>\nfrom ViewMarksForm import ViewMarksForm<\/p>\n<p>class DisplayStudentForm:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;855&#215;350&#8221;)<br \/>\nself.root.title(&#8220;Marks&#8221;)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Session&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 10)<br \/>\nself.cmb1 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb1.place(x = 70, y = 10)<br \/>\ndbsessions = DBSessions()<br \/>\nself.AllSessions = dbsessions.GetSession()<br \/>\nSessionList = []<br \/>\nfor sess in self.AllSessions:<br \/>\nSessionList.append(sess.Session)<br \/>\nself.cmb1[&#8216;values&#8217;] = SessionList<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;Course&#8221;)<br \/>\nself.lbl2.place(x = 250 , y =10)<br \/>\nself.cmb2 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb2.place(x = 310, y = 10)<br \/>\ndbcourses = DBCourse()<br \/>\nself.AllCourses = dbcourses.GetCourse()<br \/>\nCourseList = []<br \/>\nfor cour in self.AllCourses:<br \/>\nCourseList.append(cour.CourseName)<br \/>\nself.cmb2[&#8216;values&#8217;] = CourseList<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Semester&#8221;)<br \/>\nself.lbl3.place(x = 490 , y =10)<br \/>\nself.cmb3 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb3.place(x = 560, y = 10)<br \/>\nself.cmb3[&#8216;values&#8217;] = [&#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;]<\/p>\n<p>self.ShowButton = tk.Button(self.root, text = &#8220;Show&#8221;, command = self.ShowClicked, width = 12)<br \/>\nself.ShowButton.place(x = 750, y = 10)<\/p>\n<p>self.Tree = Treeview(self.root)<br \/>\nself.Tree.place(x = 10, y = 70)<br \/>\nself.Tree[&#8216;columns&#8217;] = [&#8216;c1&#8242;,&#8217;c2&#8242;,&#8217;c3&#8242;,&#8217;c4&#8242;,&#8217;c5&#8217;]<br \/>\nself.Tree.heading(&#8220;#0&#8221;, text = &#8220;RegId&#8221;)<br \/>\nself.Tree.heading(&#8220;c1&#8221;,text = &#8220;Name&#8221;)<br \/>\nself.Tree.heading(&#8220;c2&#8221;,text = &#8220;Roll No.&#8221;)<br \/>\nself.Tree.heading(&#8220;c3&#8221;,text = &#8220;DOB&#8221;)<br \/>\nself.Tree.heading(&#8220;c4&#8221;,text = &#8220;Gender&#8221;)<br \/>\nself.Tree.heading(&#8220;c5&#8221;,text = &#8220;Contact No.&#8221;)<\/p>\n<p>self.Tree.column(&#8220;#0&#8221;, width = 50)<br \/>\nself.Tree.column(&#8220;c2&#8221;, width = 130)<br \/>\nself.Tree.column(&#8220;c3&#8221;, width = 130)<br \/>\nself.Tree.column(&#8220;c4&#8221;, width = 120)<\/p>\n<p>self.MarksButton = tk.Button(self.root, text = &#8220;Marks&#8221;, command = self.MarksClicked, width = 12)<br \/>\nself.MarksButton.place(x = 300, y = 310)<\/p>\n<p>self.ViewMarksButton = tk.Button(self.root, text = &#8220;View Marks&#8221;, command = self.ViewMarksClicked, width = 12)<br \/>\nself.ViewMarksButton.place(x = 460, y = 310)<\/p>\n<p>def ShowClicked(self):<br \/>\nsessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb2.current()].CourseId<br \/>\nsem = self.cmb3.get()<\/p>\n<p>db = DBStudents()<br \/>\nAllDetails = db.FindStudent(sessid,cid,sem)<\/p>\n<p>i = 0<br \/>\nfor ad in AllDetails:<br \/>\nself.Tree.insert(&#8220;&#8221;,i,text = ad.RegistrationId, values = (ad.Name, ad.RollNo, ad.Dob, ad.Gender, ad.ContactNo))<br \/>\ni += 1<\/p>\n<p>def MarksClicked(self):<br \/>\nkey = self.Tree.focus()<br \/>\nregid =self.Tree.item(key,&#8221;text&#8221;)<br \/>\nname =self.Tree.item(key,&#8221;values&#8221;)<\/p>\n<p>sessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb2.current()].CourseId<br \/>\nsem = self.cmb3.get()<\/p>\n<p>db = DBMarks()<br \/>\nMarksList = db.CheckMarks(regid,sem)<\/p>\n<p>if MarksList != []:<br \/>\nobj = UpdateMarksForm(regid,sessid,cid,sem,name, MarksList)<br \/>\nobj.showDialog()<\/p>\n<p>else:<br \/>\nobj = MarksForm(regid,sessid,cid,sem,name)<br \/>\nobj.showDialog()<\/p>\n<p>def ViewMarksClicked(self):<br \/>\nkey = self.Tree.focus()<br \/>\nregid =self.Tree.item(key,&#8221;text&#8221;)<br \/>\nname = self.Tree.item(key,&#8221;values&#8221;)<\/p>\n<p>sessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb2.current()].CourseId<br \/>\nsem = self.cmb3.get()<\/p>\n<p>db = DBMarks()<br \/>\nMarksList = db.CheckMarks(regid,sem)<\/p>\n<p>obj = ViewMarksForm(sem,regid,name,sessid,cid,MarksList)<br \/>\nobj.showDialog()<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>10.datalayer.py<\/h2>\n<p>import pyodbc<br \/>\nfrom abc import ABC<br \/>\nfrom components import Course, Session, Subject, Student, SemesterSubjects, SubjectNames,AttendanceRecord<\/p>\n<p>class DBOperations(ABC):<br \/>\ndef __init__(self):<br \/>\nself.con = pyodbc.connect(&#8220;DRIVER={SQL SERVER};SERVER=DESKTOP-4GE4N50\\DALJEETSERVER;database=myproject;username=sa;pwd=1@Daljeet&#8221;)<\/p>\n<p>class DBCourse(DBOperations):<br \/>\ndef __init__(self): <br \/>\nDBOperations.__init__(self)<\/p>\n<p>def AddCourse(self, c):<\/p>\n<p>cur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Courses values (?,?)&#8221;<br \/>\nrow = (c.CourseName, c.Description)<\/p>\n<p>cur.execute(query, row)<br \/>\nself.con.commit()<\/p>\n<p>def GetCourse(self):<br \/>\ncur = self.con.cursor()<br \/>\ncur.execute(&#8220;Select * from Courses&#8221;)<\/p>\n<p>records = cur.fetchall()<br \/>\nAllCourses = []<\/p>\n<p>for record in records:<br \/>\npro = Course()<br \/>\npro.CourseId = record[0]<br \/>\npro.CourseName = record[1]<br \/>\npro.Description = record[2]<\/p>\n<p>AllCourses.append(pro)<\/p>\n<p>return AllCourses<\/p>\n<p>def DeleteCourse(self, c):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Delete from Courses where CourseId = ?&#8221;<br \/>\nrow = (c.CourseId)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>class DBSessions(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def AddSession(self, ses):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Sessions values(?)&#8221;<br \/>\nrow = (ses.Session)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>def GetSession(self):<br \/>\ncur = self.con.cursor()<br \/>\ncur.execute(&#8220;Select * from Sessions&#8221;)<\/p>\n<p>records = cur.fetchall()<br \/>\nAllSessions = []<\/p>\n<p>for record in records:<br \/>\npro = Session()<br \/>\npro.SessionId = record[0]<br \/>\npro.Session = record[1]<\/p>\n<p>AllSessions.append(pro)<\/p>\n<p>return AllSessions<\/p>\n<p>def DeleteSessions(self, c):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Delete from Sessions where SessionId = ?&#8221;<br \/>\nrow = (c.SessionId)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>\nclass DBSubjects(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def AddSubject(self, sub):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Subjects values(?,?)&#8221;<br \/>\nrow = (sub.Subject, sub.Description)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>def GetSubjects(self):<br \/>\ncur = self.con.cursor()<br \/>\ncur.execute(&#8220;Select * from Subjects&#8221;)<\/p>\n<p>records = cur.fetchall()<br \/>\nAllSubjects = []<\/p>\n<p>for record in records:<br \/>\npro = Subject()<br \/>\npro.SubjectId = record[0]<br \/>\npro.Subject = record[1]<br \/>\npro.Description = record[2]<\/p>\n<p>AllSubjects.append(pro)<\/p>\n<p>return AllSubjects<\/p>\n<p>def DeleteSubjects(self, c):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Delete from Subjects where SubjectId = ?&#8221;<br \/>\nrow = (c.SubjectId)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>class DBStudents(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>\ndef AddStudent(self, stud):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Students values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)&#8221;<br \/>\n#row =(stud.RollNo, stud.RegistrationDate, stud.Name, stud.Dob, stud.Gender, stud.FatherName, stud.MotherName, stud.Address, stud.City, stud.ContactNo, stud.EmailId, stud.Nationality, stud.CourseId, stud.SessionID)<br \/>\nrow=(stud.RollNo, stud.RegistrationDate,stud.Name,stud.Dob, stud.Gender,stud.FatherName,stud.MotherName,stud.Address, stud.City, stud.ContactNo,stud.EmailId,stud.Nationality,stud.CourseId,stud.SessionID)<br \/>\ncur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>def ViewStudents(self, cid , sid):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query=&#8221;Select RegistrationId,Name,RollNo,RegistrationDate,Dob,ContactNo from Students where CourseId = ? and SessionId = ?&#8221;<br \/>\nrow = (cid,sid)<\/p>\n<p>cur.execute(query, row)<br \/>\nrecords = cur.fetchall()<br \/>\nStudentDetailsList = []<\/p>\n<p>for record in records:<br \/>\ncomp = Student()<br \/>\ncomp.RegistrationId = record[0]<br \/>\ncomp.Name = record[1]<br \/>\ncomp.RollNo = record[2]<br \/>\ncomp.RegistrationDate = record[3]<br \/>\ncomp.Dob = record[4]<br \/>\ncomp.ContactNo = record[5]<\/p>\n<p>StudentDetailsList.append(comp)<\/p>\n<p>return StudentDetailsList<\/p>\n<p>def FindStudent(self,sessid,cid,sem):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;select * from students where CourseId=? and SessionId=? and RegistrationId IN (Select RegistrationId From Enrollments Where Semester=? and IsCurrent=1)&#8221;<br \/>\nrow = (cid,sessid,sem)<\/p>\n<p>cur.execute(query,row)<br \/>\nrecords = cur.fetchall()<\/p>\n<p>AllDetails = []<\/p>\n<p>for record in records:<br \/>\nst = Student()<br \/>\nst.RegistrationId = record[0]<br \/>\nst.RollNo = record[1]<br \/>\nst.RegistrationDate = record[2]<br \/>\nst.Name = record[3]<br \/>\nst.Dob = record[4]<br \/>\nst.Gender = record[5]<br \/>\nst.FatherName = record[6]<br \/>\nst.MotherName = record[7]<br \/>\nst.Address = record[8]<br \/>\nst.City = record[9]<br \/>\nst.ContactNo = record[10]<br \/>\nst.EmailId = record[11]<br \/>\nst.Nationality = record[12]<br \/>\nst.CourseId = record[13]<br \/>\nst.SessionID = record[14]<\/p>\n<p>AllDetails.append(st)<\/p>\n<p>return AllDetails<\/p>\n<p>\nclass DBSemesterSubjects(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def StoreValues(self, val):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into SemesterSubjects values (?,?,?,?)&#8221;<br \/>\nrow = (val.Semester, val.CourseId, val.SubjectId, val.SessionId)<\/p>\n<p>cur.execute(query,row) <br \/>\nself.con.commit()<\/p>\n<p>def Getdata(self, val):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Select ss.SemesterSubjectId, ss.Semester, sub.Subject from SemesterSubjects as ss,Sessions as sess, Courses as c,Subjects as sub where ss.CourseId = c.CourseId and ss.SubjectId = sub.SubjectId and ss.SessionId = sess.SessionId and ss.CourseId = ? and ss.SessionId = ? and ss.Semester = ?&#8221;<br \/>\nrow = (val.CourseId, val.SessionId , val.Semester)<\/p>\n<p>cur.execute(query, row)<\/p>\n<p>records = cur.fetchall()<br \/>\nSemesterSubjectsList = []<\/p>\n<p>for record in records:<br \/>\nss = SemesterSubjects()<br \/>\nss.SemesterSubjectId = record[0]<br \/>\nss.Semester = record[1]<br \/>\nss.SubjectId = record[2]<\/p>\n<p>SemesterSubjectsList.append(ss)<br \/>\nreturn SemesterSubjectsList<\/p>\n<p>class DBEnrollment(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def FindRoll(self, roll):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Select RegistrationId,RollNo,RegistrationDate,Name,Dob,Gender,FatherName,MotherName,Address,City,ContactNo,EmailId,Nationality,c.courseName, s.session from Students as st ,Courses as c ,Sessions as s where st.CourseId = c.CourseId and st.SessionId = s.SessionId and RollNo = ?&#8221;<br \/>\nrow = roll<\/p>\n<p>cur.execute(query, row)<br \/>\nrecords = cur.fetchall()<br \/>\nAllData = []<\/p>\n<p>for record in records:<br \/>\nst = Student()<br \/>\nst.RegistrationId = record[0]<br \/>\nst.RollNo = record[1]<br \/>\nst.RegistrationDate = record[2]<br \/>\nst.Name = record[3]<br \/>\nst.Dob = record[4]<br \/>\nst.Gender = record[5]<br \/>\nst.FatherName = record[6]<br \/>\nst.MotherName = record[7]<br \/>\nst.Address = record[8]<br \/>\nst.City = record[9]<br \/>\nst.ContactNo = record[10]<br \/>\nst.EmailId = record[11]<br \/>\nst.Nationality = record[12]<br \/>\nst.CourseId = record[13]<br \/>\nst.SessionID = record[14]<\/p>\n<p>AllData.append(st)<br \/>\nreturn AllData<\/p>\n<p>def Register(self,date,sem,rid):<br \/>\ncur = self.con.cursor()<\/p>\n<p>cur.execute(&#8220;Update Enrollments set IsCurrent=0 where RegistrationId=?&#8221;,(rid))<\/p>\n<p>cur.execute(&#8220;Insert into Enrollments values(?,?,?,?)&#8221;,(date,sem,rid,1))<br \/>\nself.con.commit()<\/p>\n<p>class DBMarks(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def CheckMarks(self,rid,sem):<br \/>\ncur = self.con.cursor()<\/p>\n<p>cur.execute(&#8220;select Marks from Marks as [M] , SemesterSubjects[SS] where M.SemesterSubjectId = SS.SemesterSubjectId and RegistrationId = ? and SS.Semester = ?&#8221;,(rid,sem))<br \/>\ndbMarks = cur.fetchall()<br \/>\nMarksList = []<br \/>\nfor marks in dbMarks:<br \/>\nMarksList.append(marks[0])<\/p>\n<p>return MarksList<\/p>\n<p>def GetSubjects(self, sessid,cid,sem):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Select SS.SemesterSubjectId, S.Subject From SemesterSubjects as [SS], Subjects as [S] Where SS.SubjectId=S.SubjectId and SS.SessionId = ? and SS.CourseId = ? and SS.Semester = ?&#8221;<br \/>\nrow = (sessid,cid,sem)<\/p>\n<p>cur.execute(query, row)<br \/>\nrecords = cur.fetchall()<\/p>\n<p>AllSubjects = []<\/p>\n<p>for record in records:<br \/>\nsn = SubjectNames()<br \/>\nsn.SemesterSubjectId = record[0]<br \/>\nsn.Subject = record[1]<\/p>\n<p>AllSubjects.append(sn)<\/p>\n<p>return AllSubjects<\/p>\n<p>def AddMarks(self, ssid, rid, marks,date):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Marks values (?,?,?,?)&#8221;<br \/>\nrow = (ssid,rid,marks,date)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>def UpdateMarks(self, regid,ssid, marks):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Update Marks set Marks = ? where RegistrationId = ? and SemesterSubjectId = ?&#8221;<br \/>\nrow = (marks, regid, ssid)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>class DBAttendance(DBOperations):<br \/>\ndef __init__(self):<br \/>\nDBOperations.__init__(self)<\/p>\n<p>def SaveAttendance(self,date,rid,eid,att):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;Insert into Attendance values(?,?,?,?)&#8221;<br \/>\nrow = (date, rid, eid, att)<\/p>\n<p>cur.execute(query,row)<br \/>\nself.con.commit()<\/p>\n<p>def GetEnrollmentId(self, regid):<br \/>\ncur = self.con.cursor()<\/p>\n<p>cur.execute(&#8220;Select EnrollmentId from Enrollments where RegistrationId = ? and IsCurrent = 1&#8221;, (regid))<br \/>\nrecords = cur.fetchall()<br \/>\nEnrollmentIdList = []<\/p>\n<p>for record in records:<br \/>\nEnrollmentIdList.append(record[0])<\/p>\n<p>return EnrollmentIdList<\/p>\n<p>def GetAttendance(self, sem, cid, sid):<br \/>\ncur = self.con.cursor()<\/p>\n<p>query = &#8220;select S.RegistrationId, S.Name, DatePart(Day, A.Date) as [Day], A.Attendence From Attendance as [A], Students as [S] Where A.RegistrationId=S.RegistrationId and A.RegistrationId IN (Select RegistrationId From Enrollments where Semester=? and IsCurrent=1) and S.CourseId = ? and S.SessionId = ? Order by A.RegistrationId, [Day]&#8221;<br \/>\nrow = (sem, cid, sid)<\/p>\n<p>cur.execute(query, row)<br \/>\nrecords = cur.fetchall()<br \/>\nAttendanceList = []<\/p>\n<p>\nfor record in records:<br \/>\nAtt = AttendanceRecord()<br \/>\nAtt.RegistrationId = int(record[0])<br \/>\nAtt.Name = record[1]<br \/>\nAtt.Day = record[2]<br \/>\nAtt.Attendance = record[3]<\/p>\n<p>AttendanceList.append(Att)<\/p>\n<p>return AttendanceList<\/p>\n<h2>11.components.py<\/h2>\n<p>class Course:<br \/>\ndef __init__(self):<br \/>\nself.CourseId = 0<br \/>\nself.CourseName = &#8220;&#8221;<br \/>\nself.Description = &#8220;&#8221;<\/p>\n<p>class Session:<br \/>\ndef __init__(self):<br \/>\nself.SessionId = 0<br \/>\nself.Session = 0<\/p>\n<p>class Subject:<br \/>\ndef __init__(self):<br \/>\nself.SubjectId = 0<br \/>\nself.Subject = &#8220;&#8221;<br \/>\nself.Description = &#8220;&#8221;<\/p>\n<p>class Student:<br \/>\ndef __init__(self):<br \/>\nself.RegistrationId = 0<br \/>\nself.RollNo = 0<br \/>\nself.RegistrationDate = &#8220;&#8221;<br \/>\nself.Name = &#8220;&#8221;<br \/>\nself.Dob = &#8220;&#8221;<br \/>\nself.Gender = &#8220;&#8221;<br \/>\nself.FatherName = &#8220;&#8221;<br \/>\nself.MotherName = &#8220;&#8221;<br \/>\nself.Address = &#8220;&#8221;<br \/>\nself.City = &#8220;&#8221;<br \/>\nself.ContactNo = 0<br \/>\nself.EmailId = &#8220;&#8221;<br \/>\nself.Nationality = &#8220;&#8221;<br \/>\nself.CourseId = 0<br \/>\nself.SessionID = 0<\/p>\n<p>class SemesterSubjects:<br \/>\ndef __init__(self):<br \/>\nself.SemesterSubjectId = 0<br \/>\nself.Semester = &#8220;&#8221;<br \/>\nself.CourseId = 0<br \/>\nself.SubjectId = 0<br \/>\nself.SessionId = 0<\/p>\n<p>class SubjectNames:<br \/>\ndef __init__(self):<br \/>\nself.SemesterSubjectId = 0<br \/>\nself.Subject = &#8220;&#8221;<\/p>\n<p>class AttendanceRecord:<br \/>\ndef __init__(self):<br \/>\nself.RegistrationId = 0<br \/>\nself.Name = &#8220;&#8221;<br \/>\nself.Day = 0<br \/>\nself.Attendance = 0<\/p>\n<h2>12.Attendance.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter import Canvas, Scrollbar,messagebox<br \/>\nfrom tkinter.ttk import Combobox<br \/>\nfrom datalayer import DBSessions, DBCourse, DBStudents, DBAttendance<\/p>\n<p>class Attendance:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;505&#215;480&#8221;)<br \/>\nself.root.title(&#8220;Marks&#8221;)<br \/>\nself.Date = tk.StringVar()<\/p>\n<p>self.topframe = tk.Frame(self.root, width = 505 , height = 120)<br \/>\nself.lbl1 = tk.Label(self.topframe, text = &#8220;Session&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 10)<br \/>\nself.cmb1 = Combobox(self.topframe, state = &#8220;readonly&#8221;)<br \/>\nself.cmb1.place(x = 70, y = 10)<br \/>\ndbsessions = DBSessions()<br \/>\nself.AllSessions = dbsessions.GetSession()<br \/>\nSessionList = []<br \/>\nfor sess in self.AllSessions:<br \/>\nSessionList.append(sess.Session)<br \/>\nself.cmb1[&#8216;values&#8217;] = SessionList<\/p>\n<p>self.lbl2 = tk.Label(self.topframe, text = &#8220;Course&#8221;)<br \/>\nself.lbl2.place(x = 290 , y =10)<br \/>\nself.cmb2 = Combobox(self.topframe, state = &#8220;readonly&#8221;)<br \/>\nself.cmb2.place(x = 350, y = 10)<br \/>\ndbcourses = DBCourse()<br \/>\nself.AllCourses = dbcourses.GetCourse()<br \/>\nCourseList = []<br \/>\nfor cour in self.AllCourses:<br \/>\nCourseList.append(cour.CourseName)<br \/>\nself.cmb2[&#8216;values&#8217;] = CourseList<\/p>\n<p>self.lbl3 = tk.Label(self.topframe, text = &#8220;Semester&#8221;)<br \/>\nself.lbl3.place(x = 10 , y = 40)<br \/>\nself.cmb3 = Combobox(self.topframe, state = &#8220;readonly&#8221;)<br \/>\nself.cmb3.place(x = 70, y = 40)<br \/>\nself.cmb3[&#8216;values&#8217;] = [&#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;]<\/p>\n<p>self.lbl4 = tk.Label(self.topframe, text = &#8220;Date&#8221;)<br \/>\nself.lbl4.place(x = 290, y = 40)<br \/>\nself.ent4 = tk.Entry(self.topframe, textvariable = self.Date, width = 23)<br \/>\nself.ent4.place(x = 350, y = 40)<br \/>\nself.errlbl = tk.Label(self.topframe, text = &#8220;&#8221;, fg = &#8220;Gray&#8221;)<br \/>\nself.errlbl.place(x = 350, y = 60)<\/p>\n<p>self.ShowButton = tk.Button(self.topframe, text = &#8220;Show&#8221;,command = self.ShowClicked, width = 12)<br \/>\nself.ShowButton.place(x = 205, y = 80)<\/p>\n<p>self.topframe.pack(side = &#8220;top&#8221;)<\/p>\n<p>self.myframe = tk.Frame(self.root, width = 400, height = 100, bd = 1)<br \/>\nself.myframe.place(x = 10 , y = 140)<br \/>\nself.scrollableframe()<\/p>\n<p>self.btn= tk.Button(self.root, text = &#8220;Mark Attendence&#8221;, command = self.MarkAttendance)<br \/>\nself.btn.place(x = 200, y = 445)<\/p>\n<p>def ShowClicked(self):<br \/>\nself.r = 1<br \/>\nsessid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb2.current()].CourseId<br \/>\nsem = self.cmb3.get()<\/p>\n<p>db = DBStudents()<br \/>\nStudentsList = db.FindStudent(sessid,cid,sem)<br \/>\nself.AttendanceList = []<br \/>\nself.EnrollmentIdList = []<\/p>\n<p>self.frame.destroy()<br \/>\nself.myframe = tk.Frame(self.root, width = 465, height = 100, bd = 1)<br \/>\nself.myframe.place(x = 10 , y = 140) <br \/>\nself.scrollableframe()<\/p>\n<p>for Student in StudentsList:<br \/>\nlistvar = tk.StringVar()<br \/>\nlistvar.set(0)<br \/>\nlbl5 = tk.Label(self.frame, text = Student.RegistrationId, bg = &#8220;White&#8221;)<br \/>\nlbl5.grid(row = self.r, column = 0)<br \/>\nlbl6 = tk.Label(self.frame, text = Student.Name, bg = &#8220;White&#8221;)<br \/>\nlbl6.grid(row = self.r, column = 1)<br \/>\nlbl7 = tk.Label(self.frame, text = Student.RollNo, bg = &#8220;White&#8221;)<br \/>\nlbl7.grid(row = self.r, column = 2)<br \/>\nchk = tk.Checkbutton(self.frame, variable = listvar, text = &#8220;&#8221;, bg = &#8220;White&#8221;)<br \/>\nchk.grid(row = self.r, column = 3)<br \/>\nself.r += 1<\/p>\n<p>self.AttendanceList.append((listvar,Student.RegistrationId))<br \/>\ndb = DBAttendance()<br \/>\nEIL = db.GetEnrollmentId(Student.RegistrationId)<br \/>\nself.EnrollmentIdList.append(EIL)<\/p>\n<p>def MarkAttendance(self):<br \/>\nCheck = self.CheckEntries()<br \/>\nif Check == True:<br \/>\ndb = DBAttendance()<br \/>\nfor a,m in zip(self.AttendanceList, self.EnrollmentIdList):<br \/>\natt = a[0].get()<br \/>\nrid = a[1]<br \/>\neid = m[0]<br \/>\ndate = self.Date.get()<br \/>\ndb.SaveAttendance(date,rid,eid,att)<br \/>\nmessagebox.showinfo(&#8220;Attendance&#8221;, &#8220;Attendance has been Marked&#8221;)<\/p>\n<p>def CheckEntries(self):<br \/>\nErr = True<br \/>\nself.errlbl.config(text = &#8220;&#8221;)<\/p>\n<p>if self.Date.get() == &#8220;&#8221;:<br \/>\nself.errlbl.config(text = &#8220;*Field cannot be empty.&#8221;)<br \/>\nmessagebox.showerror(&#8220;Attendence&#8221;, &#8220;Fill the required fields!&#8221;)<br \/>\nErr = False<\/p>\n<p>return Err<\/p>\n<p>def scrollableframe(self):<br \/>\nself.canvas = Canvas(self.myframe, bg = &#8220;White&#8221;)<br \/>\nself.frame = tk.Frame(self.canvas, bg = &#8220;White&#8221;)<br \/>\nself.myscrollbar = Scrollbar(self.myframe, orient = &#8220;vertical&#8221;, command = self.canvas.yview)<br \/>\nself.canvas.configure(yscrollcommand = self.myscrollbar.set)<\/p>\n<p>self.myscrollbar.pack(side = &#8220;right&#8221;, fill = &#8220;y&#8221;)<br \/>\nself.canvas.pack(side = &#8220;left&#8221;)<br \/>\nself.canvas.create_window((0,0),window = self.frame, anchor = &#8216;nw&#8217;)<br \/>\nself.frame.bind(&#8220;&lt;Configure&gt;&#8221;, self.myfunction)<\/p>\n<p>self.lbl1 = tk.Label(self.frame, text = &#8220;RegistrationId&#8221; , bg = &#8220;White&#8221;)<br \/>\nself.lbl1.grid(row = 0, column = 0)<br \/>\nself.lbl2 = tk.Label(self.frame, text = &#8220;Name&#8221; , bg = &#8220;White&#8221;)<br \/>\nself.lbl2.grid(row = 0, column = 1) <br \/>\nself.lbl3 = tk.Label(self.frame, text = &#8220;Roll No.&#8221; , bg = &#8220;White&#8221;)<br \/>\nself.lbl3.grid(row = 0, column = 2)<br \/>\nself.lbl4 = tk.Label(self.frame, text = &#8220;Attendance&#8221; , bg = &#8220;White&#8221;)<br \/>\nself.lbl4.grid(row = 0, column = 3)<br \/>\nself.frame.grid_columnconfigure(0, minsize =80)<br \/>\nself.frame.grid_columnconfigure(1, minsize =180)<br \/>\nself.frame.grid_columnconfigure(2, minsize =100)<br \/>\nself.frame.grid_columnconfigure(3, minsize =100)<\/p>\n<p>def myfunction(self,event):<br \/>\nself.canvas.configure(scrollregion = self.canvas.bbox(&#8220;all&#8221;), width = 465, height = 270)<\/p>\n<p>def showDiaog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>13.AddSubject.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom datalayer import DBSubjects<br \/>\nfrom components import Subject<br \/>\nfrom tkinter import messagebox<\/p>\n<p>class AddSubject:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.grab_set()<\/p>\n<p>self.SubjectName = tk.StringVar()<br \/>\nself.Description = tk.StringVar()<\/p>\n<p>self.root.geometry(&#8220;250&#215;100&#8221;)<br \/>\nself.root.title(&#8220;Add Subject&#8221;)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Subject&#8221;)<br \/>\nself.lbl1.place(x = 10, y = 10)<\/p>\n<p>self.ent1 = tk.Entry(self.root, textvariable = self.SubjectName)<br \/>\nself.ent1.place(x = 110, y = 10)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text=&#8221;Description&#8221;)<br \/>\nself.lbl3.place(x = 10, y = 40)<\/p>\n<p>self.ent3 = tk.Entry(self.root, textvariable = self.Description)<br \/>\nself.ent3.place(x = 110, y =40)<\/p>\n<p>self.btn1 = tk.Button(self.root, text = &#8220;Save&#8221;, command = self.SaveClicked, width = 12)<br \/>\nself.btn1.place(x = 90, y =70)<\/p>\n<p>def SaveClicked(self):<br \/>\np = Subject()<\/p>\n<p>p.Subject = self.SubjectName.get()<br \/>\np.Description = self.Description.get()<br \/>\nobj=DBSubjects()<br \/>\nobj.AddSubject(p) <br \/>\nmessagebox.showinfo(&#8220;AddSubject&#8221;,&#8221;Subject has been Added successfully.&#8221;)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>14.AddSession.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom components import Session<br \/>\nfrom datalayer import DBSessions<br \/>\nfrom tkinter import messagebox<\/p>\n<p>class AddSession:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.grab_set()<br \/>\nself.root.geometry(&#8220;240&#215;80&#8221;)<br \/>\nself.root.title(&#8220;Session&#8221;)<br \/>\nself.session = tk.StringVar()<\/p>\n<p>self.lbl = tk.Label(self.root, text= &#8220;Enter Session&#8221;)<br \/>\nself.lbl.place(x = 10, y = 10)<br \/>\nself.ent = tk.Entry(self.root, textvariable = self.session)<br \/>\nself.ent.place(x = 100, y = 10)<\/p>\n<p>self.btn = tk.Button(self.root, text = &#8220;Add&#8221;, command = self.addButton, width = 12)<br \/>\nself.btn.place(x = 70, y = 40)<\/p>\n<p>def addButton(self):<br \/>\ns = Session()<br \/>\ns.Session = self.session.get()<br \/>\ndb = DBSessions()<br \/>\ndb.AddSession(s)<br \/>\nmessagebox.showinfo(&#8220;Add Session&#8221;, &#8220;Session was added successfully.&#8221;)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>15.AddCourse.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom datalayer import DBCourse<br \/>\nfrom components import Course<br \/>\nfrom tkinter import messagebox<\/p>\n<p>class AddCourse:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.grab_set()<br \/>\nself.root.title(&#8220;Add Course&#8221;)<\/p>\n<p>self.CourseName = tk.StringVar()<br \/>\nself.Description = tk.StringVar()<\/p>\n<p>self.root.geometry(&#8220;245&#215;115&#8221;)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Course Name&#8221;)<br \/>\nself.lbl1.place(x = 10, y = 10)<\/p>\n<p>self.ent1 = tk.Entry(self.root, textvariable = self.CourseName)<br \/>\nself.ent1.place(x = 110, y = 10)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text=&#8221;Description&#8221;)<br \/>\nself.lbl3.place(x = 10, y = 40)<\/p>\n<p>self.ent3 = tk.Entry(self.root, textvariable = self.Description)<br \/>\nself.ent3.place(x = 110, y =40)<\/p>\n<p>self.btn1 = tk.Button(self.root, text = &#8220;Save&#8221;, command = self.SaveClicked, width = 12)<br \/>\nself.btn1.place(x = 70, y =80)<\/p>\n<p>def SaveClicked(self):<br \/>\np = Course()<\/p>\n<p>p.CourseName = self.CourseName.get()<br \/>\np.Description = self.Description.get()<br \/>\nobj=DBCourse()<br \/>\nobj.AddCourse(p) <br \/>\nmessagebox.showinfo(&#8220;Add Course&#8221;, &#8220;Course was added successfully.&#8221;)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>16.ViewAttendance.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Combobox, Treeview<br \/>\nfrom datalayer import DBSessions, DBCourse, DBStudents, DBAttendance<\/p>\n<p>class ViewAttendance:<br \/>\ndef __init__ (self):<br \/>\nself.root=tk.Toplevel()<br \/>\nself.root.geometry(&#8220;1055&#215;340&#8221;)<br \/>\nself.root.title(&#8220;ViewAttendance&#8221;)<br \/>\nself.root.resizable(&#8220;false&#8221;,&#8221;false&#8221;)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Session&#8221;)<br \/>\nself.lbl1.place(x = 10 , y = 10)<br \/>\nself.cmb1 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb1.place(x = 70, y = 10)<br \/>\ndbsessions = DBSessions()<br \/>\nself.AllSessions = dbsessions.GetSession()<br \/>\nSessionList = []<br \/>\nfor sess in self.AllSessions:<br \/>\nSessionList.append(sess.Session)<br \/>\nself.cmb1[&#8216;values&#8217;] = SessionList<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;Course&#8221;)<br \/>\nself.lbl2.place(x = 260 , y =10)<br \/>\nself.cmb2 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb2.place(x = 330, y = 10)<br \/>\ndbcourses = DBCourse()<br \/>\nself.AllCourses = dbcourses.GetCourse()<br \/>\nCourseList = []<br \/>\nfor cour in self.AllCourses:<br \/>\nCourseList.append(cour.CourseName)<br \/>\nself.cmb2[&#8216;values&#8217;] = CourseList<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Semester&#8221;)<br \/>\nself.lbl3.place(x = 540 , y = 10)<br \/>\nself.cmb3 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb3.place(x = 620, y = 10)<br \/>\nself.cmb3[&#8216;values&#8217;] = [&#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;]<br \/>\nself.cmb3.bind(&#8220;&lt;&lt;ComboboxSelected&gt;&gt;&#8221;, self.SemesterChanged)<\/p>\n<p>\nself.lbl4 = tk.Label(self.root, text = &#8220;Month&#8221;)<br \/>\nself.lbl4.place(x = 820 , y = 10)<br \/>\nself.cmb4 = Combobox(self.root, state = &#8220;readonly&#8221;)<br \/>\nself.cmb4.place(x = 900, y = 10)<\/p>\n<p>self.btn = tk.Button(self.root, text = &#8220;Show&#8221;, command = self.ShowClicked, width = 12)<br \/>\nself.btn.place(x = 350, y = 50)<\/p>\n<p>self.btn1 = tk.Button(self.root, text = &#8220;Exit&#8221;, command = self.root.destroy, width = 12)<br \/>\nself.btn1.place(x = 650, y = 50)<\/p>\n<p>self.Tree = Treeview(self.root)<br \/>\nself.Tree.place(x = 10, y = 100, width = 1035)<\/p>\n<p>\ndef SemesterChanged(self, event):<br \/>\nsemesterindex = self.cmb3.current()+1<\/p>\n<p>if semesterindex%2==0:<br \/>\nself.cmb4[&#8216;values&#8217;]=[&#8220;Aug&#8221;,&#8221;Sept&#8221;,&#8221;Oct&#8221;,&#8221;Nov&#8221;,&#8221;Dec&#8221;]<br \/>\nelse:<br \/>\nself.cmb4[&#8216;values&#8217;]=[&#8220;Jan&#8221;,&#8221;Feb&#8221;,&#8221;Mar&#8221;,&#8221;Apr&#8221;,&#8221;May&#8221;]<\/p>\n<p>def ShowClicked(self):<br \/>\nself.Tree.column(&#8220;#0&#8221;,width=100)<br \/>\nsemesterindex = self.cmb3.current()+1<\/p>\n<p>month = 0<\/p>\n<p>if semesterindex%2==0:<br \/>\nmonth = self.cmb4.current()+7<br \/>\nelse:<br \/>\nmonth = self.cmb4.current()+1<\/p>\n<p>headings = []<\/p>\n<p>if month==2:<br \/>\nfor i in range(1,29):<br \/>\nheadings.append(str(i))<\/p>\n<p>elif month==1 or month==3 or month==5 or month==7 or month==8 or month==10 or month==12:<br \/>\nfor i in range(1,32):<br \/>\nheadings.append(str(i))<\/p>\n<p>else:<br \/>\nfor i in range(1,31):<br \/>\nheadings.append(str(i))<\/p>\n<p>\nself.Tree[&#8220;columns&#8221;] = headings <\/p>\n<p>\nfor heading in headings:<br \/>\nself.Tree.heading(heading, text=heading)<\/p>\n<p>if len(headings) == 28:<br \/>\nprint(&#8220;28&#8221;)<br \/>\nself.Set28Widths()<br \/>\nelif len(headings) == 30:<br \/>\nself.Set30Widths()<br \/>\nelse:<br \/>\nself.Set31Widths()<\/p>\n<p>sid = self.AllSessions[self.cmb1.current()].SessionId<br \/>\ncid = self.AllCourses[self.cmb2.current()].CourseId<br \/>\nsem = self.cmb3.get()<\/p>\n<p>db = DBAttendance()<br \/>\nrecords = db.GetAttendance(sem, cid ,sid)<\/p>\n<p>i = 0<br \/>\natt = [&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;]<\/p>\n<p>\nregid = records[0].RegistrationId<br \/>\nName = &#8220;&#8221;<\/p>\n<p>for record in records: <\/p>\n<p>if record.RegistrationId==regid:<br \/>\natt[record.Day-1] = record.Attendance<br \/>\nelse:<br \/>\nself.Tree.insert(&#8220;&#8221;, i, text = Name , values= (att))<br \/>\natt = [&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;]<br \/>\natt[record.Day-1] = record.Attendance<\/p>\n<p>regid=record.RegistrationId<\/p>\n<p>Name=record.Name<\/p>\n<p>i += 1<\/p>\n<p>if i==len(records):<br \/>\nself.Tree.insert(&#8220;&#8221;, i, text = Name , values= (att))<\/p>\n<p>def Set31Widths(self):<\/p>\n<p>self.Tree.column(&#8220;1&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;2&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;3&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;4&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;5&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;6&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;7&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;8&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;9&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;10&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;11&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;12&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;13&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;14&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;15&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;16&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;17&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;18&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;19&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;20&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;21&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;22&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;23&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;24&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;25&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;26&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;27&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;28&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;29&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;30&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;31&#8221;,width=30)<\/p>\n<p>def Set30Widths(self):<br \/>\nself.Tree.column(&#8220;1&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;2&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;3&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;4&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;5&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;6&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;7&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;8&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;9&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;10&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;11&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;12&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;13&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;14&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;15&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;16&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;17&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;18&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;19&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;20&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;21&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;22&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;23&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;24&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;25&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;26&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;27&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;28&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;29&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;30&#8221;,width=30)<\/p>\n<p>def Set28Widths(self):<br \/>\nself.Tree.column(&#8220;1&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;2&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;3&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;4&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;5&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;6&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;7&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;8&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;9&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;10&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;11&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;12&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;13&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;14&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;15&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;16&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;17&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;18&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;19&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;20&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;21&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;22&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;23&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;24&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;25&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;26&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;27&#8221;,width=30)<br \/>\nself.Tree.column(&#8220;28&#8221;,width=30)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>17.ViewCourses.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Treeview<br \/>\nfrom tkinter import messagebox<br \/>\nfrom datalayer import DBCourse<br \/>\nfrom components import Course<\/p>\n<p>class ViewCourses:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.grab_set()<\/p>\n<p>self.tree = Treeview(self.root)<br \/>\nself.tree.pack()<\/p>\n<p>self.tree[&#8216;columns&#8217;] = (&#8220;c1&#8243;,&#8221;c2&#8221;)<br \/>\nself.tree.heading(&#8220;c1&#8221;, text = &#8220;Course&#8221;)<br \/>\nself.tree.heading(&#8220;c2&#8221;, text = &#8220;Description&#8221;)<\/p>\n<p>db = DBCourse()<br \/>\nAllCourses = db.GetCourse()<\/p>\n<p>i = 1<\/p>\n<p>for c in AllCourses:<br \/>\nself.tree.insert(&#8220;&#8221;,i,text = c.CourseId, values= (c.CourseName, c.Description))<br \/>\ni = i+1<\/p>\n<p>self.DeleteButton = tk.Button(self.root,text=&#8221;Delete&#8221;, command = self.DeleteClicked)<br \/>\nself.DeleteButton.pack()<\/p>\n<p>def DeleteClicked(self):<br \/>\nret = messagebox.askyesno(&#8220;Courses&#8221;,&#8221;Do you want to delete the course?&#8221;)<br \/>\nif ret == True:<br \/>\nkey = self.tree.focus()<br \/>\ncid = int(self.tree.item(key,&#8221;text&#8221;))<br \/>\nc = Course()<br \/>\ndb = DBCourse()<br \/>\nc.CourseId = cid<br \/>\ndb.DeleteCourse(c)<br \/>\nself.tree.delete(key)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>18.ViewMarksForm.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Combobox<br \/>\nfrom datalayer import DBMarks<br \/>\nfrom functools import partial<\/p>\n<p>class ViewMarksForm:<br \/>\ndef __init__(self,sem,regid,name,sessid,cid,Marks):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.geometry(&#8220;530&#215;385&#8221;)<br \/>\nself.root.title(&#8220;View Marks&#8221;)<br \/>\nself.y = 5<br \/>\nself.rid = tk.StringVar()<br \/>\nself.Name = tk.StringVar()<\/p>\n<p>self.lbl2 = tk.Label(self.root, text = &#8220;RegistrationId&#8221;)<br \/>\nself.lbl2.place(x = 10, y = 10)<br \/>\nself.ent2 = tk.Entry(self.root, textvariable = self.rid, state = &#8220;readonly&#8221;)<br \/>\nself.ent2.place(x = 110, y = 10)<br \/>\nself.rid.set(regid)<\/p>\n<p>self.lbl3 = tk.Label(self.root, text = &#8220;Name&#8221;)<br \/>\nself.lbl3.place(x = 250, y = 10)<br \/>\nself.ent3 = tk.Entry(self.root, textvariable = self.Name, state = &#8220;readonly&#8221;)<br \/>\nself.ent3.place(x = 350, y = 10)<br \/>\nself.Name.set(name)<\/p>\n<p>self.lbl1 = tk.Label(self.root, text = &#8220;Semester&#8221;)<br \/>\nself.lbl1.place(x = 10, y = 50)<br \/>\nself.cmb = Combobox(self.root)<br \/>\nself.cmb.place(x = 110, y = 50)<br \/>\nself.cmb[&#8216;values&#8217;] = [&#8216;1&#8242;,&#8217;2&#8242;,&#8217;3&#8242;,&#8217;4&#8242;,&#8217;5&#8242;,&#8217;6&#8242;,&#8217;7&#8242;,&#8217;8&#8217;]<\/p>\n<p>self.ShowButton = tk.Button(self.root, text = &#8220;Show&#8221;, command = partial(self.ShowClicked,sessid,cid,regid))<br \/>\nself.ShowButton.place(x = 350, y = 50)<\/p>\n<p>self.frame = tk.Frame(self.root, width = 400, height = 400)<br \/>\nself.frame.place(x = 105, y = 100)<\/p>\n<p>self.GetMarks(sessid,cid,sem,Marks)<br \/>\nomarks = 0<br \/>\nfor mark in Marks:<br \/>\nomarks += mark<\/p>\n<p>if Marks != []:<br \/>\nobt = tk.Label(self.frame, text = &#8220;Obtained Marks&#8221;)<br \/>\nobt.place(x = 25, y = self.y + 20)<br \/>\nobtlbl = tk.Label(self.frame, text = omarks).place(x = 125, y = self.y + 20)<\/p>\n<p>total = tk.Label(self.frame, text = &#8220;Total Marks&#8221;)<br \/>\ntotal.place(x = 25, y = self.y + 50)<br \/>\ntotallbl = tk.Label(self.frame, text = len(Marks)*100).place(x = 125, y = self.y + 50)<\/p>\n<p>per = tk.Label(self.frame, text = &#8220;Percentage&#8221;)<br \/>\nper.place(x = 25, y = self.y + 80)<br \/>\nperlbl = tk.Label(self.frame, text = (omarks\/len(Marks))).place(x = 125, y = self.y + 80)<\/p>\n<p>def ShowClicked(self,sessid,cid,regid):<br \/>\nself.y = 5<br \/>\nself.frame.destroy()<br \/>\nself.frame = tk.Frame(self.root, width = 400, height = 400)<br \/>\nself.frame.place(x = 105, y = 100)<br \/>\nsem = self.cmb.get()<br \/>\ndb = DBMarks()<br \/>\nMarks = db.CheckMarks(regid,sem)<br \/>\nself.GetMarks(sessid,cid,sem,Marks)<\/p>\n<p>if Marks != []:<br \/>\nomarks = 0<br \/>\nfor mark in Marks:<br \/>\nomarks += mark<br \/>\nobt = tk.Label(self.frame, text = &#8220;Obtained Marks&#8221;)<br \/>\nobt.place(x = 25, y = self.y + 20)<br \/>\nobtlbl = tk.Label(self.frame, text = omarks).place(x = 125, y = self.y + 20)<\/p>\n<p>total = tk.Label(self.frame, text = &#8220;Total Marks&#8221;)<br \/>\ntotal.place(x = 25, y = self.y + 50)<br \/>\ntotallbl = tk.Label(self.frame, text = len(Marks)*100).place(x = 125, y = self.y + 50)<\/p>\n<p>per = tk.Label(self.frame, text = &#8220;Percentage&#8221;)<br \/>\nper.place(x = 25, y = self.y + 80)<br \/>\nperlbl = tk.Label(self.frame, text = (omarks\/len(Marks))).place(x = 125, y = self.y + 80)<\/p>\n<p>def GetMarks(self,sessid,cid,sem,Marks):<br \/>\ndb = DBMarks()<br \/>\nself.AllSubjects = db.GetSubjects(sessid,cid,sem)<br \/>\nself.MarksList = []<\/p>\n<p>if Marks == []:<br \/>\nMarks = [&#8220;NULL&#8221;] * len(self.AllSubjects)<\/p>\n<p>for a,m in zip(self.AllSubjects,Marks):<br \/>\nlistvar = tk.StringVar()<br \/>\nself.MarksList.append((listvar,a.SemesterSubjectId))<br \/>\nlbl = tk.Label(self.frame, text = a.Subject)<br \/>\nlbl.place(x = 5, y = self.y)<br \/>\nent = tk.Entry(self.frame, textvariable = listvar, state = &#8220;readonly&#8221;)<br \/>\nent.place(x = 95, y = self.y)<br \/>\nself.y += 40<br \/>\nlistvar.set(m)<\/p>\n<p>\ndef showDialog(self):<\/p>\n<p>self.root.mainloop()<\/p>\n<h2>19.ViewSessions.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Treeview<br \/>\nfrom tkinter import messagebox<br \/>\nfrom datalayer import DBSessions<br \/>\nfrom components import Session<\/p>\n<p>class ViewSessions:<br \/>\ndef __init__(self):<br \/>\nself.root=tk.Toplevel()<br \/>\nself.root.grab_set()<\/p>\n<p>self.tree=Treeview(self.root)<br \/>\nself.tree.pack()<\/p>\n<p>self.tree[&#8216;columns&#8217;]=(&#8220;c1&#8221;)<br \/>\nself.tree.heading(&#8220;c1&#8243;,text=&#8221;Session&#8221;)<\/p>\n<p>db=DBSessions()<br \/>\nAllSessions=db.GetSession()<\/p>\n<p>i=1<\/p>\n<p>for c in AllSessions:<br \/>\nself.tree.insert(&#8220;&#8221;,i,text=c.SessionId,values=(c.Session))<br \/>\ni=i+1<\/p>\n<p>self.btn=tk.Button(self.root,text=&#8221;Delete&#8221;,command=self.delete)<br \/>\nself.btn.pack()<\/p>\n<p>def delete(self):<br \/>\nret=messagebox.askyesno(&#8220;Session&#8221;,&#8221;do you want to delete Session?&#8221;)<br \/>\nif ret==True:<br \/>\nkey=self.tree.focus()<br \/>\ncid=int(self.tree.item(key,&#8221;text&#8221;))<br \/>\nc=Session()<br \/>\nc.SessionId=cid<br \/>\ndb=DBSessions()<br \/>\ndb.DeleteSessions(c)<br \/>\nself.tree.delete(key)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h2>20.ViewSubjects.py<\/h2>\n<p>import tkinter as tk<br \/>\nfrom tkinter.ttk import Treeview<br \/>\nfrom tkinter import messagebox<br \/>\nfrom datalayer import DBSubjects<br \/>\nfrom components import Subject<\/p>\n<p>class ViewSubjects:<br \/>\ndef __init__(self):<br \/>\nself.root = tk.Toplevel()<br \/>\nself.root.grab_set()<br \/>\nself.root.title(&#8220;View Subject&#8221;)<\/p>\n<p>self.tree = Treeview(self.root)<br \/>\nself.tree.pack()<\/p>\n<p>self.tree[&#8216;columns&#8217;] = (&#8220;c1&#8243;,&#8221;c2&#8221;)<br \/>\nself.tree.heading(&#8220;c1&#8221;, text = &#8220;Course&#8221;)<br \/>\nself.tree.heading(&#8220;c2&#8221;, text = &#8220;Description&#8221;)<\/p>\n<p>db = DBSubjects()<br \/>\nAllSubjects = db.GetSubjects()<\/p>\n<p>i = 1<\/p>\n<p>for c in AllSubjects:<br \/>\nself.tree.insert(&#8220;&#8221;,i,text = c.SubjectId, values= (c.Subject, c.Description))<br \/>\ni = i+1<\/p>\n<p>self.DeleteButton = tk.Button(self.root,text=&#8221;Delete&#8221;, command = self.DeleteClicked)<br \/>\nself.DeleteButton.pack()<\/p>\n<p>def DeleteClicked(self):<br \/>\nret = messagebox.askyesno(&#8220;Courses&#8221;,&#8221;Do you want to delete the subject?&#8221;)<br \/>\nif ret == True:<br \/>\nkey = self.tree.focus()<br \/>\nsid = int(self.tree.item(key,&#8221;text&#8221;))<br \/>\nc = Subject()<br \/>\ndb = DBSubjects()<br \/>\nc.SubjectId = sid<br \/>\ndb.DeleteSubjects(c)<br \/>\nself.tree.delete(key)<\/p>\n<p>def showDialog(self):<br \/>\nself.root.mainloop()<\/p>\n<h1>College Automation Syetem Data Base Code<\/h1>\n<p>USE [master]<br \/>\nGO<br \/>\n\/****** Object: Database [ProjectDB] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nCREATE DATABASE [ProjectDB]<br \/>\nCONTAINMENT = NONE<br \/>\nON PRIMARY <br \/>\n( NAME = N&#8217;ProjectDB&#8217;, FILENAME = N&#8217;C:\\Program Files\\Microsoft SQL Server\\MSSQL14.SQLEXPRESS\\MSSQL\\DATA\\ProjectDB.mdf&#8217; , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )<br \/>\nLOG ON <br \/>\n( NAME = N&#8217;ProjectDB_log&#8217;, FILENAME = N&#8217;C:\\Program Files\\Microsoft SQL Server\\MSSQL14.SQLEXPRESS\\MSSQL\\DATA\\ProjectDB_log.ldf&#8217; , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )<br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET COMPATIBILITY_LEVEL = 140<br \/>\nGO<br \/>\nIF (1 = FULLTEXTSERVICEPROPERTY(&#8216;IsFullTextInstalled&#8217;))<br \/>\nbegin<br \/>\nEXEC [ProjectDB].[dbo].[sp_fulltext_database] @action = &#8216;enable&#8217;<br \/>\nend<br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ANSI_NULL_DEFAULT OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ANSI_NULLS OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ANSI_PADDING OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ANSI_WARNINGS OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ARITHABORT OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET AUTO_CLOSE ON <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET AUTO_SHRINK OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET AUTO_UPDATE_STATISTICS ON <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET CURSOR_CLOSE_ON_COMMIT OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET CURSOR_DEFAULT GLOBAL <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET CONCAT_NULL_YIELDS_NULL OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET NUMERIC_ROUNDABORT OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET QUOTED_IDENTIFIER OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET RECURSIVE_TRIGGERS OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET DISABLE_BROKER <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET DATE_CORRELATION_OPTIMIZATION OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET TRUSTWORTHY OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET ALLOW_SNAPSHOT_ISOLATION OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET PARAMETERIZATION SIMPLE <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET READ_COMMITTED_SNAPSHOT OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET HONOR_BROKER_PRIORITY OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET RECOVERY SIMPLE <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET MULTI_USER <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET PAGE_VERIFY CHECKSUM <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET DB_CHAINING OFF <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET TARGET_RECOVERY_TIME = 60 SECONDS <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET DELAYED_DURABILITY = DISABLED <br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET QUERY_STORE = OFF<br \/>\nGO<br \/>\nUSE [ProjectDB]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Attendance] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Attendance](<br \/>\n[uid] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[Date] [date] NULL,<br \/>\n[RegistrationId] [int] NULL,<br \/>\n[EnrollmentId] [int] NULL,<br \/>\n[Attendance] [int] NOT NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[uid] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Courses] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Courses](<br \/>\n[CourseId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[courseName] [varchar](50) NULL,<br \/>\n[Description] [varchar](50) NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[CourseId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Enrollments] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Enrollments](<br \/>\n[EnrollmentId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[EDate] [date] NULL,<br \/>\n[Semester] [varchar](3) NULL,<br \/>\n[RegistrationId] [int] NULL,<br \/>\n[IsCurrent] [int] NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[EnrollmentId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Marks] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Marks](<br \/>\n[SerialNo] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[SemesterSubjectId] [int] NULL,<br \/>\n[RegistrationId] [int] NULL,<br \/>\n[Marks] [int] NOT NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[SerialNo] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[SemesterSubjects] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[SemesterSubjects](<br \/>\n[SemesterSubjectId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[Semester] [varchar](3) NULL,<br \/>\n[CourseId] [int] NULL,<br \/>\n[SubjectId] [int] NULL,<br \/>\n[SessionId] [int] NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[SemesterSubjectId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Sessions] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Sessions](<br \/>\n[SessionId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[Session] [varchar](9) NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[SessionId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Students] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Students](<br \/>\n[RegistrationId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[RollNo] [int] NULL,<br \/>\n[RegistrationDate] [date] NULL,<br \/>\n[Name] [varchar](40) NULL,<br \/>\n[DOB] [date] NULL,<br \/>\n[Gender] [varchar](6) NULL,<br \/>\n[FatherName] [varchar](40) NULL,<br \/>\n[MotherName] [varchar](40) NULL,<br \/>\n[Address] [varchar](50) NULL,<br \/>\n[City] [varchar](20) NULL,<br \/>\n[ContactNo] [int] NULL,<br \/>\n[EmailId] [varchar](50) NULL,<br \/>\n[Nationality] [varchar](20) NULL,<br \/>\n[CourseId] [int] NULL,<br \/>\n[SessionId] [int] NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[RegistrationId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\n\/****** Object: Table [dbo].[Subjects] Script Date: 7\/18\/2019 2:52:01 PM ******\/<br \/>\nSET ANSI_NULLS ON<br \/>\nGO<br \/>\nSET QUOTED_IDENTIFIER ON<br \/>\nGO<br \/>\nCREATE TABLE [dbo].[Subjects](<br \/>\n[SubjectId] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[Subject] [varchar](10) NULL,<br \/>\n[Description] [varchar](40) NULL,<br \/>\nPRIMARY KEY CLUSTERED <br \/>\n(<br \/>\n[SubjectId] ASC<br \/>\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br \/>\n) ON [PRIMARY]<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Courses] ON <br \/>\nGO<br \/>\nINSERT [dbo].[Courses] ([CourseId], [courseName]<a href=\"https:\/\/www.reilsolar.com\/drive\/wp-content\/uploads\/sites\/9\/2020\/05\/college-automation-ststem-project-pdf.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">,<\/a> [Description]) VALUES (12, N&#8217;B.Tech EE&#8217;, N&#8217;Electrical Engineering&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Courses] ([CourseId], [courseName], [Description]) VALUES (13, N&#8217;B.Tech ME&#8217;, N&#8217;Mechanical engineering&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Courses] ([CourseId], [courseName], [Description]) VALUES (14, N&#8217;B.Tech CSE&#8217;, N&#8217;Computer Science and Engineering&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Courses] ([CourseId], [courseName], [Description]) VALUES (15, N&#8217;B.Tech ECE&#8217;, N&#8217;Electronics and Communication Engineering&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Courses] ([CourseId], [courseName], [Description]) VALUES (16, N&#8217;BTech IT&#8217;, N&#8217;Information Technology&#8217;)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Courses] OFF<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Enrollments] ON <br \/>\nGO<br \/>\nINSERT [dbo].[Enrollments] ([EnrollmentId], [EDate], [Semester], [RegistrationId], [IsCurrent]) VALUES (3, CAST(N&#8217;2019-07-18&#8242; AS Date), N&#8217;5th&#8217;, 5, 1)<br \/>\nGO<br \/>\nINSERT [dbo].[Enrollments] ([EnrollmentId], [EDate], [Semester], [RegistrationId], [IsCurrent]) VALUES (4, CAST(N&#8217;2019-07-18&#8242; AS Date), N&#8217;5th&#8217;, 8, 1)<br \/>\nGO<br \/>\nINSERT [dbo].[Enrollments] ([EnrollmentId], [EDate], [Semester], [RegistrationId], [IsCurrent]) VALUES (5, CAST(N&#8217;2019-07-18&#8242; AS Date), N&#8217;5th&#8217;, 7, 1)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Enrollments] OFF<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[SemesterSubjects] ON <br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (1, N&#8221;, 16, 6, 16)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (2, N&#8221;, 16, 6, 16)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (3, N&#8217;2nd&#8217;, 13, 3, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (4, N&#8217;1st&#8217;, 14, 3, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (5, N&#8217;1st&#8217;, 14, 4, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (6, N&#8217;1st&#8217;, 14, 5, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId]<a href=\"https:\/\/www.reilsolar.com\/drive\/wp-content\/uploads\/sites\/9\/2020\/05\/CAS-Presentation.pptx\" target=\"_blank\" rel=\"noopener noreferrer\">,<\/a> [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (7, N&#8217;1st&#8217;, 14, 6, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (8, N&#8217;1st&#8217;, 14, 6, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (9, N&#8217;2nd&#8217;, 14, 3, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[SemesterSubjects] ([SemesterSubjectId], [Semester], [CourseId], [SubjectId], [SessionId]) VALUES (10, N&#8217;2nd&#8217;, 14, 4, 13)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[SemesterSubjects] OFF<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Sessions] ON <br \/>\nGO<br \/>\nINSERT [dbo].[Sessions] ([SessionId], [Session]) VALUES (13, N&#8217;2017-2021&#8242;)<br \/>\nGO<br \/>\nINSERT [dbo].[Sessions] ([SessionId], [Session]) VALUES (14, N&#8217;2018-2022&#8242;)<br \/>\nGO<br \/>\nINSERT [dbo].[Sessions] ([SessionId], [Session]) VALUES (15, N&#8217;2019-2023&#8242;)<br \/>\nGO<br \/>\nINSERT [dbo].[Sessions] ([SessionId], [Session]) VALUES (16, N&#8217;2020-2024&#8242;)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Sessions] OFF<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Students] ON <br \/>\nGO<br \/>\nINSERT [dbo].[Students] ([RegistrationId], [RollNo], [RegistrationDate], [Name], [DOB], [Gender], [FatherName], [MotherName], [Address]<a href=\"https:\/\/www.reilsolar.com\/drive\/wp-content\/uploads\/sites\/9\/2020\/05\/college-automation-ststem-project-word-file.docx\" target=\"_blank\" rel=\"noopener noreferrer\">,<\/a> [City], [ContactNo], [EmailId], [Nationality], [CourseId], [SessionId]) VALUES (5, 11701131, CAST(N&#8217;2019-08-18&#8242; AS Date), N&#8217;Ankush Kamboj&#8217;, CAST(N&#8217;2000-02-16&#8242; AS Date), N&#8217;Male&#8217;, N&#8221;, N&#8221;, N&#8221;, N&#8217;Abohar&#8217;, 75893, N&#8217;ankush@gmail.com&#8217;, N&#8217;Indian&#8217;, 14, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[Students] ([RegistrationId], [RollNo], [RegistrationDate], [Name], [DOB], [Gender], [FatherName], [MotherName], [Address], [City], [ContactNo], [EmailId], [Nationality], [CourseId], [SessionId]) VALUES (7, 11701042, CAST(N&#8217;2019-08-18&#8242; AS Date), N&#8217;Vanshika&#8217;, CAST(N&#8217;1999-08-06&#8242; AS Date), N&#8217;Female&#8217;, N&#8221;, N&#8221;, N&#8221;, N&#8217;Sunam&#8217;, 78945, N&#8217;Vanshika@gmail.com&#8217;, N&#8217;Indian&#8217;, 14, 13)<br \/>\nGO<br \/>\nINSERT [dbo].[Students] ([RegistrationId], [RollNo], [RegistrationDate], [Name], [DOB], [Gender], [FatherName], [MotherName], [Address], [City], [ContactNo], [EmailId], [Nationality], [CourseId], [SessionId]) VALUES (8, 11701029, CAST(N&#8217;2019-08-18&#8242; AS Date), N&#8217;Mehak&#8217;, CAST(N&#8217;2000-04-21&#8242; AS Date), N&#8217;Female&#8217;, N&#8221;, N&#8221;, N&#8221;, N&#8217;Fazilka&#8217;, 78945, N&#8217;Mehak@gmail.com&#8217;, N&#8217;Indian&#8217;, 14, 13)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Students] OFF<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Subjects] ON <br \/>\nGO<br \/>\nINSERT [dbo].[Subjects] ([SubjectId], [Subject], [Description]) VALUES (3, N&#8217;CP&#8217;, N&#8217;Computer Programming&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Subjects] ([SubjectId], [Subject], [Description]) VALUES (4, N&#8217;CN&#8217;, N&#8217;Computer Networks&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Subjects] ([SubjectId], [Subject], [Description]) VALUES (5, N&#8217;OOPs&#8217;, N&#8217;Object Oriented Programming&#8217;)<br \/>\nGO<br \/>\nINSERT [dbo].[Subjects] ([SubjectId], [Subject], [Description]) VALUES (6, N&#8217;SE&#8217;, N&#8217;Software Enginnering&#8217;)<br \/>\nGO<br \/>\nSET IDENTITY_INSERT [dbo].[Subjects] OFF<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Attendance] WITH CHECK ADD FOREIGN KEY([EnrollmentId])<br \/>\nREFERENCES [dbo]<a href=\"https:\/\/www.reilsolar.com\/drive\/wp-content\/uploads\/sites\/9\/2020\/05\/College-Automation-System-Project.zip\" target=\"_blank\" rel=\"noopener noreferrer\">.<\/a>[Enrollments] ([EnrollmentId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Attendance] WITH CHECK ADD FOREIGN KEY([RegistrationId])<br \/>\nREFERENCES [dbo].[Students] ([RegistrationId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Enrollments] WITH CHECK ADD FOREIGN KEY([RegistrationId])<br \/>\nREFERENCES [dbo].[Students] ([RegistrationId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Marks] WITH CHECK ADD FOREIGN KEY([RegistrationId])<br \/>\nREFERENCES [dbo].[Students] ([RegistrationId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Marks] WITH CHECK ADD FOREIGN KEY([SemesterSubjectId])<br \/>\nREFERENCES [dbo].[SemesterSubjects] ([SemesterSubjectId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[SemesterSubjects] WITH CHECK ADD FOREIGN KEY([CourseId])<br \/>\nREFERENCES [dbo].[Courses] ([CourseId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[SemesterSubjects] WITH CHECK ADD FOREIGN KEY([SessionId])<br \/>\nREFERENCES [dbo].[Sessions] ([SessionId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[SemesterSubjects] WITH CHECK ADD FOREIGN KEY([SubjectId])<br \/>\nREFERENCES [dbo].[Subjects] ([SubjectId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Students] WITH CHECK ADD FOREIGN KEY([CourseId])<br \/>\nREFERENCES [dbo].[Courses] ([CourseId])<br \/>\nGO<br \/>\nALTER TABLE [dbo].[Students] WITH CHECK ADD FOREIGN KEY([SessionId])<br \/>\nREFERENCES [dbo].[Sessions] ([SessionId])<br \/>\nGO<br \/>\nUSE [master]<br \/>\nGO<br \/>\nALTER DATABASE [ProjectDB] SET READ_WRITE <br \/>\nGO<\/p>\n<h2><a href=\"https:\/\/www.reilsolar.com\/drive\/wp-content\/uploads\/sites\/9\/2020\/05\/Database-Script.txt\" target=\"_blank\" rel=\"noopener noreferrer\">College and Home Automation System Project Using IOT Database Script<\/a><\/h2>\n<article class=\"w-full scroll-mb-[var(--thread-trailing-height,150px)] text-token-text-primary focus-visible:outline-2 focus-visible:outline-offset-[-4px]\" dir=\"auto\" data-testid=\"conversation-turn-39\" data-scroll-anchor=\"false\">\n<div class=\"m-auto text-base py-[18px] px-3 md:px-4 w-full md:px-5 lg:px-4 xl:px-5\">\n<div class=\"mx-auto flex flex-1 gap-4 text-base md:gap-5 lg:gap-6 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem]\">\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\n<div class=\"flex-col gap-1 md:gap-3\">\n<div class=\"flex max-w-full flex-col flex-grow\">\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words text-start [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"851f81fa-d1c1-41f2-a9fd-5ccde1c7b21e\" data-message-model-slug=\"gpt-4o\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n<article class=\"w-full scroll-mb-[var(--thread-trailing-height,150px)] text-token-text-primary focus-visible:outline-2 focus-visible:outline-offset-[-4px]\" dir=\"auto\" data-testid=\"conversation-turn-41\" data-scroll-anchor=\"true\">\n<div class=\"m-auto text-base py-[18px] px-3 md:px-4 w-full md:px-5 lg:px-4 xl:px-5\">\n<div class=\"mx-auto flex flex-1 gap-4 text-base md:gap-5 lg:gap-6 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem]\">\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\n<div class=\"flex-col gap-1 md:gap-3\">\n<div class=\"flex max-w-full flex-col flex-grow\">\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words text-start [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"9a5fd4dc-767c-4322-9ab5-33cb77db50f8\" data-message-model-slug=\"gpt-4o\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<p>Creating a &#8220;College and Home Automation System&#8221; using IoT (Internet of Things), Python, and Machine Learning involves several steps. Here&#8217;s an outline and some key components to help you get started with your project:<\/p>\n<hr \/>\n<h3><strong>Project Objectives<\/strong><\/h3>\n<ol>\n<li>Automate tasks in college and home environments, such as:\n<ul>\n<li>Controlling lights, fans, and appliances.<\/li>\n<li>Monitoring energy consumption.<\/li>\n<li>Security and surveillance.<\/li>\n<li>Room temperature and humidity control.<\/li>\n<\/ul>\n<\/li>\n<li>Use machine learning to make intelligent decisions:\n<ul>\n<li>Predict energy usage patterns.<\/li>\n<li>Detect anomalies in security systems.<\/li>\n<li>Recognize speech for voice commands.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>Key Components<\/strong><\/h3>\n<h4><strong>1. Hardware Requirements<\/strong><\/h4>\n<ul>\n<li><strong>Microcontroller:<\/strong> ESP32 or Raspberry Pi.<\/li>\n<li><strong>Sensors:<\/strong>\n<ul>\n<li>Temperature &amp; Humidity (DHT11\/DHT22).<\/li>\n<li>Motion Detection (PIR Sensor).<\/li>\n<li>Light Intensity (LDR Sensor).<\/li>\n<\/ul>\n<\/li>\n<li><strong>Actuators:<\/strong>\n<ul>\n<li>Relays for controlling appliances.<\/li>\n<li>Smart bulbs or plugs.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Camera Module:<\/strong> For security and surveillance.<\/li>\n<li><strong>Wi-Fi Router:<\/strong> For IoT connectivity.<\/li>\n<\/ul>\n<h4><strong>2. Software Requirements<\/strong><\/h4>\n<ul>\n<li><strong>Programming Language:<\/strong> Python.<\/li>\n<li><strong>Libraries:<\/strong>\n<ul>\n<li>IoT Communication: <code>paho-mqtt<\/code>, <code>socket<\/code>.<\/li>\n<li>Sensor Integration: <code>gpiozero<\/code>, <code>adafruit-dht<\/code>.<\/li>\n<li>Machine Learning: <code>scikit-learn<\/code>, <code>tensorflow<\/code>.<\/li>\n<li>Voice Control: <code>speechrecognition<\/code>, <code>pyttsx3<\/code>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Cloud Services:<\/strong>\n<ul>\n<li>MQTT Broker: Eclipse Mosquitto or AWS IoT.<\/li>\n<li>Data Storage: Firebase, AWS, or Azure.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Database:<\/strong> SQLite or cloud-based (e.g., Firebase).<\/li>\n<\/ul>\n<h4><strong>3. Machine Learning Models<\/strong><\/h4>\n<ul>\n<li><strong>Energy Prediction:<\/strong> Time-series analysis using LSTM.<\/li>\n<li><strong>Anomaly Detection:<\/strong> Using k-means or isolation forests for security alerts.<\/li>\n<li><strong>Voice Command Recognition:<\/strong> Using an NLP model like SpeechRecognition or pretrained models (e.g., Google Speech-to-Text).<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>Project Development Steps<\/strong><\/h3>\n<h4><strong>Step 1: Setup IoT Framework<\/strong><\/h4>\n<ul>\n<li>Install necessary libraries and frameworks.<\/li>\n<li>Use MQTT for communication between devices and server.<\/li>\n<li>Connect sensors and actuators to ESP32 or Raspberry Pi.<\/li>\n<\/ul>\n<h4><strong>Step 2: Develop Python Backend<\/strong><\/h4>\n<ul>\n<li>Write Python scripts to read sensor data and control devices.<\/li>\n<li>Implement APIs (using Flask or FastAPI) for communication with a web or mobile app.<\/li>\n<\/ul>\n<h4><strong>Step 3: Implement Machine Learning<\/strong><\/h4>\n<ul>\n<li>Train a model to predict energy consumption using historical data.<\/li>\n<li>Build an anomaly detection system for identifying irregularities in sensor data.<\/li>\n<li>Train or use a pretrained model for voice command recognition.<\/li>\n<\/ul>\n<h4><strong>Step 4: Create a User Interface<\/strong><\/h4>\n<ul>\n<li><strong>Mobile App:<\/strong> Use Flutter or React Native.<\/li>\n<li><strong>Web Dashboard:<\/strong> Use Django or Flask with a front-end framework (e.g., React).<\/li>\n<\/ul>\n<h4><strong>Step 5: Integration and Testing<\/strong><\/h4>\n<ul>\n<li>Integrate all components (hardware, backend, ML models, UI).<\/li>\n<li>Test functionality for different use cases (e.g., appliance control, security monitoring).<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>Sample Python Code Snippets<\/strong><\/h3>\n<h4><strong>Reading Data from a DHT Sensor<\/strong><\/h4>\n<p>import Adafruit_DHT<\/p>\n<p>sensor = Adafruit_DHT.DHT22<br \/>\npin = 4 # GPIO pin<\/p>\n<p>humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)<br \/>\nif humidity and temperature:<br \/>\nprint(f&#8221;Temp: {temperature:.1f}C, Humidity: {humidity:.1f}%&#8221;)<br \/>\nelse:<br \/>\nprint(&#8220;Failed to retrieve data from sensor&#8221;)<\/p>\n<h4><strong>Controlling a Relay<\/strong><\/h4>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">\n<p>import RPi.GPIO as GPIO<br \/>\nimport time<\/p>\n<p>GPIO.setmode(GPIO.BCM)<br \/>\nrelay_pin = 17<br \/>\nGPIO.setup(relay_pin, GPIO.OUT)<\/p>\n<p># Turn ON relay<br \/>\nGPIO.output(relay_pin, GPIO.HIGH)<br \/>\ntime.sleep(5) # Keep ON for 5 seconds<\/p>\n<p># Turn OFF relay<br \/>\nGPIO.output(relay_pin, GPIO.LOW)<br \/>\nGPIO.cleanup()<\/p>\n<h3><strong>Future Enhancements<\/strong><\/h3>\n<ol>\n<li><strong>Integrate AI-powered chatbots<\/strong> for natural language communication.<\/li>\n<li><strong>Implement a recommendation system<\/strong> for energy optimization.<\/li>\n<li><strong>Add blockchain for enhanced security<\/strong> in IoT communications.\u00a0<\/li>\n<\/ol>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\">\n<p>import paho.mqtt.client as mqtt<br \/>\nimport RPi.GPIO as GPIO<br \/>\nimport Adafruit_DHT<br \/>\nimport json<br \/>\nimport time<br \/>\nfrom tensorflow.keras.models import load_model<\/p>\n<p># &#8212; GPIO Setup &#8212;<br \/>\nGPIO.setmode(GPIO.BCM)<br \/>\nrelay_pins = {<br \/>\n&#8220;light&#8221;: 17,<br \/>\n&#8220;fan&#8221;: 27,<br \/>\n&#8220;appliance&#8221;: 22<br \/>\n}<br \/>\nfor pin in relay_pins.values():<br \/>\nGPIO.setup(pin, GPIO.OUT)<br \/>\nGPIO.output(pin, GPIO.LOW)<\/p>\n<p># &#8212; Sensor Setup &#8212;<br \/>\nsensor = Adafruit_DHT.DHT22<br \/>\nsensor_pin = 4 # GPIO pin for temperature and humidity sensor<\/p>\n<p># &#8212; Machine Learning Model &#8212;<br \/>\nmodel = load_model(&#8220;energy_predictor.h5&#8221;) # Pretrained model for energy prediction<\/p>\n<p>def predict_energy(temperature, humidity):<br \/>\n# Example preprocessing of data for prediction<br \/>\ninput_data = [[temperature, humidity]]<br \/>\nprediction = model.predict(input_data)<br \/>\nreturn prediction[0][0]<\/p>\n<p># &#8212; MQTT Setup &#8212;<br \/>\nbroker = &#8220;mqtt.example.com&#8221;<br \/>\nport = 1883<br \/>\ntopic_subscribe = &#8220;home\/automation\/control&#8221;<br \/>\ntopic_publish = &#8220;home\/automation\/status&#8221;<\/p>\n<p>def on_connect(client, userdata, flags, rc):<br \/>\nprint(&#8220;Connected to MQTT Broker!\\n&#8221;)<br \/>\nclient.subscribe(topic_subscribe)<\/p>\n<p>def on_message(client, userdata, msg):<br \/>\ndata = json.loads(msg.payload)<br \/>\ndevice = data.get(&#8220;device&#8221;)<br \/>\naction = data.get(&#8220;action&#8221;)<br \/>\nif device in relay_pins:<br \/>\nGPIO.output(relay_pins[device], GPIO.HIGH if action == &#8220;on&#8221; else GPIO.LOW)<br \/>\nprint(f&#8221;{device} turned {action}&#8221;)<br \/>\nclient.publish(topic_publish, json.dumps({&#8220;device&#8221;: device, &#8220;status&#8221;: action}))<br \/>\nelse:<br \/>\nprint(&#8220;Unknown device&#8221;)<\/p>\n<p>client = mqtt.Client()<br \/>\nclient.on_connect = on_connect<br \/>\nclient.on_message = on_message<\/p>\n<p>client.connect(broker, port, 60)<\/p>\n<p># &#8212; Main Loop &#8212;<br \/>\ntry:<br \/>\nclient.loop_start()<br \/>\nwhile True:<br \/>\n# Read sensor data<br \/>\nhumidity, temperature = Adafruit_DHT.read_retry(sensor, sensor_pin)<br \/>\nif humidity and temperature:<br \/>\nprint(f&#8221;Temp: {temperature:.1f}C, Humidity: {humidity:.1f}%&#8221;)<br \/>\nenergy_prediction = predict_energy(temperature, humidity)<br \/>\nprint(f&#8221;Predicted Energy Usage: {energy_prediction:.2f} kWh&#8221;)<\/p>\n<p># Publish sensor data<br \/>\nsensor_data = {<br \/>\n&#8220;temperature&#8221;: temperature,<br \/>\n&#8220;humidity&#8221;: humidity,<br \/>\n&#8220;energy_prediction&#8221;: energy_prediction<br \/>\n}<br \/>\nclient.publish(topic_publish, json.dumps(sensor_data))<br \/>\nelse:<br \/>\nprint(&#8220;Failed to retrieve sensor data&#8221;)<br \/>\ntime.sleep(10)<br \/>\nexcept KeyboardInterrupt:<br \/>\nprint(&#8220;Exiting&#8230; Cleaning up GPIO&#8221;)<br \/>\nGPIO.cleanup()<br \/>\nclient.loop_stop()<br \/>\nclient.disconnect()<\/p>\n<p>Here is the implementation for a &#8220;College and Home Automation System&#8221; using IoT with MQTT for communication, Raspberry Pi for hardware control, and a TensorFlow model for energy prediction.<\/p>\n<p>The script includes:<\/p>\n<ul>\n<li>GPIO setup for controlling devices (lights, fan, appliances).<\/li>\n<li>Sensor integration for temperature and humidity.<\/li>\n<li>Energy prediction using a machine learning model.<\/li>\n<li>MQTT setup for remote control and data exchange.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>PROJECT \u2013 REPORT College and Home Automation System Project Using IOT (Python &amp; Machine Learning) COLLEGE AUTOMATION SYSTEM This report introduces the management system which is designed to automate the entire operations of a college and in reducing time in activities using centralized data handling and paperless work with reduced manpower. This Desktop Application has [&hellip;]<\/p>\n","protected":false},"author":49,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3790,3795,3798],"tags":[3786,3787,3788,3789,3791,3792,3793,3794,3796,3797,3799,3800],"class_list":["post-4522","post","type-post","status-publish","format-standard","hentry","category-college-automation-system-project","category-home-automation-using-arduino","category-home-automation-using-iot","tag-arduino-based-home-automation","tag-automatic-car-parking-system-using-arduino","tag-automation-system-project","tag-college-and-home-automation-system-project","tag-college-automation-system-project","tag-home-automation-system-project-using-iot-python-machine-learning","tag-home-automation-system-using-arduino","tag-home-automation-system-using-iot","tag-home-automation-using-arduino","tag-home-automation-using-iot","tag-home-automation-using-iot-ppt","tag-iot-based-home-automation-using-arduino"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/posts\/4522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/users\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/comments?post=4522"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/posts\/4522\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/media?parent=4522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/categories?post=4522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/drive\/wp-json\/wp\/v2\/tags?post=4522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}