DHTMLAsp.NetSQLC-SharpXMLFrameworkIISXMLWebServiceArchitecture
UMLProject ManagementSDLCMethodologiesDesign PatterenOOPWCF.Net RemotingWWF
MVPMVCSite Map
Asp.net 2.0
User Control
Custom Control
File Handling
Deligate
Site Map
Tell a Friend
You
Friend
Email

Newsletter
Email

 

 

Module View Presenter
Module is basically responsible for connecting database and getting and updating data, and communicate with view
Module code sample
using System;
using System.Collections.Generic;
using System.Text;
using BusinessEntities;
namespace MVP.Module
{
/// <summary>
/// This is one class of Module section
/// </summary>
public class ETGModule
{
public ETGModule()
{ }
public Employee GetEmployeeInfo(int EmpId)
{
Employee emp = new Employee();
/*
here to fill up the employee information, module can talk to database directly or indirectly.
*/
return emp;
}
}
}
View is basically an interface, could be a winform or webform
View code sample
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MVP.Presenter;
using BusinessEntities;
namespace MVP.View
{
public partial class ETGView : Form, IPresenter
{
MVP.Presenter.Presenter _presenter = new MVP.Presenter.Presenter();
public ETGView()
{
InitializeComponent();
}
private void btnGetEmpInfo_Click(object sender, EventArgs e)
{
_presenter.GetEmployeeInfo(1);
}
public Employee EmployeeInfo
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
if (value != null)
{
MessageBox.Show(value.Name);
MessageBox.Show(value.Email);
}
}
}
}
}
Presenter code sample
using System;
using System.Collections.Generic;
using System.Text;
using BusinessEntities;
namespace MVP.Presenter
{
public interface IPresenter
{
Employee EmployeeInfo { get; set; }
}
}
//Presenter class implementation
using System;
using System.Collections.Generic;
using System.Text;
using BusinessEntities;
using MVP.Module;
namespace MVP.Presenter
{
public class Presenter : IPresenter
{
private Employee _EmployeeInfo;
public Presenter()
{
}
public void GetEmployeeInfo(int EmpId)
{
/*
* Here is place for checking any business rules, validation
* then make a call to Module
* and set the value
*/
ETGModule module = new ETGModule();
this.EmployeeInfo = module.GetEmployeeInfo(EmpId);
}
public Employee EmployeeInfo
{
get
{
return this._EmployeeInfo;
}
set
{
this._EmployeeInfo = value ;
}
}
}
}
Privacy Policy ©2007 E-Tigers.net, All Rights Reserved Terms & Conditions
Supported by ETG Consultancy