using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.OleDb;

namespace Medivators.BusinessObjects
{
	public interface IDataMapper : IDisposable
	{
		object Data {get; }
		OleDbDataReader Reader { set;}
	}

	public interface IBusinessObjectDataMapper : IDataMapper
	{
		List<IBusinessObject> BusinessObjectCollection { get; }
	}

	public class DataMapCaster
	{
		public static List<IBusinessObject> Cast (IDataMapper Data)
		{
			object obj = Data.Data;
			List<IBusinessObject> rtnVal = null;
			Type t = obj.GetType();
			if (t.Equals(typeof(List<IBusinessObject>)))
				rtnVal = (List<IBusinessObject>)obj;
			else if (t.Equals(typeof(DeviceRecordList)))
				rtnVal = (DeviceRecordList)obj;
			else if (t.Equals(typeof(CycleReportList)))
				rtnVal = (CycleReportList)obj;
			return rtnVal;
		}
	}
}