def absents(StdID,SecID):
     try:
          con = DB_OP.connect()
          cur=con.cursor()
          cur.execute("select absents from attendance where StdID=%s AND SecID=%s"%(StdID,SecID))
          return cur.fetchall()
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          DB_OP.disconnect()
def att(StdID,SecID,absents="NULL",RegDate="NULL"):
     try:
          con = DB_OP.connect()
          cur=con.cursor()
          cur.execute("""INSERT INTO attendance (StdID,SecID,absents,RegDate) VALUES(%s,%s,%s,%s)"""%(StdID,SecID,absents,RegDate))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          con.commit()
          DB_OP.disconnect()
def std(StdID,FName="NULL",LName="NULL",phone_no="NULL",Email="NULL"):
     try:
          con=DB_OP.connect()
          cur=con.cursor()
          cur.execute("""INSERT INTO students (StdID,FName,LName,phone_no,Email) VALUES(%s,%s,%s,%s,%s)"""%(StdID,FName,LName,phone_no,Email))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          con.commit()
          DB_OP.disconnect()
def delete(StdID,SecID):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("DELETE FROM attendance WHERE StdID=%s AND SecID =%s"%(StdID,SecID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
def update(StdID,SecID,NStdID,NSecID,absents,RegDate):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.attendance SET attendance.StdID=%s,attendance.SecID=%s,attendance.absents=%s,attendance.RegDate=%s WHERE attendance.StdID=%s AND attendance.SecID=%s"%(NStdID,NSecID,absents,RegDate,StdID,SecID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
def update(StdID,SecID,NStdID,NSecID,FirstExamMark,SecondExamMark,PartisMark,FinalExamMark):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.marks SET StdID=%d,SecID=%d,FirstExamMark=%d,SecondExamMark=%d,PartisMark=%d,FinalExamMark=%d WHERE marks.StdID=%d AND marks.SecID=%d"%(NStdID,NSecID,FirstExamMark,SecondExamMark,PartisMark,FinalExamMark,StdID,SecID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
def update(StdID,NStdID,FName,LName,phone_no,Email):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.students SET StdID=%s,FName=%s,LName=%s,Phone_no =%s,Email=%s WHERE students.StdID=%s"%(NStdID,FName,LName,phone_no,Email,StdID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
def Fmark(StdID,SecID,FirstExamMark="NULL"):
     try:
          con=DB_OP.connect()
          cur=con.cursor()
          cur.execute("""INSERT INTO marks (StdID,SecID,FirstExamMark) VALUES(%d,%d,%d)"""%(StdID,SecID,FirstExamMark))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          con.commit()
          DB_OP.disconnect()
def Fimark(StdID,SecID,FinalExamMark="NULL"):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.marks SET FinalExamMark=%d WHERE marks.StdID=%d AND marks.SecID=%d"%(FinalExamMark,StdID,SecID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
Ejemplo n.º 10
0
def sec(SecID,SubjID,InstID,Name="NULL"):
     try:
          con = DB_OP.connect()
          cur=con.cursor()
          cur.execute("""INSERT INTO sections (SecID,SubjID,InstID,Name) VALUES(%s,%s,%s,%s)"""%(SecID,Name,SubjID,InstID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          con.commit()
          DB_OP.disconnect()
def subj(SubjID,Name="NULL",description="NULL"):
     try:
          con = DB_OP.connect()
          cur=con.cursor()
          cur.execute("""INSERT INTO subjects (SubjID,Name,description) VALUES(%s,%s,%s)"""%(SubjID,Name,description))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          con.commit()
          DB_OP.disconnect()
def update(SubjID,NSubjID,Name,description):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.subjects SET SubjID=%s,Name=%s,description=%s WHERE subjects.SubjID=%s"%(NSubjID,Name,description,SubjID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
def update(InstID,NInstID,FName="NULL",LName="NULL",phone_no="NULL",Email="NULL"):
     try:
          edit = DB_OP.connect()
          cur=edit.cursor()
          cur.execute("UPDATE sts.instructors SET InstID=%s,FName=%s,LName=%s,Phone_no =%s,Email=%s WHERE instructors.InstID=%s"%(NInstID,FName,LName,phone_no,Email,InstID))
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     finally:
          edit.commit()
          DB_OP.disconnect()
Ejemplo n.º 14
0
def query():
     try:
          con=DB_OP.connect()
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
     Q=con.cursor()
     Q.execute("select * from attendance")
     return Q.fetchall()
def querymarks(StdID,SecID):
     try:
          con=DB_OP.connect()
          Q=con.cursor()
          Q.execute("select * from marks WHERE StdID =%d AND SecID=%d"%(StdID,SecID))
          x= Q.fetchall()
          return x 
     except MySQLdb.Error as err:
          print("Something went wrong: {}".format(err[1]))
Ejemplo n.º 16
0
import sec_op

print """
                      ############################################
                      #                                          #  
                      #    Welcome To Student Tracking System    #
                      #                                          #
                      ############################################
"""
while True:
     CNDB=raw_input("To create your database please press 1 , If you already have a database press 2 \n")
     CNDB="\""+CNDB+"\""
     if  "1" not in CNDB and "2" not in CNDB:
          print "Sorry invalid input"
     if "1" in CNDB:
          DB_OP.initializing()
          break
     elif "2" in CNDB :
          break
     
while True:
     print """
Please select your category:
(1) Instructors operations
(2) Students operations
(3) Subjects operations
(4) Sections operations
(5) Attendance operations
(6) Marks operations
(7) Make your own MySQL statement
(8) Backup your DataBase