Exemple #1
0
def createStaff():
    createStaffForm = CreateStaffForm(request.form)

    if request.method == 'POST' and createStaffForm.validate():
        staffDict = {}
        db = shelve.open('storage.db', 'c')
        try:
            Staff.Staff.count = int(db['staffCount'])
            staffDict = db['Staff']
        except:
            print("Error in retrieving Staff from storage.db.")
        staff = Staff.Staff(
            createStaffForm.fname.data, createStaffForm.lname.data,
            createStaffForm.gender.data, createStaffForm.hp.data,
            createStaffForm.dob.data, createStaffForm.password.data,
            createStaffForm.address.data, createStaffForm.type.data)

        staffDict[staff.get_eID(
        )] = staff  # creates a key value pair in staffDict to "register" staff. key is Employee ID, value is staff object
        db['Staff'] = staffDict  # put dict back in persistence
        db['staffCount'] = Staff.Staff.count  # since eID is unique and incremental, count is saved back into persistence

        db.close()
        return redirect(
            url_for('staffAccounts')
        )  # for admin to look at staff accounts, to check that staff account is created successfully
    return render_template('createStaff.html', form=createStaffForm)
Exemple #2
0
    def __init__(self):
        Sword1 = Sword(1)
        Sword2 = Sword(2)
        Sword3 = Sword(3)
        Staff1 = Staff(1)
        Staff2 = Staff(2)
        Staff3 = Staff(3)
        Bow1 = Bow(1)
        Bow2 = Bow(2)
        Bow3 = Bow(3)

        self.inventory = {
            Sword1.getitemName(): 100,
            Staff1.getitemName(): 100,
            Bow1.getitemName(): 100,
            Sword2.getitemName(): 200,
            Staff2.getitemName(): 200,
            Bow2.getitemName(): 200,
            Sword3.getitemName(): 300,
            Staff3.getitemName(): 300,
            Bow3.getitemName(): 300,
        }
Exemple #3
0
def grading_system():
    gradingSystem = Staff.Staff()
    return gradingSystem
Exemple #4
0
def staffSystem():
    staffSystem = Staff.Staff()
    return staffSystem
def staff_sys():
    staffSys = Staff.Staff()
    return staffSys
import Person import Person, Student, Staff


tom = Person("Tom", "____")
tom.Person()

tom = Student("121", 2, 30000, tom.name, tom.address)
tom.Student()

tom = Staff("111q", 89, tom.name, tom.address)
tom.Staff()
import Person import Person, Student, Staff


mike = Person("Mike", "____")
mike.Person()

mike = Student("121", 2, 30000, mike.name, mike.address)
mike.Student()

mike = Staff("111q", 89, mike.name, mike.address)
mike.Staff()
Exemple #8
0
 def addStaff(self, name, dob, role):
     s = Staff(name, dob, role)
     self.staffs.append(s)
Exemple #9
0
 def addStaff(self, name, dob, type_):
     s = Staff(name, dob, type_)
     self.staff.append(s)
import Staff

peter = Staff.BasicStaff('Peter', 0)
john = Staff.ManagementStaff('John', 0, 1000, 0)

print(peter, 'pay=', peter.calculatePay())
print(john, 'pay=', john.calculatePay(), ' Bonus=', john.calculatePerfBonus())
def sta():
    sta = Staff.Staff()
    return sta