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_TaskCategory
    {
        private readonly DAL.T_CTI_TaskCategory dal = new DAL.T_CTI_TaskCategory();
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Model.T_CTI_TaskCategory model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CallCenterApi.Model.T_CTI_TaskCategory model)
        {
            return dal.Update(model);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CallCenterApi.Model.T_CTI_TaskCategory GetModel(int id)
        {
            return dal.GetModel(id);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_CTI_TaskCategory> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_CTI_TaskCategory> modelList = new List<CallCenterApi.Model.T_CTI_TaskCategory>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_CTI_TaskCategory model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_CTI_TaskCategory();
                    model.F_Id = Convert.ToInt32(dt.Rows[n]["F_Id"]);
                    model.F_ParentId = Convert.ToInt32(dt.Rows[n]["F_ParentId"]);
                    model.F_Name = dt.Rows[n]["F_Name"] == DBNull.Value ? "" : dt.Rows[n]["F_Name"].ToString();
                    model.F_ParentName = dt.Rows[n]["F_ParentName"] == DBNull.Value ? "" : dt.Rows[n]["F_ParentName"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }
        public DataSet GetList(string where)
        {
            return dal.GetList(where);
        }
    }
}
