Esempio n. 1
0
def filter_employees(sender):
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    employees = reg.getFilteredEmployees(employeeFullName.value,
                                         managerDropDown.value,
                                         dropdownRole.value)
    employeeTable = EmployeeWithRole.showAsTable(employees)
    #display.display(employeeTable)
    display.display(display.HTML(employeeTable.to_html()))
Esempio n. 2
0
def search_Employee():
    display.clear_output()
    searchButtonE = widgets.Button(description="Search")
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    managerDropDown.options = reg.getManagerNames(1)
    dropdownRole.options = reg.getRoleNames(1)
    managerDropDown.value = managerDropDown.options[0]
    dropdownRole.value = dropdownRole.options[0]
    display.display(searchHeader)
    display.display(employeeFullName)
    display.display(managerDropDown)
    display.display(dropdownRole)
    display.display(searchButtonE)
    searchButtonE.on_click(filter_employees)
Esempio n. 3
0
def userLogin(sender):
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    managerDropDown.options = reg.getManagerNames(2)
    dropdownRole.options = reg.getRoleNames(2)
    employeeRoleFullName.options = reg.getEmployeeNames()
    #print (response)
    success = reg.getLoginInfo(loginName.value, loginPassword.value)
    reg.closeConnection()
    if (success == 0):  #admin
        viewEditEmployees()
    elif (success == 1):  #not an admin
        viewEmployees()
    else:
        print("Invalid Login information Check sql script!")
Esempio n. 4
0
def show_edit_employee_section():
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    employeeRoleFullName.options = reg.getEmployeeNames()
    managerDropDown.options = reg.getManagerNames(2)
    dropdownRole.options = reg.getRoleNames(2)
    curE = reg.getEmployeeData(employeeRoleFullName.value)
    managerDropDown.value = curE.getManagerName()
    employeeRoleStartDate.value = curE.getStartDate()
    employeeRoleEndDate.value = curE.getEndDate()
    dropdownRole.value = curE.getRoleName()
    reg.closeConnection()
    display.display(EmployeeRolesHeader)
    display.display(employeeRoleFullName)
    display.display(managerDropDown)
    display.display(dropdownRole)
    display.display(employeeRoleStartDate)
    display.display(employeeRoleEndDate)
Esempio n. 5
0
def editR(sender):
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    reg.updateRoles(EngineOilSpendingAmount.value, EngineOilBuyingAmount.value,
                    CrudeOilSpendingAmount.value, CrudeOilBuyingAmount.value,
                    MotorOilSpendingAmount.value, MotorOilBuyingAmount.value,
                    GasolineBuyingAmount.value, GasolineSpendingAmount.value,
                    PetroleumSpendingAmount.value, PetroleumBuyingAmount.value,
                    InternalSpendingBudget.value, dropdownRole.value)
    print("Updated role: " + str(dropdownRole.value))
    reg.closeConnection()
Esempio n. 6
0
def show_Roles():
    display.clear_output()
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    roles = reg.getAllRoles()
    reg.closeConnection()
    rolesTable = Role.showAsTable(roles)
    display.display(rolesTable)
Esempio n. 7
0
def registrar():
    global _registrar
    if not _registrar:
        from Registrar import Registrar
        _registrar = Registrar()

        import native
        _registrar.manage(native, native.format(), native.extensions())

        import chemkin
        _registrar.manage(chemkin, chemkin.format(), chemkin.extensions())

        import ckml
        _registrar.manage(ckml, ckml.format(), ckml.extensions())

    return _registrar
Esempio n. 8
0
def show_Employee_With_Role():
    display.clear_output()
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    employees = reg.getAllEmployees()
    reg.closeConnection()
    employeeTable = EmployeeWithRole.showAsTable(employees)
    #display.display(employeeTable)
    display.display(display.HTML(employeeTable.to_html()))
Esempio n. 9
0
def on_changeE(change):
    if change['type'] == 'change' and change['name'] == 'value':
        reg = Registrar()
        response = reg.openDBConnectionWithBundle("PgBundle.properties")
        curE = reg.getEmployeeData(employeeRoleFullName.value)
        managerDropDown.value = curE.getManagerName()
        employeeRoleStartDate.value = curE.getStartDate()
        employeeRoleEndDate.value = curE.getEndDate()
        dropdownRole.value = curE.getRoleName()
        reg.closeConnection()
Esempio n. 10
0
def saveEmployeeChanges():
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    returnvalue = reg.saveEmployeeRoles(employeeRoleFullName.value,
                                        managerDropDown.value,
                                        dropdownRole.value,
                                        employeeRoleStartDate.value,
                                        employeeRoleEndDate.value)

    if (returnvalue == True):
        print("Update Successful")
    else:
        print("Update Failure")
    reg.closeConnection()
Esempio n. 11
0
def show_Audit_Tables(num):
    display.clear_output()
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    audit = reg.getAudits(num)
    audittable = None
    if (num == 1):
        audittable = Employee.showAsTable2(audit)
    elif (num == 2):
        audittable = EmployeeRole.showAsTable2(audit)
    else:
        audittable = Role.showAsTable2(audit)
    reg.closeConnection()
    display.display(display.HTML(audittable.to_html()))
Esempio n. 12
0
def addNR(sender):
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    if str(textRoleName.value).strip() in dropdownRole.options:
        print("Role name already exists!!")
    elif textRoleName.value == None or len(str(
            textRoleName.value).strip()) < 1:
        print("Role name was not given!!")
    else:
        reg.saveNewRoles2(
            textRoleName.value, EngineOilSpendingAmount.value,
            EngineOilBuyingAmount.value, CrudeOilSpendingAmount.value,
            CrudeOilBuyingAmount.value, MotorOilSpendingAmount.value,
            MotorOilBuyingAmount.value, GasolineBuyingAmount.value,
            GasolineSpendingAmount.value, PetroleumSpendingAmount.value,
            PetroleumBuyingAmount.value, InternalSpendingBudget.value)
        print("New role created!!!")
    reg.closeConnection()
Esempio n. 13
0
def on_change(change):
    if change['type'] == 'change' and change['name'] == 'value':
        reg = Registrar()
        response = reg.openDBConnectionWithBundle("PgBundle.properties")
        curRole = reg.getRoleComponent(dropdownRole.value)
        reg.closeConnection()
        EngineOilSpendingAmount.value = curRole.getEngineOilSpendingAmount()
        EngineOilBuyingAmount.value = curRole.getEngineOilBuyingAmount()
        CrudeOilSpendingAmount.value = curRole.getCrudeOilSpendingAmount()
        CrudeOilBuyingAmount.value = curRole.getCrudeOilBuyingAmount()
        MotorOilSpendingAmount.value = curRole.getMotorOilSpendingAmount()
        MotorOilBuyingAmount.value = curRole.getMotorOilBuyingAmount()
        GasolineBuyingAmount.value = curRole.getGasolineBuyingAmount()
        GasolineSpendingAmount.value = curRole.getGasolineSpendingAmount()
        PetroleumSpendingAmount.value = curRole.getPetroleumSpendingAmount()
        PetroleumBuyingAmount.value = curRole.getPetroleumBuyingAmount()
        InternalSpendingBudget.value = curRole.getInternalSpendingBudget()
Esempio n. 14
0
def editExistRoles():
    saveNewRoleButton = widgets.Button(description="Save")
    reg = Registrar()
    response = reg.openDBConnectionWithBundle("PgBundle.properties")
    dropdownRole.options = reg.getRoleNames(2)
    curRole = reg.getRoleComponent(dropdownRole.value)
    EngineOilSpendingAmount.value = curRole.getEngineOilSpendingAmount()
    EngineOilBuyingAmount.value = curRole.getEngineOilBuyingAmount()
    CrudeOilSpendingAmount.value = curRole.getCrudeOilSpendingAmount()
    CrudeOilBuyingAmount.value = curRole.getCrudeOilBuyingAmount()
    MotorOilSpendingAmount.value = curRole.getMotorOilSpendingAmount()
    MotorOilBuyingAmount.value = curRole.getMotorOilBuyingAmount()
    GasolineBuyingAmount.value = curRole.getGasolineBuyingAmount()
    GasolineSpendingAmount.value = curRole.getGasolineSpendingAmount()
    PetroleumSpendingAmount.value = curRole.getPetroleumSpendingAmount()
    PetroleumBuyingAmount.value = curRole.getPetroleumBuyingAmount()
    InternalSpendingBudget.value = curRole.getInternalSpendingBudget()
    reg.closeConnection()
    display.display(dropdownRole)
    displayRolesComponents()
    display.display(saveNewRoleButton)

    saveNewRoleButton.on_click(editR)
Esempio n. 15
0
def registrar():
    global _registrar
    if not _registrar:
        from Registrar import Registrar
        _registrar = Registrar()

        import native
        _registrar.manage(native, native.format())

        import chemkin
        _registrar.manage(chemkin, chemkin.format())

        import ckml
        _registrar.manage(ckml, ckml.format())

        import c
        _registrar.manage(c, c.format())

        import html
        _registrar.manage(html, html.format())

        import python
        _registrar.manage(python, python.format())

    return _registrar