using System;
using ordersInterfaces;
using System.Web;
using System.Reflection;

namespace ordersystem
{
	/// <summary>
	/// Summary description for utilities.
	/// </summary>
	public class utilities
	{
		static public ICustomerMgr CreateCustomerManager()
		{
			ICustomerMgr retVal = HttpContext.Current.Session["__CustomerMgr"] as ICustomerMgr;
			if (retVal == null)
			{
				//insert code here and then
				//replace the line below
				retVal = new ordersMemory.CustomerMgrMem();
			}
			HttpContext.Current.Session["__CustomerMgr"] = retVal;
			return retVal;
		}
		
		static public IInventoryMgr CreateInventoryManager()
		{
			IInventoryMgr retVal = HttpContext.Current.Session["__InventoryMgr"] as IInventoryMgr;
			if (retVal == null)
			{
				//insert code here and then
				//replace the line below
				retVal = new ordersMemory.InventoryMgrMem();
			}
			HttpContext.Current.Session["__InventoryMgr"] = retVal;
			return retVal;
		}
		
		static public IOrderMgr CreateOrderManager()
		{
			IOrderMgr retVal = HttpContext.Current.Session["__OrderMgr"] as IOrderMgr;
			if (retVal == null)
			{
				//insert code here and then
				//replace the line below
				retVal = new ordersMemory.OrderMgrMem(); 
			}
			HttpContext.Current.Session["__OrderMgr"] = retVal;
			return retVal;
		}
	}
}


