Beispiel #1
0
def addStorageCoordinator(db,firstName,secondName,surName,age) :
        contract.is_not_empty(firstName)
        contract.is_not_empty(secondName)
        contract.is_not_empty(surName)
        contract.is_greater_than(age, 0)
        
        newID = incVolunteerID(db)
        db['volunteers'][newID] = StorageCoordinator(newID,firstName,secondName,surName,age,-1)
Beispiel #2
0
def changeMainCoordinator(db,firstName,secondName,surName,age) :
        contract.is_not_empty(firstName)
        contract.is_not_empty(secondName)
        contract.is_not_empty(surName)
        contract.is_greater_than(age, 0)
        
        for person in db['volunteers'].values() :
                if type(person).__name__=='MainCoordinator' :
                        db['volunteers'][person.ID] = MainCoordinator(person.ID,firstName,secondName,surName,age)
                        return 0
        else :
                addMainCoordinator(db,firstName,secondName,surName,age)
                return 1
Beispiel #3
0
def addMainCoordinator(db,firstName,secondName,surName,age) :
        contract.is_not_empty(firstName)
        contract.is_not_empty(secondName)
        contract.is_not_empty(surName)
        contract.is_greater_than(age, 0)
        
        for person in db['volunteers'].values() :
                if type(person).__name__=='MainCoordinator'  :
                        print('There are main coordinators')
                        return False
        newID = incVolunteerID(db)
        db['volunteers'][newID] = MainCoordinator(newID,firstName,secondName,surName,age)
        return True
Beispiel #4
0
def addHumanResourcesCoordinator(db,firstName,secondName,surName,age) :
        contract.is_not_empty(firstName)
        contract.is_not_empty(secondName)
        contract.is_not_empty(surName)
        contract.is_greater_than(age, 0)
        
        cnt = 0
        for person in db['volunteers'].values() :
                cnt+= type(person).__name__=='HumanResourcesCoordinator'
        if cnt>=2 :
                print('There are too many human resources coordinators,sorry')
                return False
        newID = incVolunteerID(db)
        db['volunteers'][newID] = HumanResourcesCoordinator(newID,firstName,secondName,surName,age)
        return True
Beispiel #5
0
def addStorage(db,address,roomines) :
        contract.is_not_empty(address)
        contract.is_greater_than(roomines, 0)
                
        newID = incStorageID(db)
        db['storages'][newID] = Storage(newID,address,roomines)