-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.cs
68 lines (55 loc) · 1.54 KB
/
Employee.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment
{
public enum SecurityPrivilege
{
Guest,
Secretary,
Developer,
DBA
}
//internal class Employee
//{
//}
public class Employee
{
#region Attributes Or Properties
public int Id { get; set; }
public string Name { get; set; }
public SecurityPrivilege SecurityLevel { get; set; }
public decimal Salary { get; set; }
public DateTime HireDate { get; set; }
public Gender Gender { get; set; }
#endregion
// Constructor
public Employee(int id, string name, SecurityPrivilege securityLevel,
decimal salary, DateTime hireDate, Gender gender)
{
Id = id;
Name = name;
SecurityLevel = securityLevel;
Salary = salary;
HireDate = hireDate;
Gender = gender;
}
#region Method
public override string ToString()
{
return $"Employee ID: {Id}\n Name: {Name}\n Security Level: {SecurityLevel}\n Salary: {Salary}\n Hire Date: {HireDate}\nGender: {(Gender == Gender.M ? "Male" : "Female")}";
}
#endregion
}
// Enum for Gender
#region #03
/*We need to restrict the Gender field to be only M or F [Male or Female] */
public enum Gender
{
M, // Male
F // Female
}
#endregion
}