using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyClasses.PersonClasses
{
public class PersonManager
{
public Person CreatePerson(string first,
string last,
bool isSupervisor)
{
Person ret = null;
if (!string.IsNullOrEmpty(first))
{
if (isSupervisor)
{
ret = new Supervisor();
}
else
{
ret = new Employee();
}
// Assign variables
ret.FirstName = first;
ret.LastName = last;
}
return ret;
}
///
/// This method simulates retrieving a list of Person object
///
/// A collection of Person objets
public List GetPeople()
{
List people = new List();
people.Add(new Person() { FirstName = "Paul", LastName = "Sheriff" });
people.Add(new Person() { FirstName = "John", LastName = "Kuhn" });
people.Add(new Person() { FirstName = "Jim", LastName = "Rulh" });
return people;
}
///
/// This method simulate retieving a list of Supervisor object
///
/// A collection of Supervisor objects
public List GetSupervisors()
{
List people = new List();
people.Add(CreatePerson("Paul", "Sheriff", true));
people.Add(CreatePerson("Michael", "Krasowski", true));
return people;
}
///
/// This method simulates retrieving a list of Employee object
///
/// A collection of Persons objects
public List GetEmployees()
{
List people = new List();
people.Add(CreatePerson("Steve", "Nystrom", false));
people.Add(CreatePerson("John", "Kuhn", false));
people.Add(CreatePerson("Jim", "Rulh", false));
return people;
}
///
/// This method simulates retrieving a list of Supervisor and Employee object
///
/// A collection of Supervisor and Employee objects
public List GetSupervisorAndEmployees()
{
List people = new List();
people.AddRange(GetEmployees());
people.AddRange(GetSupervisors());
return people;
}
}
}