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_Sys_BanCallOutTime
    {
        private readonly DAL.T_Sys_BanCallOutTime dal = new DAL.T_Sys_BanCallOutTime();
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Sys_BanCallOutTime> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_Sys_BanCallOutTime> modelList = new List<CallCenterApi.Model.T_Sys_BanCallOutTime>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_Sys_BanCallOutTime model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_Sys_BanCallOutTime();
                    model.Id = Convert.ToInt32(dt.Rows[n]["F_Id"]);
                    model.StartTime1 = dt.Rows[0]["StartTime1"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dt.Rows[0]["StartTime1"].ToString());
                    model.StartTime2 = dt.Rows[0]["StartTime2"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dt.Rows[0]["StartTime2"].ToString());
                    model.EndTime1 = dt.Rows[0]["EndTime1"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dt.Rows[0]["EndTime1"].ToString());
                    model.EndTime2 = dt.Rows[0]["EndTime2"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dt.Rows[0]["EndTime2"].ToString());
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        public Model.T_Sys_BanCallOutTime GetModel(string phone)
        {
            return dal.GetModel(phone);
        }

        public int Add(Model.T_Sys_BanCallOutTime model)
        {
            return dal.Add(model);
        }

        public int deleteBatch(string ids)
        {
            return dal.DeleteBatch(ids);
        }

    }
}
