예제 #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)
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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
예제 #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
예제 #7
0
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
예제 #8
0
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
예제 #9
0
def getSuppliersCountPerRegion():
    if request.method == 'GET':
        return SuppliersHandler().getSuppliersCountPerRegion()
    else:
        pass
예제 #10
0
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
예제 #11
0
def getResourcesBySupplierId(supp_ID):
    return SuppliersHandler().getResourcesBySupplierId(supp_ID)
예제 #12
0
def getSupplierCount():
    """ Returns the ammount of suppliers"""
    if request.method == 'GET':
        return SuppliersHandler().count()
    else:
        return jsonify(Error="Method not allowed. "), 405
예제 #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)
예제 #14
0
def getSuppliersByResourceCategory(category):
    return SuppliersHandler().getSuppliersByResourceCategory(category)
예제 #15
0
def getSupplierById(supp_ID):
    return SuppliersHandler().getSuppliersById(supp_ID)
예제 #16
0
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
예제 #17
0
def getAllSuppliers():
    if not request.args:
        return SuppliersHandler().getAllSuppliers()
    else:
        return SuppliersHandler().searchSuppliers(request.args)