コード例 #1
0
ファイル: quote_dao.py プロジェクト: paulalex/upskilling
def delete_quote(quote_id):
    """Deletes a quote from the database.

    Args:
        quote_id: The id of the quote.
    """
    db.execute_update("delete from quote where quote_id = %s", (quote_id, ))
コード例 #2
0
def delete_contract_item(contract_item_id):
    """Deletes a contract item from the database.

    Args:
        contract_item_id: The id of the contract item.
    """
    db.execute_update("delete from contract_item where c_id = %s",
                      (contract_item_id, ))
コード例 #3
0
def delete_request(request_id):
    """Deletes a request from the database.

    Args:
        request_id: The id of the request.
    """
    db.execute_update("delete from request where request_id = %s",
                      (request_id, ))
コード例 #4
0
def update_contract_item(contract_item_id, mpan):
    """Updates a contract item.

    Args:
        contract_item_id: The id of the contract item.
        mpan: The meter identifier.
    """
    db.execute_update("update contract_item set mpan = %s where c_id = %s", (
        mpan,
        contract_item_id,
    ))
コード例 #5
0
def create_request(email, customer_reference):
    """Creates a request in the the database.

    Args:
        email: The email of the requesting company.
        customer_reference: The customer reference number.
    """
    db.execute_update("insert into request values(DEFAULT, %s, %s)", (
        email,
        customer_reference,
    ))
コード例 #6
0
ファイル: quote_dao.py プロジェクト: paulalex/upskilling
def create_quote(request_id, company_reg_number, registered_postcode):
    """Creates a quote in the the database.

    Args:
        request_id: The id of the request this quote belongs to.
        company_reg_number: The companies registration number.
        registered_postcode: The conpanies postcode.
    """
    db.execute_update("insert into quote values(DEFAULT, %s, %s, %s)", (
        request_id,
        company_reg_number,
        registered_postcode,
    ))
コード例 #7
0
def create_contract_item(quote_id, mpan):
    """Creates a contract item in the the database.

    Args:
        quote_id: The id of the quote.
        mpan: The meter identifier.
    
    Returns:
        All quotes from the database.
    """
    db.execute_update("insert into contract_item values(DEFAULT, %s, %s)", (
        quote_id,
        mpan,
    ))
コード例 #8
0
def update_request(request_id, email, customer_reference):
    """Updates a request.

    Args:
        request_id: The id of the request.
        mpan: The meter identifier.
    """
    db.execute_update(
        "update request set customer_email = %s, customer_reference = %s where request_id = %s",
        (
            email,
            customer_reference,
            request_id,
        ))
コード例 #9
0
ファイル: quote_dao.py プロジェクト: paulalex/upskilling
def update_quote(quote_id, company_reg_number, registered_postcode):
    """Updates a quote.

    Args:
        quote_id: The id of the quote.
        company_reg_number: The company registration number.
        registered_postcode: The registered postcode.
    """
    db.execute_update(
        "update quote set company_reg_number = %s, registered_postcode = %s \
    where quote_id = %s", (
            company_reg_number,
            registered_postcode,
            quote_id,
        ))