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

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
			return dal.GetMaxId();
		}
        public object maxNumber(int layer)
        {
            return dal.maxNumber(layer);
        }
        public object maxNumber(int layer, int id)
        {
            return dal.maxNumber(layer, id);
        }
      
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int F_WorkOrderTypeId)
		{
			return dal.Exists(F_WorkOrderTypeId);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public int Update(HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType model)
		{
			return dal.Update(model);
		}

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

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType GetModel(int F_WorkOrderTypeId)
		{
			
			return dal.GetModel(F_WorkOrderTypeId);
		}

	
		/// <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<HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType> DataTableToList(DataTable dt)
		{
			List<HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType> modelList = new List<HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new HySoft.BaseCallCenter.Model.T_Wo_WorkOrderType();
					if(dt.Rows[n]["F_WorkOrderTypeId"]!=null && dt.Rows[n]["F_WorkOrderTypeId"].ToString()!="")
					{
						model.F_WorkOrderTypeId=int.Parse(dt.Rows[n]["F_WorkOrderTypeId"].ToString());
					}
					if(dt.Rows[n]["F_Name"]!=null && dt.Rows[n]["F_Name"].ToString()!="")
					{
					model.F_Name=dt.Rows[n]["F_Name"].ToString();
					}
					if(dt.Rows[n]["F_Ename"]!=null && dt.Rows[n]["F_Ename"].ToString()!="")
					{
					model.F_Ename=dt.Rows[n]["F_Ename"].ToString();
					}
					if(dt.Rows[n]["F_Number"]!=null && dt.Rows[n]["F_Number"].ToString()!="")
					{
					model.F_Number=dt.Rows[n]["F_Number"].ToString();
					}
					if(dt.Rows[n]["F_ParentId"]!=null && dt.Rows[n]["F_ParentId"].ToString()!="")
					{
						model.F_ParentId=int.Parse(dt.Rows[n]["F_ParentId"].ToString());
					}
					if(dt.Rows[n]["F_ParentName"]!=null && dt.Rows[n]["F_ParentName"].ToString()!="")
					{
					model.F_ParentName=dt.Rows[n]["F_ParentName"].ToString();
					}
					if(dt.Rows[n]["F_Sort"]!=null && dt.Rows[n]["F_Sort"].ToString()!="")
					{
						model.F_Sort=int.Parse(dt.Rows[n]["F_Sort"].ToString());
					}
					if(dt.Rows[n]["F_Layer"]!=null && dt.Rows[n]["F_Layer"].ToString()!="")
					{
						model.F_Layer=int.Parse(dt.Rows[n]["F_Layer"].ToString());
					}
					if(dt.Rows[n]["F_DeleteFlag"]!=null && dt.Rows[n]["F_DeleteFlag"].ToString()!="")
					{
						model.F_DeleteFlag=int.Parse(dt.Rows[n]["F_DeleteFlag"].ToString());
					}
					if(dt.Rows[n]["F_Createby"]!=null && dt.Rows[n]["F_Createby"].ToString()!="")
					{
						model.F_Createby=int.Parse(dt.Rows[n]["F_Createby"].ToString());
					}
					if(dt.Rows[n]["F_CreateDate"]!=null && dt.Rows[n]["F_CreateDate"].ToString()!="")
					{
						model.F_CreateDate=DateTime.Parse(dt.Rows[n]["F_CreateDate"].ToString());
					}
					if(dt.Rows[n]["F_Modifyby"]!=null && dt.Rows[n]["F_Modifyby"].ToString()!="")
					{
						model.F_Modifyby=int.Parse(dt.Rows[n]["F_Modifyby"].ToString());
					}
					if(dt.Rows[n]["F_ModifyDate"]!=null && dt.Rows[n]["F_ModifyDate"].ToString()!="")
					{
						model.F_ModifyDate=DateTime.Parse(dt.Rows[n]["F_ModifyDate"].ToString());
					}
					if(dt.Rows[n]["TypeFrom"]!=null && dt.Rows[n]["TypeFrom"].ToString()!="")
					{
						model.TypeFrom=int.Parse(dt.Rows[n]["TypeFrom"].ToString());
					}
					if(dt.Rows[n]["F_Icon"]!=null && dt.Rows[n]["F_Icon"].ToString()!="")
					{
					model.F_Icon=dt.Rows[n]["F_Icon"].ToString();
					}
					if(dt.Rows[n]["F_Remark"]!=null && dt.Rows[n]["F_Remark"].ToString()!="")
					{
					model.F_Remark=dt.Rows[n]["F_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
	}
}

