using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCenterApi.BLL
{
    public class T_CTI_TaskVoiceTemp
    {
        private readonly DAL.T_CTI_TaskVoiceTemp dal = new DAL.T_CTI_TaskVoiceTemp();
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Model.T_CTI_TaskVoiceTemp model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CallCenterApi.Model.T_CTI_TaskVoiceTemp model)
        {
            return dal.Update(model);
        }
        /// <summary>
        /// 删除多条数据
        /// </summary>
        public bool DeleteBatch(string ids)
        {
            return dal.DeleteBatch(ids);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CallCenterApi.Model.T_CTI_TaskVoiceTemp GetModel(int id)
        {
            return dal.GetModel(id);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_CTI_TaskVoiceTemp> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_CTI_TaskVoiceTemp> modelList = new List<CallCenterApi.Model.T_CTI_TaskVoiceTemp>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_CTI_TaskVoiceTemp model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_CTI_TaskVoiceTemp();
                    model.F_Id = Convert.ToInt32(dt.Rows[n]["F_Id"]);
                    model.F_CategoryId = Convert.ToInt32(dt.Rows[n]["F_CategoryId"]);
                    model.F_CategoryName = dt.Rows[n]["F_CategoryName"] == DBNull.Value ? "" : dt.Rows[n]["F_CategoryName"].ToString();
                    model.F_Title = dt.Rows[n]["F_Title"] == DBNull.Value ? "" : dt.Rows[n]["F_Title"].ToString();
                    model.F_Content = dt.Rows[n]["F_Content"] == DBNull.Value ? "" : dt.Rows[n]["F_Content"].ToString();
                    model.F_UpdateTime = Convert.ToDateTime(dt.Rows[n]["F_UpdateTime"].ToString());
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_CTI_TaskVoiceTemp> DataTableToList2(DataTable dt)
        {
            List<CallCenterApi.Model.T_CTI_TaskVoiceTemp> modelList = new List<CallCenterApi.Model.T_CTI_TaskVoiceTemp>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_CTI_TaskVoiceTemp model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_CTI_TaskVoiceTemp();
                    model.F_Id = Convert.ToInt32(dt.Rows[n]["F_Id"]);
                    model.F_Title = dt.Rows[n]["F_Title"] == DBNull.Value ? "" : dt.Rows[n]["F_Title"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        public DataSet GetList(string where)
        {
            return dal.GetList(where);
        }
    }
}
