using System;
using System.Data;
using System.Data.AccessClient;
using System.Collections.Generic;
using System.Text;
using Medivators.Common;
using Medivators.Common.Enums;
using Medivators.Common.Logging;


namespace Medivators.Data.Queries
{
	public class DeleteCycleReportLogRecords : SynchronousExecute
	{
		private string _key = string.Empty;
		int rtnVal = 0;

		public new int Delete(string CycleReportKey)
		{
			string sql = string.Empty;

			sql += " delete from CycleReportLogRecords ";
			sql += " where  CycleReportKey=";
			sql += Constants.DoubleQuote + CycleReportKey + Constants.DoubleQuote;
			try
			{
				rtnVal = base.Delete(sql);
			}
			catch (Exception ex)
			{
				ErrorHandler.GetInstance().LogException(
					"DeleteCycleReportLogRecords error executing SQL (" + 
					sql + ")", 
					ex);
				rtnVal = 0;
			}
			return rtnVal;
		}
		public int Delete(List<string> LogRecordKeys)
		{
			int rtnVal = 0;
			if (LogRecordKeys != null & LogRecordKeys.Count > 0)
			{
				string sql = string.Empty;

				foreach (string key in LogRecordKeys)
				{
					if (!sql.Equals(string.Empty))
						sql += ", ";
					sql += Constants.DoubleQuote + key + Constants.DoubleQuote;
				}

				sql = " delete from CycleReportLogRecords " +
					  " where  LogRecordKey in (" +
					  sql + ")";

				try
				{
					rtnVal = base.Delete(sql);
				}
				catch (Exception ex)
				{
					ErrorHandler.GetInstance().LogException("DeleteCycleReportLogRecords", ex);
					rtnVal = 0;
				}
			}
			return rtnVal;
		}
	}
}
