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_TaskDaily { /// /// 获得数据列表 /// public DataSet GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select [Date],TaskId,TaskName,AllCount,CalledCount,connectedCount,ConnectedAgentCount "); strSql.Append(" FROM T_CTI_TaskDaily "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } return DbHelperSQL.Query(strSql.ToString()); } /// /// 获取以日期分组总列表 /// /// /// public DataSet GetList() { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT Date,Sum(CalledCount)as CalledCount,sum(connectedcount)as connectedcount, sum(connectedagentcount)as connectedagentcount FROM T_CTI_TaskDaily group by Date"); return DbHelperSQL.Query(strSql.ToString()); } /// /// 得到一个对象实体 /// public Model.T_CTI_TaskDaily DataRowToModel(DataRow row, DataColumnCollection columns) { Model.T_CTI_TaskDaily model = new Model.T_CTI_TaskDaily(); if (row != null) { model.Date = Convert.ToDateTime(row["Date"]); if (columns["TaskId"] != null) { model.TaskId = Convert.ToInt32(row["TaskId"]); } if (columns["TaskName"] != null) { model.TaskName = row["TaskName"].ToString(); } if (columns["AllCount"] != null) { model.AllCount = row["AllCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["AllCount"]); } if (columns["CalledCount"] != null) { model.CalledCount = row["CalledCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["CalledCount"]); } if (columns["ConnectedCount"] != null) { model.ConnectedCount = row["ConnectedCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["ConnectedCount"]); } if (columns["ConnectedAgentCount"] != null) { model.ConnectedAgentCount = row["ConnectedAgentCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["ConnectedAgentCount"]); } //model.UpdateTime = Convert.ToDateTime(row["UpdateTime"]); } return model; } } }