|
using System;
using System.Collections.Generic;
using System.Web;
/// <summary>
/// This class is like Business layer facade which will fetch data from Data Access Layer.
/// For simpliciy this class generate dummy data.
/// </summary>
public class ProductFacade
{
#region Constructor
public ProductFacade()
{
}
#endregion
/// <summary>
/// Get all products
/// </summary>
/// <returns>List of products</returns>
public static List<Product> GetAllProducts()
{
List<Product> products = new List<Product>();
Product p = default( Product);
for (int i = 1; i <= 10; i++)
{
p = new Product();
p.ProductCode =string.Format( "p_{0}",i);
p.ProductID = i;
p.ProductName =string.Format( "Product {0}",i);
products.Add(p);
}
return products;
}
/// <summary>
/// Get all Proudcts starting with prefix provided
/// </summary>
/// <param name="prefix">product name prefix</param>
/// <returns></returns>
public static List<Product> GetProducts(string prefix)
{
List<Product> products = new List<Product>();
Product p = default(Product);
for (int i = 1; i <= 10; i++)
{
p = new Product();
p.ProductCode = string.Format("p_{0}", i);
p.ProductID = i;
p.ProductName = string.Format("{0} Product {1}",prefix, i);
products.Add(p);
}
return products;
}
}
|
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.
Sohel has more than six years of experience in professional software development with extensive involvement in Web based Object-Oriented, Multi-Tiered application design and development. He's Familiar with Test Driven Development (TDD) and refactoring techniques as well as having expertise in architecturing large enterprise applications. He has Experience in working with Content Management System and Portal Management System tools like SharePoint, DotNetNuke, Ektron.
Over last few years, he’s involved in development with projects on Microsoft SharePoint and received Microsoft MVP for SharePoint Server Development in the year 2011 and 2012. Currently he's working in a software company located Copenhagen,Denmark on a project integrating SharePoint and SAP. You can read his popular blog at: http://ranaictiu-technicalblog.blogspot.com