public class Person
{
private static readonly TraceSource traceSource = new TraceSource("PersonLog");
public string FirstName { get; set; }
public string LastName { get; set; }
public bool IsValid()
{
var isValid = (!string.IsNullOrWhiteSpace(this.FirstName) || !string.IsNullOrWhiteSpace(this.LastName));
traceSource.TraceInformation(string.Format("Is {0} {1} valid - {2}", this.FirstName, this.LastName, isValid));
return isValid;
}
}
public class Employee : Person
{
private static readonly TraceSource traceSource = new TraceSource("EmployeeLog");
public string Department { get; set; }
public Person Manager { get; set; }
public bool IsActive { get; set; }
public bool IsDepartmentValid()
{
var isValid = !string.IsNullOrWhiteSpace(this.Department);
traceSource.TraceInformation(string.Format("Is the {0} department valid - {1}", this.Department, isValid));
return isValid;
}
}