示例#1
0
def ReturnButton(resid):
    res_status_ds = ResourceStatus_DataService()
    resource_id = int(resid)

    logging.debug("resource_id from webpage is: " + str(resource_id))
    ############################################################################################################

    res_status_ds.return_button(resource_id)
    # return str(resource_id)
    return redirect("/ResourceStatus")
示例#2
0
def button_return_demo(resid):
    res_status_ds = ResourceStatus_DataService()

    resource_id = int(resid)

    logging.debug("resource_id from webpage is: " + str(resource_id))

    ############################################################################################################
    res_status_ds.cancelrepair_button(resource_id)

    return redirect("/ResourceStatus")
示例#3
0
def button_demo():
    res_status_ds = ResourceStatus_DataService()

    resource_in_use_table_data = res_status_ds.populate_res_in_use_tabledata(
        "james")

    assert isinstance(resource_in_use_table_data, list)

    logging.debug(resource_in_use_table_data)

    return render_template('buttondemo.html', items=resource_in_use_table_data)
示例#4
0
def ResourceRequestByMeCancelButton(resid, indcidentid):
    res_status_ds = ResourceStatus_DataService()

    resource_id = int(resid)
    indicent_id = int(indcidentid)

    logging.debug("resource_id from webpage is: " + str(resource_id))
    logging.debug("incident_id from webpage is: " + str(indicent_id))
    ############################################################################################################

    res_status_ds.cancel_button(resource_id, indicent_id)

    return redirect("/ResourceStatus")
示例#5
0
def RequestReceivedByMeRejectButton(resid, indcidentid):
    res_status_ds = ResourceStatus_DataService()

    resource_id = int(resid)
    indicent_id = int(indcidentid)

    logging.debug("resource_id from webpage is: " + str(resource_id))
    logging.debug("incident_id from webpage is: " + str(indicent_id))

    # for debugging
    # return str(resource_id) + ': ' + str(indicent_id)

    res_status_ds.reject_button(resource_id, indicent_id)
    return redirect("/ResourceStatus")
示例#6
0
def RequestReceivedByMeDeployButton(resid, erd, indcidentid):
    res_status_ds = ResourceStatus_DataService()

    resource_id = int(resid)
    endDate = str(erd)
    username = str(session['username'])
    indicent_id = int(indcidentid)

    logging.debug("resource_id from webpage is: " + str(resource_id))
    logging.debug("incident_id from webpage is: " + str(endDate))
    logging.debug("resource_id from webpage is: " + str(username))
    logging.debug("incident_id from webpage is: " + str(indicent_id))

    # for debugging
    # return str(resource_id) + ': ' + str(indicent_id) + ': ' + username + ': ' + endDate

    res_status_ds.deploy_button(resource_id, endDate, username, indicent_id)
    return redirect("/ResourceStatus")
示例#7
0
def ResourceStatus():
    error = None
    username = str(session['username'])
    resource_status_DS = ResourceStatus_DataService()

    itemsInUse = resource_status_DS.populate_res_in_use_tabledata(username)

    print itemsInUse
    requestedByMe = resource_status_DS.res_request_by_username(username)

    receivededByMe = resource_status_DS.request_received_me(username)[0]
    # convert the previous to the list
    receivededByMeNew = []
    temp = []
    for i in receivededByMe:
        i = str(i)
        temp.append(i)
        if (len(temp) == 7):
            receivededByMeNew.append(temp)
            temp = []

    repairTable = resource_status_DS.repairtable(username)
    # print requestedByMe
    # print '-----'
    # print receivededByMe
    # print '-----'
    # print repairTable

    # return render_template('ResourceStatus.html', itemsInUse=itemsInUse,
    #                        requestedByMe=requestedByMe,
    #                        receivededByMeNew=receivededByMeNew,
    #                        repairTable=repairTable)

    if request.method == 'POST':
        if request.form['submit'] == 'BackToMainMenu':
            return redirect(url_for('mainMenu'))
        else:
            pass

    return render_template('ResourceStatus.html',
                           itemsInUse=itemsInUse,
                           requestedByMe=requestedByMe,
                           receivededByMeNew=receivededByMeNew,
                           repairTable=repairTable)
from src.data_service.ResourceStatus_Dataservice import ResourceStatus_DataService

rsd = ResourceStatus_DataService()

print rsd.populate_res_in_use_tabledata("james")

print rsd.return_button(4)

print rsd.cancel_button(44, 1)

print rsd.res_request_by_username("james")

print rsd.request_received_me("james")

print rsd.reject_button(42, 1)

print rsd.cancelrepair_button(3)

print rsd.deploy_button(4, '2018-03-02', "tom", 7)

print rsd.repairtable("james")