Click here to Skip to main content
15,881,089 members
Articles / Database Development / SQL Server

VCMBox, an MVC - FuseBox Hybrid Framework

Rate me:
Please Sign up or sign in to vote.
4.54/5 (8 votes)
8 Jul 2004CPOL14 min read 65.1K   1.7K   58  
An MVC meets FuseBox Hybrid pattern for .NET, implmented in C# with the the Northwind database.
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>NorthwindMvcHarness</name>
    </assembly>
    <members>
        <member name="T:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi">
            <summary>
            The MDI Parent Form of the Harness.
            </summary>
            <remarks>
            Can contain (n) number of MDI Children each with its own
            Controller, Model and Viewports.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.mnuNewEmployee">
            <summary>
            The Main Menu.
            </summary>
            <remarks>
            Contains two Menu Items for creating a new 
            MDI Child and a presenting a Window List
            of all active MDI Children.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.mitmNew">
            <summary>
            The New menu item.
            </summary>
            <remarks>
            OnClick Event Handler is reponsible for 
            creating a new instance of the MDI Child Form.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.mitmWindowList">
            <summary>
            The Window List menu item.
            </summary>
            <remarks>
            Displays the List of active MDI Children forms.
            </remarks>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.#ctor">
            <summary>
            Creates a new Instance of the MDI Parent Form.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.Dispose(System.Boolean)">
            <summary>
            Clean up any resources being used.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.InitializeComponent">
            <summary>
            Required method for Designer support - do not modify
            the contents of this method with the code editor.
            </summary>
            <remarks>
            Initialises the constituent controls and Event Handlers for
            the MDI Parent Form.
            </remarks>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.Main">
            <summary>
            The main entry point for the application.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdi.mitmNew_Click(System.Object,System.EventArgs)">
            <summary>
            The Event Handler for the New menu item.
            </summary>
            <remarks>
            Creates a new instance of a MDI Child Form.
            <code>
            private void mitmNew_Click(object sender, System.EventArgs e)
            {
            	frmNwindMdiChild newEmployeeView = new frmNwindMdiChild();
            	newEmployeeView.MdiParent = this;
            	newEmployeeView.Show();
            }
            </code>
            </remarks>
            <param name="sender">The New menu item</param>
            <param name="e">The EventArgs argument.</param>
        </member>
        <member name="T:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild">
            <summary>
            The MDI Child Class Derived from System.Windows.Forms.Form
            </summary>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.pnlTree">
            <summary>
            The Panel on each MDI Child instance that contains
            the TreeView for navigating Employees and their respective Orders and Details.
            </summary>
            <remarks>
            Returns a System.Windows.Forms.Panel
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.sprNwindEmployee">
            <summary>
            A splitter that seperates the TreeView and Workspace Panel.
            </summary>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.tvwNwindEmployees">
            <summary>
            The TreeView containing all employees found meeting the filter
            criteria set in the app.config file which limits displayed Employees
            to those that have taken orders beyond a specified date.
            </summary>
            <remarks>
            The key looks like this add key="OrderDateFilter" value="01-05-1998"
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.pnlEmployeeWorkspace">
            <summary>
            The Workspace panel to the right of the TreeView.
            </summary>
            <remarks>
            This panel contains all the Viewports that provide services
            as requested by clicking a TreeView Node.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.NwindController">
            <summary>
            The Controller for each instance of
            an MDI Child form.
            </summary>
            <remarks>
            Each MDI Child form uses it's own controller.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.NwindModel">
            <summary>
            The Model for each instance of
            an MDI Child form.
            </summary>
            <remarks>
            Each MDI Child form uses it's own model to maintain state
            for it's collection of viewports which are contained with the workspace panel
            controls collection. The model's modifier is set to internal to allow inner classes
            (namely TreeNodes) to access it.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.eDatailsPort">
            <summary>
            The Employee details ViewPort.
            </summary>
            <remarks>
            A user control designed to display the Employee's Details.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.eOrderDetailsPort">
            <summary>
            The Order and Order Details ViewPort.
            </summary>
            <remarks>
            A user control designed to display the Employee's Order and Order Details.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.eHeaderPort">
            <summary>
            A Descriptive Header ViewPort that describes the application.
            </summary>
            <remarks>
            A user control designed to display the Purpose of the Name of this
            pattern, it's Author and his contact details.
            </remarks>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.#ctor">
             <summary>
             The Constructor of the MDI Child Form
             containing a TreeView for navigating an
             employee's personanl and order details data.
             </summary>
            <remarks>
            Initiliases the Model, Controller and Viewports for an instance. Also
            subscribes to it's TreeViews AfterSelect Event.
             <code>
             public frmNwindMdiChild()
             {
            	InitializeComponent();
            	NwindModel = new Model();
            	NwindController = new Controller(NwindModel);
            	NwindModel.TreeLoaded += new DataFetchHandler(NwindModel_TreeLoaded);
            	this.tvwNwindEmployees.AfterSelect += new TreeViewEventHandler(tvwNwindEmployees_AfterSelect);
            	eHeaderPort = new NorthWindHeader();
            	eDatailsPort = new EmployeeDetails(NwindController, NwindModel);
            	eOrderDetailsPort = new OrderDetails(NwindController, NwindModel);
             }
             </code>
            </remarks>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.Dispose(System.Boolean)">
            <summary>
            Clean up any resources being used.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.InitializeComponent">
            <summary>
            Required method for Designer support - do not modify
            the contents of this method with the code editor.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.frmNwindMdiChild_Load(System.Object,System.EventArgs)">
            <summary>
            The Load Event Method of the MDI Child Form.
            </summary>
            <remarks>
            Calls the controller to request Data required by the
            TreeView be loaded into the Model.
            </remarks>
            <param name="sender">The Form being Loaded.</param>
            <param name="e">The event arguments.</param>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.tvwNwindEmployees_AfterSelect(System.Object,System.Windows.Forms.TreeViewEventArgs)">
            <summary>
            The event handler for the TreeView on the MDI Child Form.
            </summary>
            <remarks>
            Clears the control collection for the Workspace panel,
            adds the appropriate (ViewPort) User Control to the Workspace panel
            and shows the relevant (ViewPort) User Control.
            <code>
            private void tvwNwindEmployees_AfterSelect(object sender, TreeViewEventArgs e)
            {
            	switch(e.Node.GetType().FullName)
            	{
            		case "NorthwindMvcHarness.frmNwindMdiChild+EmployeesNode" :
            		
            			this.pnlEmployeeWorkspace.Controls.Clear();
            			this.pnlEmployeeWorkspace.Controls.Add(eHeaderPort);
            			eHeaderPort.Show();
            			break;
            			
            		case "NorthwindMvcHarness.frmNwindMdiChild+EmployeeNode" :
            		
            			this.pnlEmployeeWorkspace.Controls.Clear();
            			this.pnlEmployeeWorkspace.Controls.Add(eDatailsPort);
            			eDatailsPort.Show(((EmployeeNode)e.Node).Id);
            			break;
            			
            		case "NorthwindMvcHarness.frmNwindMdiChild+OrderNode" :
            		
            			this.pnlEmployeeWorkspace.Controls.Clear();
            			this.pnlEmployeeWorkspace.Controls.Add(eOrderDetailsPort);
            			eOrderDetailsPort.Show(((OrderNode)e.Node).Id);
            			break;
            			
            		default : //shouldnt happen so do nothing
            		
            			break;
            	}
            }
            </code>
            </remarks>
            <param name="sender">The TreeView.</param>
            <param name="e">The TreeViewEventArgs argument.</param>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.NwindModel_TreeLoaded">
             <summary>
             Subscribing Event handler for the Model TreeLoaded Event.
             </summary>
             <remarks>
             Creates the root Node for the TreeView which in turn triggers
             a recursive builing of the the entire Tree. Each TreeNode belonging
             to the TreeView is a strongly typed subclass of TreeNode.
             <code>
             private void NwindModel_TreeLoaded()
             {
            	if(NwindModel.Employee.tblLoadAllEmployees.Rows.Count > 0)
            	{
            		EmployeesNode root = new EmployeesNode(this.tvwNwindEmployees);
            	}
             }
             </code>
            </remarks>
        </member>
        <member name="T:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeesNode">
            <summary>
            This is the Root Node in the Tree.
            </summary>
            <remarks>
            A strongly typed node.
            </remarks>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeesNode.model">
            <summary>
            The Model associated to the TreeView and all it's associated
            Viewports.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeesNode.#ctor(System.Windows.Forms.TreeView,Mvc.DerivedPattern.NorthWind.Tutorial.Models.Model)">
            <summary>
            Initialises the EmployeesNode and creates a child
            collection of Employee type Nodes.
            </summary>
            <param name="parentTree">The parent Tree whose Nodes collection contains this TreeNode.</param>
            <param name="model">The Model that this Node finds it Domain data.</param>
            <remarks>
            Set the text value of the TreeNode subclass, adds itself to
            the Nodes Collection object of it's parent Tree and enumerates the Model Domain
            to recursively create it's own Nodes Collection of EmployeeNode objects.
            <code>
            internal EmployeesNode(TreeView parentTree)
            {
            	this.model = model;
            	this.Text = "NorthWind Employees";
            	this.parentTree = parentTree;
            	this.parentTree.Nodes.Add(this);
            	foreach(DataRow dr in this.model.Employee.tblLoadAllEmployees.Rows)
            	{
            		string nodeName = (string)dr["FirstName"] + " " + (string)dr["LastName"];
            		EmployeeNode child = new EmployeeNode(nodeName, (int)dr["EmployeeID"], this, this.model);
            	}
            }
            </code>
            </remarks>
        </member>
        <member name="P:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeesNode.ParentTree">
            <summary>
            Gets the ParentTree (TreeView) object.
            </summary>
            <remarks>
            The TreeView that has it's Nodes Collection populated with the EmployeesNode.
            <code>
            internal TreeView ParentTree
            {
            	get{return parentTree;}
            }
            </code>
            </remarks>
        </member>
        <member name="T:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode">
            <summary>
            The EmployeeNode exists at the 2nd Level of the Employee Tree.
            </summary>
        </member>
        <member name="F:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode.model">
            <summary>
            The Model associated to the TreeView and all it's associated
            Viewports.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode.#ctor(System.String,System.Int32,System.Windows.Forms.TreeNode,Mvc.DerivedPattern.NorthWind.Tutorial.Models.Model)">
            <summary>
            The EmployeeNode Constructor.
            </summary>
            <param name="nodeName">The Text value to assign to the Node.</param>
            <param name="id">The Employees ID.</param>
            <param name="parentNode">This nodes parent node.</param>
            <param name="model">The Model that this node finds it Domain data.</param>
            <remarks>
            The constructor subscribes to the Models EmployeeUpdate Event
            so that the EmployeeNode can have it's Text Property changed
            to reflect any change to the Employees name in the Domain Model and
            recursively builds a list of OrderNode objects that will inturn add
            themselves to this nodes Nodes Collection.
            <code>
            internal EmployeeNode(string nodeName, int id, TreeNode parentNode)
            {
            	this.model = model;
            	this.Text = nodeName;
            	this.id = id;
            	this.parentNode = parentNode;
            	this.model.EmployeeUpdated += new DataFetchHandler(NwindModel_EmployeeUpdated);
            	DataView dv = new DataView(this.model.Employee.tblLoadAllOrders);
            	dv.RowFilter = "EmployeeID = " + id.ToString() + " and OrderDate > '" +
            		(string)System.Configuration.ConfigurationSettings.AppSettings["OrderDateFilter"] + "'";
            	dv.Sort = "OrderDate ASC";
            	foreach(DataRowView row in dv)
            	{
            		nodeName = "Order Number : " + 
            		Convert.ToString((int)row["OrderID"]) + " - " +
            		((DateTime)row["OrderDate"]).ToString("dd-MM-yyyy");
            		OrderNode child = new OrderNode(nodeName, (int)row["OrderID"], this);
            	}
            	this.ParentNode.Nodes.Add(this);
            }
            </code>
            </remarks>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode.NwindModel_EmployeeUpdated">
            <summary>
            Event Handler for the EmployeeUpdated Event in Model.
            </summary>
            <remarks>
            Checks to see if it's internal Id property
            is the same as the Employee that has last been
            updated and if so then updates the Text Value
            to reflect the most current value in the Model.
            <code>
            private void NwindModel_EmployeeUpdated()
            {
            	DataRow dr = this.model.Employee.tblSelectEmployee[0];
            	if((int)dr["EmployeeID"] == this.Id)
            	{
            		string nodeName = (string)dr["FirstName"] + (string)dr["LastName"];
            		this.Text = nodeName;
            	}
            }
            </code>
            </remarks>
        </member>
        <member name="P:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode.Id">
            <summary>
            Gets the EmployeeID associated with this node.
            </summary>
        </member>
        <member name="P:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.EmployeeNode.ParentNode">
            <summary>
            Gets the Parent TreeNode associated to this Node. The parent (EmployeesNode) TreeNode
            Nodes Collection will contain this Node.
            </summary>
        </member>
        <member name="M:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.OrderNode.#ctor(System.String,System.Int32,System.Windows.Forms.TreeNode)">
            <summary>
            Creates a new instance of the OrderNode.
            </summary>
            <param name="nodeName">The Text value to assign to the Node.</param>
            <param name="id">The Order ID</param>
            <param name="parentNode">This nodes parent node.</param>
            <remarks>
            Adds itself to the ParentNode Nodes collection.
            <code>
            internal OrderNode(string nodeName, int id, TreeNode parentNode)
            {
            	this.Text = nodeName;
            	this.id = id;
            	this.parentNode = parentNode;
            	this.ParentNode.Nodes.Add(this);
            }
            </code>
            </remarks>
        </member>
        <member name="P:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.OrderNode.Id">
            <summary>
            Gets the OrderID associated with this node.
            </summary>
        </member>
        <member name="P:Mvc.DerivedPattern.NorthWind.Tutorial.Harness.frmNwindMdiChild.OrderNode.ParentNode">
            <summary>
            Gets the Parent TreeNode associated to this node. The parent (EmployeeNode) TreeNode
            Nodes Collection will contain this Node.
            </summary>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
Australia Australia
Simon Segal resides in Melbourne Australia, is a certified MCAD, MCSD, MCDBA, MCSE, MCST BizTalk Specialist and has been working in the Software Development industry for some 10 years now. His key area of interest are distributed systems / SOA built with Microsoft technologies.

Comments and Discussions