using System;
using System.Collections.Generic;
using System.Text;
using Medivators.Common;

namespace Medivators.BusinessObjects
{
	public class JoinTableMapper : IDataMapper, IBusinessObjectDataMapper
	{
		private List<IBusinessObject> _list = new List<IBusinessObject>();

		public List<IBusinessObject> BusinessObjectCollection
		{
			get {return _list;}
		}
		public System.Data.OleDb.OleDbDataReader Reader
		{
			set
			{
				try
				{
					while (value.Read())
					{
						CycleReportLogRecord keys = new CycleReportLogRecord();
						keys.CycleReportKey = value.GetString(0);
						keys.LogRecordKey = value.GetString(1);
						_list.Add(keys);
					}
				}
				catch (Exception ex)
				{
					ErrorHandler.GetInstance().LogException("JoinTableMapper.Reader error: ", ex);
				}
			}
		}
		public void Dispose()
		{
			if (_list != null)
				_list.Clear();
		}
		public object Data
		{
			get { return (object)_list; }
		}
	}
}
