Esempio n. 1
0
def getAllSuppliers():
    if request.method == 'POST':
        return SuppliersHandler().insertSupplierJson(request.json)
    else:
        if not request.args:
            return SuppliersHandler().getAllSuppliers()
        else:
            return SuppliersHandler().searchSuppliers(request.args)
def getAllSuppliers():
    """ Gets all suppliers """
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getAllSuppliers()
        else:
            return SuppliersHandler().searchSuppliers(request.args)
    elif request.method == 'POST':
        return SuppliersHandler().insert(request.get_json())
    else:
        return jsonify(Error="Method not allowed. "), 405
def getStocksBySid(sid):
    """ Get all stocks pertaining to a given supplier. """
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getStocksBySupplierId(sid)
        else:
            # TODO: Search by stocks parameter
            return SuppliersHandler().searchStocks(sid, request.args)
            pass
    else:
        return jsonify(Error="Method not allowed. "), 405
def getAnnouncementsBySid(sid):
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getAvailabilityAnnouncementsBySID(sid)
        else:
            pass
    elif request.method == 'POST':
        return SuppliersHandler().insertAvailabilityAnnouncementbySID(
            request.get_json(), sid)
    else:
        return jsonify(Error="Method not allowed. "), 405
def getAnnouncementDetailsByAnn_Id(sid, ann_id):  #addedby H Jan 25 7 24 PM
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getAvailabilityAnnouncementByIds(
                sid, ann_id)
        else:
            pass
    elif request.method == 'POST':
        return SuppliersHandler().insertAvailabilityAnnouncementDetailByAnn_Id(
            request.get_json(), ann_id)
    else:
        return jsonify(Error="Method not allowed. "), 405
Esempio n. 6
0
def getSupplierById(supplierid):
    if request.method == 'GET':
        return SuppliersHandler().getSupplierById(supplierid)
    elif request.method == 'PUT':
        pass
    elif request.method == 'DELETE':
        pass
    else:
        return jsonify(Error="Method not allowed"), 405
def getAddressBySid(sid):
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getAddressBySid(sid)
        else:
            pass
    elif request.method == 'POST':
        pass
    else:
        return jsonify(Error="Method not allowed. "), 405
def getTransactionsBySid(sid):
    """ Get all transactions pertaining to a given supplier. """
    if request.method == 'GET':
        if not request.args:
            return SuppliersHandler().getTransactionsBySupplierId(sid)
        else:
            # TODO: Search by transaction parameters
            pass
    else:
        return jsonify(Error="Method not allowed. "), 405
def getSuppliersCountPerRegion():
    if request.method == 'GET':
        return SuppliersHandler().getSuppliersCountPerRegion()
    else:
        pass
def getSupplierTransactionById(sid, tid):
    """ Get all transactions pertaining to a given supplier. """
    if request.method == 'GET':
        return SuppliersHandler().getSupplierTransactionById(sid, tid)
    else:
        return jsonify(Error="Method not allowed. "), 405
Esempio n. 11
0
def getResourcesBySupplierId(supp_ID):
    return SuppliersHandler().getResourcesBySupplierId(supp_ID)
def getSupplierCount():
    """ Returns the ammount of suppliers"""
    if request.method == 'GET':
        return SuppliersHandler().count()
    else:
        return jsonify(Error="Method not allowed. "), 405
Esempio n. 13
0
def getAccountsBySupp_ID(supp_ID):
    if request.method == 'POST':
        return AccountsHandler.insertAccount(supp_ID, request.form)
    else:
        return SuppliersHandler().getAccountsBySupp_ID(supp_ID)
Esempio n. 14
0
def getSuppliersByResourceCategory(category):
    return SuppliersHandler().getSuppliersByResourceCategory(category)
Esempio n. 15
0
def getSupplierById(supp_ID):
    return SuppliersHandler().getSuppliersById(supp_ID)
def getSupplierById(sid):
    """ Gets a supplier by supplier id. """
    if request.method == 'GET':
        return SuppliersHandler().getSupplierById(sid)
    else:
        return jsonify(Error="Method not allowed. "), 405
Esempio n. 17
0
def getAllSuppliers():
    if not request.args:
        return SuppliersHandler().getAllSuppliers()
    else:
        return SuppliersHandler().searchSuppliers(request.args)