views:

52

answers:

4

Hello guyz,i am new to daatbase and class diagram.I just get scenarios from internet and try to develop ERD and Class Diagram for them.But the following scenario has caused me some problems, and i am not sure about my design.

"Whenever an employee fills leave application form, the leave application should be appeared for approval to his/her team leader. Team Leader has the option to change the date of requested leave and to approve or reject the leave. Employee also has the option to change date of previously unapproved leaves or to cancel any of unapproved leave. In case of team leader, he can approve his own leaves.

Management should be able to create categories of leaves like (Casual, Sick, Planned work, etc) and should be able to adjust the days allocated to each type of leave".

I have identified these as entities for ERD

1) Employee(I think i dont need to make entity for Technical lead,since he is an employee) 2) LeaveHistory 3) LeaveCategory

Plz correct me if the system need more classes or entities

+1  A: 

You need to add tables/columns that track who is the Team Leader for each employee.

It depends entirely on your requirements. Would you like to have only the current leader stored, or do you need to maintain historical record?

Consider creating a table to track the Reporting Hierarchy. Employee_Hierarchy - id, employee_id, manager_id, startdate, enddate, etc...

Things to consider. 1. Will you need to track data for people who are not employees (e.g. Contractors) Does the relationship matter? 2. Globalization - Store times in UTC or local time or server time.

John DaCosta
A: 

Alryt, got that, but plz answer this. Consider that in my system, i have employee,team lead nad manager.IN the class diagram,should i make 3 classes ,i.e class for employee,team lead and manager or what should i do.

Mahesh
Unless there are sufficient methods to warrant differentiation, the additional work is not justified. If just approving a form is the deciding factor, simply never assign a form to a regular employee and move on with one class.Example: Vehicle, Motorcycle, Car, Sedan, Coupe, AutobusIf all you will implement is start, stop, move forward, backwards, left and right, one class (Vehicle), can work for all, however you make choose to implement that a motorcycle cannot have doors. Or that an Coupe can only have 2 doors, etc…
John DaCosta
A: 

ok, to wrap up things, i have one last question. In the above scenario, the manager has only one task to do, that is to create categories,and define the no of vacations allowed for that vacation.Obviously,the category table that the manager is creating doesnt require to store the id of manager.So do we need to have a relation between category and manager table or not,considering the fact that manager id is not to be stored in category table(but manager is obviously creating categories as previously discussed).If the relation is not required between manager and category, then is there any relation of manager entity with any other table

Mahesh
A: 

someone answer plz

ok, to wrap up things, i have one last question. In the above scenario, the manager has only one task to do, that is to create categories,and define the no of vacations allowed for that vacation.Obviously,the category table that the manager is creating doesnt require to store the id of manager.So do we need to have a relation between category and manager table or not,considering the fact that manager id is not to be stored in category table(but manager is obviously creating categories as previously discussed).If the relation is not required between manager and category, then is there any relation of manager entity with any other table

Mahesh