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

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

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

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

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

		/// <summary>
		/// 得到一个对象实体，从缓存中
		/// </summary>
        //public Maticsoft.Model.T_Wo_WorkOrderHistoryInfo GetModelByCache(int ID)
        //{
			
        //    string CacheKey = "T_Wo_WorkOrderHistoryInfoModel-" + ID;
        //    object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
        //    if (objModel == null)
        //    {
        //        try
        //        {
        //            objModel = dal.GetModel(ID);
        //            if (objModel != null)
        //            {
        //                int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
        //                Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
        //            }
        //        }
        //        catch{}
        //    }
        //    return (Maticsoft.Model.T_Wo_WorkOrderHistoryInfo)objModel;
        //}

		/// <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_Wo_WorkOrderHistoryInfo> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
        public List<ZXDT.CallCenter.Model.T_Wo_WorkOrderHistoryInfo> DataTableToList(DataTable dt)
		{
            List<ZXDT.CallCenter.Model.T_Wo_WorkOrderHistoryInfo> modelList = new List<ZXDT.CallCenter.Model.T_Wo_WorkOrderHistoryInfo>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
                ZXDT.CallCenter.Model.T_Wo_WorkOrderHistoryInfo model;
				for (int n = 0; n < rowsCount; n++)
				{
                    model = new ZXDT.CallCenter.Model.T_Wo_WorkOrderHistoryInfo();
					if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
					{
						model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
					}
					if(dt.Rows[n]["F_HISTORYID"]!=null && dt.Rows[n]["F_HISTORYID"].ToString()!="")
					{
						model.F_HISTORYID=int.Parse(dt.Rows[n]["F_HISTORYID"].ToString());
					}
					if(dt.Rows[n]["F_OPTUSERID"]!=null && dt.Rows[n]["F_OPTUSERID"].ToString()!="")
					{
						model.F_OPTUSERID=int.Parse(dt.Rows[n]["F_OPTUSERID"].ToString());
					}
					if(dt.Rows[n]["F_REMARK"]!=null && dt.Rows[n]["F_REMARK"].ToString()!="")
					{
					model.F_REMARK=dt.Rows[n]["F_REMARK"].ToString();
					}
					if(dt.Rows[n]["F_INSTANCEID"]!=null && dt.Rows[n]["F_INSTANCEID"].ToString()!="")
					{
						model.F_INSTANCEID=int.Parse(dt.Rows[n]["F_INSTANCEID"].ToString());
					}
					if(dt.Rows[n]["F_OPTDATE"]!=null && dt.Rows[n]["F_OPTDATE"].ToString()!="")
					{
						model.F_OPTDATE=DateTime.Parse(dt.Rows[n]["F_OPTDATE"].ToString());
					}
					if(dt.Rows[n]["F_SERVICETYPE"]!=null && dt.Rows[n]["F_SERVICETYPE"].ToString()!="")
					{
					model.F_SERVICETYPE=dt.Rows[n]["F_SERVICETYPE"].ToString();
					}
					if(dt.Rows[n]["F_SERVICENATURE"]!=null && dt.Rows[n]["F_SERVICENATURE"].ToString()!="")
					{
					model.F_SERVICENATURE=dt.Rows[n]["F_SERVICENATURE"].ToString();
					}
					if(dt.Rows[n]["F_SERVICEMETHOD"]!=null && dt.Rows[n]["F_SERVICEMETHOD"].ToString()!="")
					{
					model.F_SERVICEMETHOD=dt.Rows[n]["F_SERVICEMETHOD"].ToString();
					}
					if(dt.Rows[n]["F_VISITOPINION"]!=null && dt.Rows[n]["F_VISITOPINION"].ToString()!="")
					{
					model.F_VISITOPINION=dt.Rows[n]["F_VISITOPINION"].ToString();
					}
					if(dt.Rows[n]["F_VISITTYPE"]!=null && dt.Rows[n]["F_VISITTYPE"].ToString()!="")
					{
					model.F_VISITTYPE=dt.Rows[n]["F_VISITTYPE"].ToString();
					}
					if(dt.Rows[n]["F_CUSTOMERSCORE"]!=null && dt.Rows[n]["F_CUSTOMERSCORE"].ToString()!="")
					{
					model.F_CUSTOMERSCORE=dt.Rows[n]["F_CUSTOMERSCORE"].ToString();
					}
					if(dt.Rows[n]["F_CUSTOMEROPINION"]!=null && dt.Rows[n]["F_CUSTOMEROPINION"].ToString()!="")
					{
					model.F_CUSTOMEROPINION=dt.Rows[n]["F_CUSTOMEROPINION"].ToString();
					}
					if(dt.Rows[n]["F_SOLVE"]!=null && dt.Rows[n]["F_SOLVE"].ToString()!="")
					{
					model.F_SOLVE=dt.Rows[n]["F_SOLVE"].ToString();
					}
					if(dt.Rows[n]["F_ORDERTYPE"]!=null && dt.Rows[n]["F_ORDERTYPE"].ToString()!="")
					{
					model.F_ORDERTYPE=dt.Rows[n]["F_ORDERTYPE"].ToString();
					}
					if(dt.Rows[n]["F_EXAMINETYPE"]!=null && dt.Rows[n]["F_EXAMINETYPE"].ToString()!="")
					{
					model.F_EXAMINETYPE=dt.Rows[n]["F_EXAMINETYPE"].ToString();
					}
                    if (dt.Rows[n]["F_ESTIMATED"] != null && dt.Rows[n]["F_ESTIMATED"].ToString() != "")
                    {
                        model.F_ESTIMATED = dt.Rows[n]["F_ESTIMATED"].ToString();
                    }
                    if (dt.Rows[n]["F_KNOWLEDGE"] != null && dt.Rows[n]["F_KNOWLEDGE"].ToString() != "")
                    {
                        model.F_KNOWLEDGE = int.Parse(dt.Rows[n]["F_KNOWLEDGE"].ToString());
                    }
                    if (dt.Rows[n]["F_COEFFICIENT"] != null && dt.Rows[n]["F_COEFFICIENT"].ToString() != "")
                    {
                        model.F_COEFFICIENT = dt.Rows[n]["F_COEFFICIENT"].ToString();
                    }
                    if (dt.Rows[n]["F_DECLARATION"] != null && dt.Rows[n]["F_DECLARATION"].ToString() != "")
                    {
                        model.F_DECLARATION = dt.Rows[n]["F_DECLARATION"].ToString();
                    }
                    if (dt.Rows[n]["F_ALREADYKNOWLEDGE"] != null && dt.Rows[n]["F_ALREADYKNOWLEDGE"].ToString() != "")
                    {
                        model.F_ALREADYKNOWLEDGE = int.Parse(dt.Rows[n]["F_ALREADYKNOWLEDGE"].ToString());
                    }
                    if (dt.Rows[n]["F_KNOWLEDGENAME"] != null && dt.Rows[n]["F_KNOWLEDGENAME"].ToString() != "")
                    {
                        model.F_KNOWLEDGENAME = dt.Rows[n]["F_KNOWLEDGENAME"].ToString();
                    }
                    if (dt.Rows[n]["F_EXAMION"] != null && dt.Rows[n]["F_EXAMION"].ToString() != "")
                    {
                        model.F_EXAMION = dt.Rows[n]["F_EXAMION"].ToString();
                    }
                    if (dt.Rows[n]["F_PAPERWORKORDERID"] != null && dt.Rows[n]["F_PAPERWORKORDERID"].ToString() != "")
                    {
                        model.F_PAPERWORKORDERID = dt.Rows[n]["F_PAPERWORKORDERID"].ToString();
                    }
					modelList.Add(model);
				}
			}
			return modelList;
		}

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

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

		#endregion  Method
	}
}

