Esempio n. 1
0
def getProfileData():
    try:
        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        mycursor.execute("SELECT * FROM personal_profile;")

        allprofiles = mycursor.fetchall()

        return allprofiles
    except Exception:
        raise
Esempio n. 2
0
def getSubscriptionsListDB():
    try:
        cnx=connectToDatabase()
        mycursor = cnx.cursor()
        mycursor.execute("select subscriptionKey,subscriptionName,subscriptionDescription,subscriptionCost from subscription")
        
        result = mycursor.fetchall()
        
        cnx.close()
        
        return result
    except Exception as e:
        logging.error("Error in retrieving data from database "+str(e))
        raise
Esempio n. 3
0
def getProfileDataFromDbById(from_dbid):
    try:

        cnx = connectToDatabase()
        mycursor = cnx.cursor()
        sql = (
            "SELECT * FROM personal_profile WHERE ID = {};".format(from_dbid))

        mycursor.execute(sql)

        profilebyid = mycursor.fetchall()

        return profilebyid
    except Exception:
        raise
Esempio n. 4
0
def getLookUpValues(lookupid):
    try:
        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        mycursor.execute(
            "select lookupname from lookupmaster where lookupid={} and lookupmasterid != 0"
            .format(lookupid))

        result = mycursor.fetchall()

        cnx.close()

        return result

    except Exception as e:
        logging.error("Error in retrieving lookUpValues " + str(e))
        raise
Esempio n. 5
0
def getLookUpID(lookupname):
    try:
        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        mycursor.execute(
            "select lookupid from lookupmaster where lookupname='{}'".format(
                lookupname))

        result = mycursor.fetchall()

        cnx.close()

        return result

    except Exception as e:
        logging.error("Error in retrieving lookUpId " + str(e))
        raise
Esempio n. 6
0
def getPersonalProfileQuestionsDB():
    try:
        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        mycursor.execute(
            "select profqname,profqtype,profqorder,profqkey,profqselection from profquestion where profqstatus='A'"
        )

        result = mycursor.fetchall()

        cnx.close()

        return result
    except Exception as e:
        logging.error("Error in retrieving Personal Profile questions " +
                      str(e))
        raise
Esempio n. 7
0
def updateProfileDataFromDbById(id, data):
    try:

        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        sql = ("UPDATE personal_profile SET registeredmobile = '" +
               data['registeredMobile'] + "',firstname = '" +
               data['firstName'] + "',lastname = '" + data['lastName'] +
               "',email = '" + data['email'] + "',marriedstatus = '" +
               data['marriedStatus'] + "',age = '" + data['age'] +
               "',addr1 = '" + data['addrLine1'] + "',addr2 = '" +
               data['addrLine2'] + "',addr3 = '" + data['addrLine3'] +
               "',addr4 = '" + data['addrLine4'] + "',occupation = '" +
               data['occupation'] + "' WHERE id = {};".format(id))

        mycursor.execute(sql)
        cnx.commit()
    except Exception:
        raise
Esempio n. 8
0
def savePersonalProfileDB(dataObj):
    try:
        cnx = connectToDatabase()
        mycursor = cnx.cursor()

        sql = "INSERT INTO personal_profile (registeredmobile, firstname, lastname, email, marriedstatus, age, addr1, addr2, addr3,addr4,occupation) VALUES (%s, %s,%s, %s,%s, %s,%s, %s, %s, %s, %s)"
        #dataObj['registeredmobile']
        val = (dataObj['registeredMobile'], dataObj['firstName'],
               dataObj['lastName'], dataObj['email'], dataObj['marriedStatus'],
               dataObj['age'], dataObj['addrLine1'], dataObj['addrLine2'],
               dataObj['addrLine3'], dataObj['addrLine4'],
               dataObj['occupation'])

        mycursor.execute(sql, val)

        cnx.commit()

        cnx.close()
    except Exception as e:
        logging.error("Error in saving Personal Profile " + str(e))
        raise