Exemplo n.º 1
0
 def hospitalexist(self, hemail):
     SqlClient.startDBConnection(self)
     res = self.cursor.callproc('hospitalexist', [hemail, 0])
     if (res[1]):
         SqlClient.closeDBConnection(self)
         return "Exist"
     else:
         SqlClient.closeDBConnection(self)
         return "NotExist"
Exemplo n.º 2
0
 def getPassword(self):
     try:
         SqlClient.startDBConnection(self)
         self.cursor.callproc('validatePassword')
         res = self.cursor.stored_results()
         for result in res:
             passwordRules = result.fetchall()
             print(passwordRules)
             SqlClient.closeDBConnection(self)
             return passwordRules
     except Exception as err:
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 3
0
 def hospitalRegistration(self, hospital):
     try:
         SqlClient.startDBConnection(self)
         self.cursor.callproc('hospitalregistration', [
             hospital.hospitalName, hospital.emailID, hospital.phone,
             hospital.address, hospital.province, hospital.city,
             hospital.password, hospital.data
         ])
         self.connection.commit()
         SqlClient.closeDBConnection(self)
         return True
     except Exception as err:
         SqlClient.closeDBConnection(self)
         print(err)
         return False
Exemplo n.º 4
0
 def updateReport(self, emailID, userType, report, logger):
     self.logger = logger
     try:
         self.logger.info(" updateReport logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('updatereports', [emailID, userType, report])
         self.connection.commit()
         SqlClient.closeDBConnection(self)
         self.logger.info("updateReport DBconn closed")
         return True
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.info(" updateReport logger initialized")
         return err
Exemplo n.º 5
0
 def setRequestsStatus(self, requestID, requeststate, logger):
     self.logger = logger
     try:
         self.logger.info("setRequestsStatus logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('updaterequeststate',
                              [requestID, requeststate])
         self.connection.commit()
         SqlClient.closeDBConnection(self)
         self.logger.debug("setRequestsStatus DBconn closed")
         return True
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.debug("setRequestsStatus DBconn closed")
         return False
Exemplo n.º 6
0
 def getDonorList(self, hname, logger):
     self.logger = logger
     try:
         self.logger.info("getDonorList logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('gethospitaldonorlist', [hname])
         res = self.cursor.stored_results()
         for result in res:
             donorlist = result.fetchall()
             SqlClient.closeDBConnection(self)
             self.logger.debug("getDonorList DBconn closed")
             return donorlist
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.info("getDonorList DBconn closed")
         return err
Exemplo n.º 7
0
 def createRequest(self, donorEmail, recipientEmail, donatingOrgan,
                   donorHospital, logger):
     self.logger = logger
     try:
         self.logger.info("createRequest logger initilaized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc(
             'createrequest',
             [donorEmail, recipientEmail, donatingOrgan, donorHospital, 0])
         self.connection.commit()
         SqlClient.closeDBConnection(self)
         self.logger.info("createRequest DB connection closed")
         return True
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.debug("createRequest DB connection closed")
         print(err)
         return False
Exemplo n.º 8
0
 def userRegistration(self, user):
     requestdate = datetime.datetime.today().strftime('%Y-%m-%d')
     try:
         SqlClient.startDBConnection(self)
         print("userRegistration")
         for item in user.organ:
             self.cursor.callproc('userregistration', [
                 user.first_name, user.last_name, user.phone_number,
                 user.email, user.sex, user.dob, user.address,
                 user.province, user.city, user.hospital, user.bloodgroup,
                 user.usertype, requestdate, item
             ])
             self.connection.commit()
         SqlClient.closeDBConnection(self)
         return True
     except Exception as err:
         print(err)
         SqlClient.closeDBConnection(self)
         return False
Exemplo n.º 9
0
 def donorHospitalShowDonorProfile(self, donorEmail, logger):
     self.logger = logger
     try:
         self.logger.info(
             "donorHospitalShowDonorProfile logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('donorhospitalshowdonorprofile', [donorEmail])
         res = self.cursor.stored_results()
         for result in res:
             userdata = result.fetchall()
             if (userdata):
                 SqlClient.closeDBConnection(self)
                 self.logger.info(
                     "donorHospitalShowDonorProfile DBconn closed")
                 return userdata
             else:
                 self.logger.debug(
                     "donorHospitalShowDonorProfile returned None")
                 SqlClient.closeDBConnection(self)
                 self.logger.info(
                     "donorHospitalShowDonorProfile DBconn closed")
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.info("donorHospitalShowDonorProfile DBconn closed")
         return err
Exemplo n.º 10
0
 def showDonorOrgan(self, donorEmail, logger):
     self.logger = logger
     try:
         self.logger.info("showDonorOrgan logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('donorshoworgan', [donorEmail])
         res = self.cursor.stored_results()
         for result in res:
             userdata_organ = result.fetchall()
             for row in userdata_organ:
                 organ = row[0]
             if (userdata_organ):
                 SqlClient.closeDBConnection(self)
                 self.logger.info("showDonorOrgan DBconn closed")
                 return userdata_organ
             else:
                 self.logger.debug("showDonorOrgan returned None")
                 SqlClient.closeDBConnection(self)
                 self.logger.info("showDonorOrgan DBconn closed")
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.info("donorHospitalShowDonorProfile DBconn closed")
         return err
Exemplo n.º 11
0
    def donorHospitalShowReceiverProfile(self, recipientEmail, logger):
        self.logger = logger
        try:
            SqlClient.startDBConnection(self)
            self.logger.info(
                "donorHospitalShowReceiverProfile logger initilized")

            self.cursor.callproc('donorhospitalshowreceiverprofile',
                                 [recipientEmail])
            res = self.cursor.stored_results()
            for result in res:
                userdata = result.fetchall()
                if (userdata):
                    SqlClient.closeDBConnection(self)
                    print("userdata", (userdata))
                    return userdata
                else:
                    return None
        except Exception as err:
            SqlClient.closeDBConnection(self)
            self.logger.error(err)
            return None
Exemplo n.º 12
0
 def getHospitalID(self, donorHospitalName):
     try:
         SqlClient.startDBConnection(self)
         self.cursor.callproc('getHospitalID', [donorHospitalName])
         res = self.cursor.stored_results()
         for result in res:
             hospital_email = result.fetchone()
             if (hospital_email):
                 SqlClient.closeDBConnection(self)
                 return hospital_email
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 13
0
 def getOpenRequestsStatus(self, recipientEmail):
     try:
         SqlClient.startDBConnection(self)
         self.cursor.callproc('recipientOpenRequestStatus',
                              [recipientEmail])
         res = self.cursor.stored_results()
         for result in res:
             requeststatusdata = result.fetchall()
             if (requeststatusdata):
                 SqlClient.closeDBConnection(self)
                 return requeststatusdata
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 14
0
 def getHospitalRecipientList(self, hname, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info("getHospitalRecipientList logger initilized")
         self.cursor.callproc('gethospitalreceiverlist', [hname])
         res = self.cursor.stored_results()
         for result in res:
             receiverlist = result.fetchall()
             if (receiverlist):
                 SqlClient.closeDBConnection(self)
                 return receiverlist
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 15
0
 def hospitalLoginAuthentication(self, hemail, hpass):
     try:
         SqlClient.startDBConnection(self)
         print("hospitalLoginAuthentication")
         self.cursor.callproc('hospitallogin', [hemail, hpass])
         res = self.cursor.stored_results()
         for result in res:
             hospitalauth = result.fetchall()
             if (hospitalauth):
                 SqlClient.closeDBConnection(self)
                 print("hospitalLoginAuthentication Close")
                 return hospitalauth
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         print(err)
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 16
0
 def getHospitalRequestList(self, emailID, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info("getHospitalRequestList called for emailID" +
                          emailID + "!!")
         self.cursor.callproc('requestlist', [emailID])
         res = self.cursor.stored_results()
         for result in res:
             requestlist = result.fetchall()
             if (requestlist):
                 self.logger.info("Values Fetched Successfully")
                 SqlClient.closeDBConnection(self)
                 return requestlist
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 17
0
 def receiverHospitalShowOrgan(self, recipientEmail, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info("receiverHospitalShowOrgan logger initilized")
         self.cursor.callproc('receiverhospitalshoworgan', [recipientEmail])
         res = self.cursor.stored_results()
         for result in res:
             userdata_organ = result.fetchall()
             for row in userdata_organ:
                 organ = row[0]
             if (userdata_organ):
                 SqlClient.closeDBConnection(self)
                 return userdata_organ
             else:
                 SqlClient.closeDBConnection(self)
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.error(err)
         return None
Exemplo n.º 18
0
 def organRequest(self, requestID, logger):
     self.logger = logger
     try:
         self.logger.info("organRequest logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('organrequest', [requestID])
         res = self.cursor.stored_results()
         for result in res:
             requestdata = result.fetchall()
             if (requestdata):
                 SqlClient.closeDBConnection(self)
                 self.logger.info("getOpenRequestData DBconn Closed")
                 return requestdata
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.info("getOpenRequestData DBconn Closed")
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         return None
Exemplo n.º 19
0
 def getHospitalName(self, hemail, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info(" getHospitalName logger intitlized")
         self.cursor.callproc('gethospitalname', [hemail])
         res = self.cursor.stored_results()
         for result in res:
             hname = result.fetchall()
             if (hname):
                 SqlClient.closeDBConnection(self)
                 self.logger.info(" getHospitalName DBconn closed")
                 return hname[0]
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.info(" getHospitalName DBconn closed")
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.error(err)
         return None
Exemplo n.º 20
0
 def recommendedDonorList(self, organ, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info("recommendedDonorList logger initilized")
         self.cursor.callproc('recommendeddonorlist', [organ])
         res = self.cursor.stored_results()
         for result in res:
             organ_data = result.fetchall()
             if (organ_data):
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("recommendedDonorList DBconn closed")
                 return organ_data
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("recommendedDonorList DBconn closed")
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.debug("recommendedDonorList DBconn closed")
         self.logger.error(err)
         return None
Exemplo n.º 21
0
 def getReports(self, emailID, userType, logger):
     self.logger = logger
     try:
         self.logger.info("getReports logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('getuserreports', [emailID, userType])
         res = self.cursor.stored_results()
         for result in res:
             userreports = result.fetchall()
             if (userreports):
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("getReports DBconn closed")
                 return userreports
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("getReports DBconn closed")
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.debug("getReports DBconn closed")
         self.logger.error(err)
         return False
Exemplo n.º 22
0
 def getOpenRequestsStatus(self, hospitalEmail, donorEmail, logger):
     self.logger = logger
     try:
         self.logger.info("getOpenRequestsStatus logger initialized")
         SqlClient.startDBConnection(self)
         self.cursor.callproc('donorOpenRequestStatus',
                              [hospitalEmail, donorEmail])
         res = self.cursor.stored_results()
         for result in res:
             requeststatusdata = result.fetchall()
             if (requeststatusdata):
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("getOpenRequestsStatus DBconn closed")
                 return requeststatusdata
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.debug("getOpenRequestsStatus DBconn closed")
                 return None
     except Exception as err:
         self.logger.error(err)
         SqlClient.closeDBConnection(self)
         self.logger.debug("getOpenRequestsStatus DBconn closed")
         return None
Exemplo n.º 23
0
 def getHospitalList(self, logger):
     self.logger = logger
     try:
         SqlClient.startDBConnection(self)
         self.logger.info("getHospitalList logger initilized")
         self.cursor.callproc('hospitallist')
         res = self.cursor.stored_results()
         for result in res:
             hospitallist = result.fetchall()
             for row in hospitallist:
                 hospitalEmail = row[0]
                 validateFlag = row[1]
             if (hospitallist):
                 SqlClient.closeDBConnection(self)
                 self.logger.info("getHospitalList DBConn Closed")
                 return hospitallist
             else:
                 SqlClient.closeDBConnection(self)
                 self.logger.info("getHospitalList DBConn Closed")
                 return None
     except Exception as err:
         SqlClient.closeDBConnection(self)
         self.logger.error(err)
         return None