using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace SK.MemberDAL
{
	/// <summary>
	/// MailingListMember 的摘要说明。
	/// </summary>
	public class MailingListMember
	{
		/// <summary>
		/// 邮件列表用户
		/// </summary>
		public MailingListMember()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		/// <summary>
		/// 添加邮件
		/// </summary>
		/// <param name="MailingListID">列表编号</param>
		/// <param name="EmailAddress">邮件地址</param>
		public void Add(object MailingListID,object EmailAddress)
		{
			string spName;
			SqlParameter[] oParms;
			spName = "MailingListMember_Add";
			oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName);
			oParms[0].Value=MailingListID;
			oParms[1].Value=EmailAddress;
			
			SqlHelper.ExecuteNonQuery(Data.ConnString, spName, oParms);
		}
		/// <summary>
		/// 返回指定的邮件列表的所有邮件地址
		/// </summary>
		/// <param name="MailingListID">列表编号</param>
		/// <returns></returns>
		public DataSet List(object MailingListID)
		{
			SqlParameter[] oParms =new SqlParameter[1];
			oParms[0] = new SqlParameter("@MailingListID",MailingListID);

			return SqlHelper.ExecuteDataset(Data.ConnString, CommandType.Text, "select * from MailingListMember where MailingListID=@MailingListID",oParms);
		}
	}
}
