|
/// <summary> /// Employee_Factory derived from Factory class /// and override and implement its methods /// </summary>
public class Employee_Factory:Factory { public override object Create() { Employee oEmployee=new Employee(); //......... //......... //......... return oEmployee; }
public override bool Update(object oEmployee) { //update instructions //......... //......... //......... return true; } public override bool Delete(object oEmployee) { //delete instructions //......... //......... //......... return true; } }
/// <summary> /// Task class implement ITask interface /// </summary>
public class Task:ITask { public int .Task_Id; public string Title; public bool isDone; // public DateTime Deadline; //Achievement date public DateTime AchievedOn;
public bool IsPending(out DateTime p_Deadline) { p_Deadline=this.Deadline; return (! this.isDone); } public bool IsDone(out DateTime p_AchievedOn) { p_AchievedOn=this.AchievedOn; return (this.isDone); } public bool HasPassedDealine(out DateTime p_Deadline) { p_Deadline=this.Deadline; return (DateTime.Now>this.Deadline); } }
/// <summary> /// Employee class implement IEmployee class /// </summary>
public class Employee:IEmployee { private string m_Empl_Id; private string m_First_Name; private string m_Last_Name; private DateTime m_DOB;
public string Empl_Id { get{return m_Empl_Id;} set{m_Empl_Id=value; } } public string First_Name { get{return m_First_Name; } set{First_Name=value;} } public string Last_Name { get{return m_Last_Name; } set{m_Last_Name=value;} } public DateTime DOB { get{return m_DOB;} set{m_DOB=value;} } public double CalculateAge() { return DateTime.Now.Year - DOB.Year; } }
|