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

namespace CallCenterApi.DAL
{
    public class T_CTI_TaskPhonePart
    {
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [Date],TaskId,PhonePart,Province,City,AllCount,CalledCount,connectedCount,ConnectedAgentCount,UpdateTime");
            strSql.Append(" FROM T_CTI_TaskPhonePart ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.T_CTI_TaskPhonePart DataRowToModel(DataRow row)
        {
            Model.T_CTI_TaskPhonePart model = new Model.T_CTI_TaskPhonePart();
            if (row != null)
            {
                model.Date = Convert.ToDateTime(row["Date"]);
                model.TaskId = Convert.ToInt32(row["TaskId"]);
                model.PhonePart = row["PhonePart"].ToString();
                model.Province = row["Province"].ToString();
                model.City = row["City"].ToString();
                model.AllCount = Convert.ToInt32(row["AllCount"]);
                model.CalledCount = Convert.ToInt32(row["CalledCount"]);
                model.ConnectedCount = Convert.ToInt32(row["ConnectedCount"]);
                model.ConnectedAgentCount = Convert.ToInt32(row["ConnectedAgentCount"]);
                model.UpdateTime = Convert.ToDateTime(row["UpdateTime"]);
            }
            return model;
        }

    }
}
