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

namespace CallCenterApi.BLL
{
    public class T_Call_BanCallOut
    {
        private readonly DAL.T_Call_BanCallOut dal = new DAL.T_Call_BanCallOut();
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Call_BanCallOut> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_Call_BanCallOut> modelList = new List<CallCenterApi.Model.T_Call_BanCallOut>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_Call_BanCallOut model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_Call_BanCallOut();
                    model.Id = Convert.ToInt32(dt.Rows[n]["F_Id"]);
                    model.F_Phone = dt.Rows[n]["F_Phone"] == null ? "" : dt.Rows[n]["F_Phone"].ToString();
                    model.F_SetTime = dt.Rows[n]["F_SetTime"] == null ? null : (DateTime?)Convert.ToDateTime(dt.Rows[n]["F_SetTime"].ToString());
                    model.F_Remark = dt.Rows[n]["F_Remark"] == DBNull.Value ? "" : dt.Rows[n]["F_Remark"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

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

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

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