コード例 #1
0
def fundVal():
    #1. Get DB connection
    connection = connectionfactory.getConnection()

    result = request.get_json(force=True)
    number = result.get('policyNumber')
    with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT fundValue FROM policydetails WHERE policyNumber = %s"
        cursor.execute(sql, number)
        fundValue = cursor.fetchone()
        fundValue = fundValue.get('fundValue')
        fundValue = json.dumps(fundValue)
        connection.commit()
    return jsonify({'status': 'OK', 'answer': fundValue})
コード例 #2
0
def prevPremium():
    #1. Get DB connection
    connection = connectionfactory.getConnection()

    result = request.get_json(force=True)
    number = result.get('policyNumber')
    with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT prevPremium FROM policydetails WHERE policyNumber = %s"
        cursor.execute(sql, number)
        previousPremium = cursor.fetchone()
        previousPremium = previousPremium.get('prevPremium')
        previousPremium = json.dumps(previousPremium)
        connection.commit()
    return jsonify({'status': 'OK', 'answer': previousPremium})
コード例 #3
0
def renewalStatus():
    #1. Get DB connection
    connection = connectionfactory.getConnection()

    result = request.get_json(force=True)
    number = result.get('policyNumber')
    with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT renewalStatus FROM policydetails WHERE policyNumber = %s"
        cursor.execute(sql, number)
        renewalStatus = cursor.fetchone()
        renewalStatus = renewalStatus.get('renewalStatus')
        renewalStatus = json.dumps(renewalStatus)
        connection.commit()
    return jsonify({'status': 'OK', 'answer': renewalStatus})
コード例 #4
0
def maturityBenefit():
    #1. Get DB connection
    connection = connectionfactory.getConnection()

    result = request.get_json(force=True)
    number = result.get('policyNumber')
    with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT maturityBenefit FROM policydetails WHERE policyNumber = %s"
        cursor.execute(sql, number)
        maturity = cursor.fetchone()
        maturity = maturity.get('maturityBenefit')
        maturity = json.dumps(maturity)
        print(maturity)
        connection.commit()
    return jsonify({'status': 'OK', 'answer': maturity})
コード例 #5
0
def contact():
    #1. Get DB connection
    connection = connectionfactory.getConnection()

    #2. Get request object values
    result = request.get_json(force=True)
    name = result.get('name')
    phone = result.get('phone')
    print "Request Object" + str(result)

    #3. Save request Object.
    with connection.cursor() as cursor:
        sql = "INSERT INTO customer (Namez,Phone) VALUES (%s, %s)"
        cursor.execute(sql, (name, phone))
        connection.commit()
        return "Saved successfully."