Click here to Skip to main content
15,894,017 members
Articles / Web Development / ASP.NET

Implementing Model-View-Presenter in ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.80/5 (27 votes)
17 Nov 2007CPOL12 min read 129.8K   2.7K   120  
Three implementations of Model-View-Presenter in ASP.NET 2.0.
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using SubSonic;
using SubSonic.Utilities;


namespace Model.Data.Northwind{
    public partial class SPs{
        
        /// <summary>
        /// Creates an object wrapper for the Ten Most Expensive Products Procedure
        /// </summary>
        public static StoredProcedure TenMostExpensiveProducts()
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("Ten Most Expensive Products" , DataService.GetInstance("Northwind"));
        	
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the Employee Sales by Country Procedure
        /// </summary>
        public static StoredProcedure EmployeeSalesByCountry(DateTime? BeginningDate, DateTime? EndingDate)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("Employee Sales by Country" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@Beginning_Date", BeginningDate,DbType.DateTime);
        	    
            sp.Command.AddParameter("@Ending_Date", EndingDate,DbType.DateTime);
        	    
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the Sales by Year Procedure
        /// </summary>
        public static StoredProcedure SalesByYear(DateTime? BeginningDate, DateTime? EndingDate)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("Sales by Year" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@Beginning_Date", BeginningDate,DbType.DateTime);
        	    
            sp.Command.AddParameter("@Ending_Date", EndingDate,DbType.DateTime);
        	    
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the CustOrdersDetail Procedure
        /// </summary>
        public static StoredProcedure CustOrdersDetail(int? OrderID)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("CustOrdersDetail" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@OrderID", OrderID,DbType.Int32);
        	    
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the CustOrdersOrders Procedure
        /// </summary>
        public static StoredProcedure CustOrdersOrders(string CustomerID)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("CustOrdersOrders" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@CustomerID", CustomerID,DbType.String);
        	    
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the CustOrderHist Procedure
        /// </summary>
        public static StoredProcedure CustOrderHist(string CustomerID)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("CustOrderHist" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@CustomerID", CustomerID,DbType.String);
        	    
            return sp;
        }

        
        /// <summary>
        /// Creates an object wrapper for the SalesByCategory Procedure
        /// </summary>
        public static StoredProcedure SalesByCategory(string CategoryName, string OrdYear)
        {
            SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("SalesByCategory" , DataService.GetInstance("Northwind"));
        	
            sp.Command.AddParameter("@CategoryName", CategoryName,DbType.String);
        	    
            sp.Command.AddParameter("@OrdYear", OrdYear,DbType.String);
        	    
            return sp;
        }

        
    }

    
}

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
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions