Commit 1886fb57 authored by  Bruno Daniel Di Bello Baladan's avatar Bruno Daniel Di Bello Baladan
Browse files

para sabro

parent e3b1cbd0
......@@ -44,7 +44,14 @@ namespace BusinessLogicLayer
public double CalcPartTimeEmployeeSalary(int idEmployee, int hours)
{
throw new NotImplementedException();
Employee emp = _dal.GetEmployee(idEmployee);
if (emp == null || emp is FullTimeEmployee)
{
throw new Shared.Exception.InvalidEmployeeException("El empleado es inválido");
}
PartTimeEmployee employee = (PartTimeEmployee)emp;
return employee.HourlyRate * hours;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.Exception
{
[Serializable()]
public class InvalidEmployeeException : System.Exception
{
public InvalidEmployeeException() : base() { }
public InvalidEmployeeException(string message) : base(message) { }
public InvalidEmployeeException(string message, System.Exception inner) : base(message, inner) { }
// A constructor is needed for serialization when an
// exception propagates from a remoting server to the client.
protected InvalidEmployeeException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
{ }
}
}
\ No newline at end of file
......@@ -42,12 +42,12 @@
<Compile Include="Entities\Employee.cs" />
<Compile Include="Entities\FullTimeEmployee.cs" />
<Compile Include="Entities\PartTimeEmployee.cs" />
<Compile Include="Exception\InvalidEmployeeException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Caching\" />
<Folder Include="Enums\" />
<Folder Include="Exception\" />
<Folder Include="Logging\" />
<Folder Include="Security\" />
</ItemGroup>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment