Im a beginner to Model-View-Presenter pattern and Im just trying to use it in a sample project for studies.
Lets say in my project (a c# win forms app) there is a `Employee Class` and it has properties like `EmployeeID`,`Name`, `Address`, `Designation` etc. Also it has behaviors like `viewEmployee()`, `AddNewEmployee()`, `PromoteEmployee()` etc.
1. Could you please advice me how these things are organized in MVP pattern?
2. I have several entity classes in my project like Employee, Client, Attendance, Salary etc. So should I make separate DataService and Presenter classes for each one?
My current understanding is like this...
**Implementing ViewEmployee()----------**
Class Employee
{
public string EmployeeID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string Designation { get; set; }
}
Class EmployeePresenter
{
public void ViewEmployee(string employeeID, frmEmployeeDetails _form)
{
Employee Emp= EmloyeeDataService.GetEmployeeData(employeeID);
_form.txtName=Emp.Name;
_form.txtAddress=Emp.Address;
_form.txtDesignation=Emp.Designation;
}
}
Class EmployeeDataService
{
public static Employee GetEmployeeData(String employeeID)
{
}
}
Partial Class frmEmployeeDetails : Form
{
btnViewEmployee_Click()
{
EmployeePresenter.ViewEmployee(txtEmployeeID.text,this);
}
}