Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Employee
- {
- public int Id { get; set; }
- public string Name { get; set; }
- public string ReportType { get; set; }
- public int Salary { get; set; }
- public virtual string GetProjectDetails(int employeeId)
- {
- return "Base Project";
- }
- public virtual string GetEmployeeDetails(int employeeId)
- {
- return $"Employee: { Name }";
- }
- public abstract bool InsertIntoEmployeeTable(Employee em);
- public void GenerateReport(Employee em)
- {
- if (ReportType == "CSV")
- {
- // Report generation code with employee data saved as CSV file.
- }
- if (ReportType == "PDF")
- {
- // Report generation code with employee data saved as CSV file.
- }
- }
- }
- public class RegularEmployee : Employee
- {
- public override string GetProjectDetails(int employeeId)
- {
- return "Child Project";
- }
- public override string GetEmployeeDetails(int employeeId)
- {
- return "Child Employee";
- }
- public override bool InsertIntoEmployeeTable(Employee em)
- {
- // insert code;
- return true;
- }
- }
- public class SubcontractorEmployee : Employee
- {
- public float ParentCompanyFee { get; set; }
- public override string GetProjectDetails(int employeeId)
- {
- return "Child Project";
- }
- public override string GetEmployeeDetails(int employeeId)
- {
- throw new NotImplementedException();
- }
- public override bool InsertIntoEmployeeTable(Employee em)
- {
- // subcontractors are not stored in the Employee table
- return false;
- }
- public float GetCompanyFee(float netSalary)
- {
- var feeCalculator = new CheatingFeeCalculator();
- float baseFee = feeCalculator.CalculateBaseFee(netSalary, ParentCompanyFee);
- float finalFee = baseFee * 0.95;
- return finalFee;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement