def updateCourse(courseObj):
    con = util.getCon()
    try:
        sno = getattr(courseObj, 'sno')
        print sno
        instituteId = domain.Institute.instId  # act as foreignKey. domain is package in which Institute is class andwe get static variable instId
        courseName = getattr(courseObj, 'courseName')
        courseId = getattr(courseObj, 'courseId')
        courseFee = getattr(courseObj, 'courseFee')
        sql = ""
        sql = sql + " update course set courseName='" + str(
            courseName) + "' , courseId = '" + str(
                courseId) + "', courseFee='" + str(
                    courseFee) + "' where sno='" + str(sno) + "'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully course has been updated")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to the update the course ")
        return False
def addStudentService(stObj):   
    con = util.getCon()
    try:
        instituteId = domain.Institute.instId # act as foreignKey. domain is package in which Institute is class andwe get static variable instId 
        studentName = getattr(stObj,'studentName')
        studentPhone = getattr(stObj,'studentPhone')
        studentEmail = getattr(stObj,'studentEmail')
        studentAddress = getattr(stObj,'studentAddress')
        courseName = getattr(stObj,'courseName')
        courseFee = getattr(stObj,'courseFee')
        studentAssignTeacher = getattr(stObj,'studentAssignTeacher')
        studentLoginId = getattr(stObj,'studentLoginId')
        studentPassword = getattr(stObj,'studentPassword')
        
        
        sql = "insert into student (instituteId,studentName,studentPhone,studentEmail,studentAddress,courseName,courseFee,studentAssignTeacher,studentLoginId,studentPassword) values ('" + str(instituteId) + "','" + str(studentName) + "','" + str(studentPhone) + "','" + str(studentEmail) +"','"+str(studentAddress)+"','"+str(courseName)+"','"+str(courseFee)+"','"+str(studentAssignTeacher)+"','"+str(studentLoginId)+"','"+str(studentPassword)+"')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Successfully student has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None,"Failed to add the student ")
        return False   
Beispiel #3
0
def updateTeacherService(trObj):
    con = util.getCon()
    try:
        teacherId = getattr(trObj, 'teacherId')
        teacherName = getattr(trObj, 'teacherName')
        teacherPhone = getattr(trObj, 'teacherPhone')
        teacherEmail = getattr(trObj, 'teacherEmail')
        teacherAddress = getattr(trObj, 'teacherAddress')
        teacherCourse = getattr(trObj, 'teacherCourse')
        teacherPayment = getattr(trObj, 'teacherPayment')
        teacherLoginId = getattr(trObj, 'teacherLoginId')

        sql = " update teacher set teacherName='" + str(
            teacherName) + "' , teacherPhone = '" + str(
                teacherPhone) + "', teacherEmail='" + str(
                    teacherEmail) + "', teacherAddress='" + str(
                        teacherAddress) + "', teacherCourse='" + str(
                            teacherCourse) + "', teacherPayment='" + str(
                                teacherPayment) + "',teacherLoginId='" + str(
                                    teacherLoginId
                                ) + "'  where teacherId='" + str(
                                    teacherId) + "'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully teacher has been Updated")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to update the teacher ")
        return False
Beispiel #4
0
def addTeacherService(trObj):
    con = util.getCon()
    try:
        instituteId = domain.Institute.instId  # act as foreignKey. domain is package in which Institute is class andwe get static variable instId
        teacherName = getattr(trObj, 'teacherName')
        teacherPhone = getattr(trObj, 'teacherPhone')
        teacherEmail = getattr(trObj, 'teacherEmail')
        teacherAddress = getattr(trObj, 'teacherAddress')
        teacherCourse = getattr(trObj, 'teacherCourse')
        teacherPayment = getattr(trObj, 'teacherPayment')
        teacherLoginId = getattr(trObj, 'teacherLoginId')
        teacherPassword = getattr(trObj, 'teacherPassword')
        print "hello"

        sql = "insert into teacher (instituteId,teacherName,teacherPhone,teacherEmail,teacherAddress,teacherCourse,teacherPayment,teacherLoginId,teacherPassword) values ('" + str(
            instituteId
        ) + "','" + str(teacherName) + "','" + str(teacherPhone) + "','" + str(
            teacherEmail) + "','" + str(teacherAddress) + "','" + str(
                teacherCourse) + "','" + str(teacherPayment) + "','" + str(
                    teacherLoginId) + "','" + str(teacherPassword) + "')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully teacher has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to add the teacher ")
        return False
def updateStudentPassword(password):
    con = util.getCon()
    try:
        studentId = domain.Student.studentId
        sql =" update student set studentPassword='******'  where studentId='"+str(studentId)+"'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        return True
    except:
        con.rollback()
        return False    
Beispiel #6
0
def updateStudentFee(remainingAmount,studentId):    
    con = util.getCon()
    try:
        sql =" update studentfee set remainingAmount='"+str(remainingAmount)+"'  where studentId='"+str(studentId)+"'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Successfully student fee has been paid")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None,"Failed to pay the student fee ")
        return False   
def updateStudentAttendence(studentId,date,present):
    con = util.getCon()
    try:
        instituteId = domain.Teacher.instId # act as foreignKey. domain is package in which Institute is class andwe get static variable instId 

        sql = "Update studentattendence set present='"+str(present)+"' where instituteId='"+str(instituteId)+"' AND studentId = '"+str(studentId)+"' AND date ='"+str(date)+"'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        return True
    except:
        con.rollback()
        return False
Beispiel #8
0
def updateTeacherPassword(password):
    con = util.getCon()
    try:
        teacherId = domain.Teacher.teacherId

        sql = " update teacher set teacherPassword='******'  where teacherId='" + str(teacherId) + "'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        return True
    except:
        con.rollback()
        return False
def saveStudentAttendence(sa):
    con = util.getCon()
    try:
        instituteId = domain.Teacher.instId # act as foreignKey. domain is package in which Institute is class andwe get static variable instId 
        studentId = getattr(sa, 'studentId')
        studentName = getattr(sa, 'studentName')
        date = getattr(sa, 'date')
        present = getattr(sa, 'present')
        
        
        sql = "insert into studentattendence (studentId,instituteId,studentName,date,present) values ('" + str(studentId) + "','" + str(instituteId) + "','" + str(studentName) + "','"+str(date)+"','"+ str(present) +"')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        return True
    except:
        con.rollback()
        return False
def  instituteRegistration(inst):
    con = util.getCon()
    try:
        name = getattr(inst, 'name')
        phone = getattr(inst, 'phone')
        address = getattr(inst, 'address')
        adminLoginId = getattr(inst, 'adminLoginId')
        adminPassword = getattr(inst, 'adminPassword')
        sql = "insert into institute (name,phone,address,adminLoginId,adminPassword) values('" + name + "','" + phone + "','" + address + "','" + adminLoginId + "','" + adminPassword + "')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Institute Registered successfully.Go to Login Page")
        return True
    except:
        JOptionPane.showMessageDialog(None,"Failed in Registration,Recheck the enterd Data")
        con.rollback()
        return False
Beispiel #11
0
def addStudentFeeService(stFeeObj):   
    con = util.getCon()
    try:
        studentId = getattr(stFeeObj,'studentId')
        studentName  = getattr(stFeeObj,'studentName')
        totalAmount = getattr(stFeeObj,'totalAmount')
        paidAmount = getattr(stFeeObj,'paidAmount')
        remainingAmount = getattr(stFeeObj,'remainingAmount')
        
        sql = "insert into studentfee (studentId,studentName,totalAmount,paidAmount,remainingAmount) values ('" + str(studentId) + "','" + str(studentName) + "','" + str(totalAmount) + "','" + str(paidAmount) +"','"+str(remainingAmount)+"')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Successfully student fee has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None,"Failed to add the student fee details ")
        return False   
def addCourseService(courseObj):
    con = util.getCon()
    try:
        instituteId = domain.Institute.instId  # act as foreignKey. domain is package in which Institute is class andwe get static variable instId
        courseName = getattr(courseObj, 'courseName')
        courseId = getattr(courseObj, 'courseId')
        courseFee = getattr(courseObj, 'courseFee')
        sql = sql + "insert into course"
        sql = sql + "(instituteId,courseName,courseId,courseFee) values ('" + str(
            instituteId) + "','" + str(courseName) + "','" + str(
                courseId) + "','" + str(courseFee) + "')"
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully course has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to add the course ")
        return False
def updateStudentService(stObj):   
    con = util.getCon()
    try:
        studentId = getattr(stObj,'studentId')
        studentName = getattr(stObj,'studentName')
        studentPhone = getattr(stObj,'studentPhone')
        studentEmail = getattr(stObj,'studentEmail')
        studentAddress = getattr(stObj,'studentAddress')
        studentAssignTeacher = getattr(stObj,'studentAssignTeacher')
        studentLoginId = getattr(stObj,'studentLoginId')
        
        sql =" update student set studentName='"+str(studentName)+"' , studentPhone = '"+str(studentPhone)+"', studentEmail='"+str(studentEmail)+"', studentAddress='"+str(studentAddress)+"', studentAssignTeacher='"+str(studentAssignTeacher)+"', studentLoginId='"+str(studentLoginId)+"'  where studentId='"+str(studentId)+"'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Successfully student has been updated")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None,"Failed to update the student ")
        return False