using System;
using System.Data;
using System.Collections.Generic;
using ZXDT.Common;
using ZXDT.CallCenter.Model;
namespace ZXDT.CallCenter.BLL
{
	/// <summary>
	/// T_Sms_SmsModel
	/// </summary>
	public partial class T_Sms_SmsModel
	{
		private readonly ZXDT.CallCenter.DAL.T_Sms_SmsModel dal=new ZXDT.CallCenter.DAL.T_Sms_SmsModel();
		public T_Sms_SmsModel()
		{}
		#region  Method

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
			return dal.GetMaxId();
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int ModelId)
		{
			return dal.Exists(ModelId);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(ZXDT.CallCenter.Model.T_Sms_SmsModel model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ZXDT.CallCenter.Model.T_Sms_SmsModel model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int ModelId)
		{
			
			return dal.Delete(ModelId);
		}
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string ModelIdlist )
		{
			return dal.DeleteList(ModelIdlist );
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ZXDT.CallCenter.Model.T_Sms_SmsModel GetModel(int ModelId)
		{
			
			return dal.GetModel(ModelId);
		}


		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ZXDT.CallCenter.Model.T_Sms_SmsModel> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ZXDT.CallCenter.Model.T_Sms_SmsModel> DataTableToList(DataTable dt)
		{
			List<ZXDT.CallCenter.Model.T_Sms_SmsModel> modelList = new List<ZXDT.CallCenter.Model.T_Sms_SmsModel>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				ZXDT.CallCenter.Model.T_Sms_SmsModel model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new ZXDT.CallCenter.Model.T_Sms_SmsModel();
					if(dt.Rows[n]["ModelId"]!=null && dt.Rows[n]["ModelId"].ToString()!="")
					{
						model.ModelId=int.Parse(dt.Rows[n]["ModelId"].ToString());
					}
					if(dt.Rows[n]["Name"]!=null && dt.Rows[n]["Name"].ToString()!="")
					{
					model.Name=dt.Rows[n]["Name"].ToString();
					}
					if(dt.Rows[n]["Contents"]!=null && dt.Rows[n]["Contents"].ToString()!="")
					{
					model.Contents=dt.Rows[n]["Contents"].ToString();
					}
					if(dt.Rows[n]["AddPeople"]!=null && dt.Rows[n]["AddPeople"].ToString()!="")
					{
					model.AddPeople=dt.Rows[n]["AddPeople"].ToString();
					}
					if(dt.Rows[n]["AddTime"]!=null && dt.Rows[n]["AddTime"].ToString()!="")
					{
						model.AddTime=DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
					}
					if(dt.Rows[n]["TypeId"]!=null && dt.Rows[n]["TypeId"].ToString()!="")
					{
						model.TypeId=int.Parse(dt.Rows[n]["TypeId"].ToString());
					}
					if(dt.Rows[n]["EditPeople"]!=null && dt.Rows[n]["EditPeople"].ToString()!="")
					{
					model.EditPeople=dt.Rows[n]["EditPeople"].ToString();
					}
					if(dt.Rows[n]["EditTime"]!=null && dt.Rows[n]["EditTime"].ToString()!="")
					{
						model.EditTime=DateTime.Parse(dt.Rows[n]["EditTime"].ToString());
					}
					if(dt.Rows[n]["State"]!=null && dt.Rows[n]["State"].ToString()!="")
					{
					model.State=dt.Rows[n]["State"].ToString();
					}
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}

		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  Method
	}
}

