lundi 25 septembre 2017

Access Base Class Member from Composition Member Class

I have the following Classes,

Public Class Department

     Public Property ID as Integer
     Public Property MaxEmployeesAllowed as Integer 'Maximum No. of Employees allowed in this Department
     Public Property MaxAllowedSalaryPerMonth as Double 'This Department Employees Total Salary should not exceed this Amount
     Public Property Employees as List(of Employee)

End Class

Public Class Employee

     Public Property ID as Integer       
     Public Property No as String
     Public Property Salary as Double

End Class

Questions are as follows :

Q01. while updating Employees Salary, I need a validation to check whether departments all employees salary should not cross MaxAllowedSalaryPerMonth.

Q02. While Adding New Employee I should check the No. of Employees Limit should not be crossed than the Limit in the Department.

How can i do this through Design Pattern, Am trying to achieve this through Decorator Pattern ?

Thanks

Iyyappan R

Aucun commentaire:

Enregistrer un commentaire