def senddata(self): cn = db.createconnection() code = self.cmbcode.currentText() if code == "Select": msg.messagebox("Please select college code") else: branch = self.cmbbranch.currentText() if branch == "": msg.messagebox("Please select branch") else: if branch != "Select": clgname = self.lblname.text() year = self.yearbox.value() adm = self.passbox.value() querycheck = "select * from year_collegedetail where college_code=%s && Branch=%s && year=%s" cursor = cn.cursor() a = cursor.execute(querycheck, (code, branch, year)) if (a): msg.messagebox("This record already exsist") else: query = "insert into year_collegedetail(college_code,college_name,Branch,total_admission,year) values(%s,%s,%s,%s,%s)" cursor = cn.cursor() cursor.execute(query, (code, clgname, branch, adm, year)) cn.commit() msg.messagebox("Accepted") else: msg.messagebox("Select any branch")
def populatepassing(self): if self.comboBoxyear.currentText()!="Select": cn=db.createconnection() query="select passed from passratio where college_code=%s && branch=%s && year=%s" cursor=cn.cursor() cursor.execute(query,(self.clgcode,self.comboBoxbranch.currentText(),self.comboBoxyear.currentText())) totalrow=cursor.fetchone() if totalrow!=None: for data in totalrow: self.placed.setMaximum(int(data)) else: msg.messagebox("Select year")
def senddata(self): cn = db.createconnection() code = self.cmbcode.currentText() if code == "Select": msg.messagebox("Please select college code") else: branch = self.cmbbranch.currentText() if branch != "Select": clgname = self.lblname.text() year = self.cmbyear.currentText() passs = self.passbox.value() querycheck = "select * from passratio where college_code=%s && branch=%s && year=%s" cursor = cn.cursor() a = cursor.execute(querycheck, (code, branch, year)) if (a): msg.messagebox("This record already exsist") else: query1 = "select total_admission from year_collegedetail where college_code=%s && Branch=%s && year=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code, branch, year)) tota = cursor1.fetchall() for data in tota: a = int(data[0]) passrat = (passs * 100) // a query = "insert into passratio(college_code,college_name,branch,passed,year,passratio) values(%s,%s,%s,%s,%s,%s)" cursor = cn.cursor() cursor.execute( query, (code, clgname, branch, passs, year, passrat)) cn.commit() msg.messagebox("Accepted") else: msg.messagebox("Select any branch")
def signin(self): cn = db.createconnection() self.username = self.txtusername.text() self.password = self.txtpass.text() query = "select username,password from adminlogin where username=%s && password=%s" cursor = cn.cursor() a = cursor.execute(query, (self.username, self.password)) cursor.fetchone() if (a): print("okkk") self.showpage() else: m.messagebox("Inccorect details")
def populatetable(self): cn = db.createconnection() query = "select year,passratio from passratio where college_code=%s && branch=%s" cursor = cn.cursor() a = cursor.execute( query, (self.cmbcode.currentText(), self.cmbbranch.currentText())) if a: self.tbl.setRowCount(a) totalrow = cursor.fetchall() for rowno, rowdata in enumerate(totalrow): for colno, coldata in enumerate(rowdata): self.tbl.setItem(rowno, colno, QTableWidgetItem(str(coldata))) else: msg.messagebox("Record Not Found")
def fetch(self): self.txtuserid.setReadOnly(True) cn = db.createconnection() self.userid = self.txtuserid.text() query = "select Name,Email,Password from manager where UserId=%s" cursor = cn.cursor() a = cursor.execute(query, (self.userid)) totalrows = cursor.fetchall() if (a): for rowdata in totalrows: self.txtname.setText(rowdata[0]) self.txtemail.setText(rowdata[1]) self.txtpassword.setText(rowdata[2]) else: msg.messagebox("Invalid UserId")
def populatepassing(self): if self.cmbyear.currentText() != "Select": cn = db.createconnection() query = "select total_admission from year_collegedetail where college_code=%s && Branch=%s && year=%s" cursor = cn.cursor() cursor.execute( query, (self.cmbcode.currentText(), self.cmbbranch.currentText(), self.cmbyear.currentText())) totalrow = cursor.fetchone() if totalrow != None: for data in totalrow: self.passbox.setMaximum(int(data)) else: msg.messagebox("Select year")
def deleteacc(self): userid = self.txtuserid.text() cn = db.createconnection() query = "delete from manager where UserId=%s" cursor = cn.cursor() a = cursor.execute(query, (userid)) if (a): cn.commit() msgg = QMessageBox() msgg.setWindowTitle("Delete") msgg.setText("Record Deleted") msgg.setIcon(QMessageBox.Information) msgg.setStandardButtons(QMessageBox.Ok) msgg.buttonClicked.connect(self.dlgbutton) a = msgg.exec() else: msg.messagebox("UserId not found")
def sendotp(self): email = self.txtemail.text() if email == "": msg.messagebox("Email Id cannot be Empty") else: if email == "*****@*****.**": self.otp = randint(1001, 9999) mail.sendemail( from_addr='*****@*****.**', to_addr_list=['*****@*****.**'], cc_addr_list=['*****@*****.**'], subject='OTP', message=str(self.otp), login='******', password='******') self.lblmsg.setText("OTP has been sent to your mail") self.txtotp.setReadOnly(False) else: msg.messagebox("Email Id not matched")
def up(self): ans=self.txtanswer.text() newpwd=self.txtnewpwd.text() con=self.txtconnewpwd.text() if ans=="cat": if newpwd==con: cn=db.createconnection() query="update adminlogin set password=%s where username=%s" name="admin" cursor=cn.cursor() cursor.execute(query,(newpwd,name)) cn.commit() self.cm=QMessageBox() self.cm.setWindowTitle("Password Change") self.cm.setIcon(QMessageBox.Information) self.cm.setText("Password Changed Successfully") self.cm.setStandardButtons(QMessageBox.Ok) q=self.cm.buttonClicked.connect(self.dlgbutton) self.cm.exec() else: msg.messagebox("Password doesnot match") else: msg.messagebox("Answer doesnot match")
def check(self): otpp = self.txtotp.text() if self.txtemail.text() == "": msg.messagebox("Please enter email") else: if otpp == "": msg.messagebox("Please enter OTP") else: if int(otpp) == self.otp: self.aaa = adminreset() self.aaa.show() self.close() else: msg.messagebox("OTP doesnot match")
def insertcollege(self): self.clg_name= self.txtcollegename.text() if self.clg_name=="": msg.messagebox("Please enter College Name") else: self.clg_code= self.txtcollegecode.text() if self.clg_code == "": msg.messagebox("Please enter College Code") else: self.aft=self.comboBox.currentText() # print(self.clg_name) # print(self.clg_code) # print(self.aft) con = db.createconnection() query = "insert into add_college(college_name,college_code,affilation) values(%s,%s,%s)" cursor = con.cursor() cursor.execute(query,(self.clg_name,self.clg_code,self.aft)) con.commit() msg.messagebox("College added") print("College Added")
def senddata(self): cn = db.createconnection() #code = self.comboBoxcode.currentText() if self.clgcode=="Select": msg.messagebox("Please select college code") else: branch=self.comboBoxbranch.currentText() if branch!="Select": clgname=self.clgname.text() year=self.comboBoxyear.currentText() place=self.placed.value() querycheck = "select college_code from passratio where branch=%s && year=%s" cursor=cn.cursor() a=cursor.execute(querycheck,(branch,year)) query="update passratio set placed=%s where college_code=%s && branch=%s && year=%s " cursor=cn.cursor() cursor.execute(query,(place,self.clgcode,branch,year)) cn.commit() msg.messagebox("{0} Students Placed in {1} {2}".format(place,branch,year)) else: msg.messagebox("Select any branch")