using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace CallCenterApi.BLL
{
///
/// 计划表
///
public partial class T_CTI_Task
{
private readonly CallCenterApi.DAL.T_CTI_Task dal = new CallCenterApi.DAL.T_CTI_Task();
private readonly DAL.T_Call_TaskTelNum taskTelNumDAL = new DAL.T_Call_TaskTelNum();
public T_CTI_Task()
{ }
#region Method
///
/// 是否存在该记录
///
public bool Exists(long TaskID)
{
return dal.Exists(TaskID);
}
///
/// 增加一条数据
///
public long Add(CallCenterApi.Model.T_CTI_Task model)
{
return dal.Add(model);
}
///
/// 更新一条数据
///
public bool Update(CallCenterApi.Model.T_CTI_Task model)
{
return dal.Update(model);
}
///
/// 更新一条数据
///
public bool UpdateState(int id, int state)
{
return dal.UpdateState(id, state);
}
///
/// 更新多条数据
///
public bool UpdateStateBatch(string where, int state)
{
return dal.UpdateStateBatch(where, state);
}
///
/// 删除一条数据
///
public bool Delete(long TaskID)
{
return dal.Delete(TaskID);
}
///
/// 删除一条数据
///
public bool DeleteList(string TaskIDlist)
{
return dal.DeleteList(TaskIDlist);
}
///
/// 删除指定任务下所有号码
///
public int DeletePhoneByTaskId(long TaskID)
{
return taskTelNumDAL.DeletePhoneByTaskId(TaskID);
}
///
/// 得到一个对象实体
///
public CallCenterApi.Model.T_CTI_Task GetModel(long TaskID)
{
return dal.GetModel(TaskID);
}
///
/// 获得数据列表
///
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
///
/// 获得前几行数据
///
public DataSet GetList(int Top, string strWhere, string filedOrder)
{
return dal.GetList(Top, strWhere, filedOrder);
}
///
/// 获得数据列表
///
public List GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
///
/// 获得数据列表
///
public List DataTableToList(DataTable dt)
{
List modelList = new List();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
CallCenterApi.Model.T_CTI_Task model;
for (int n = 0; n < rowsCount; n++)
{
model = new CallCenterApi.Model.T_CTI_Task();
if (dt.Rows[n]["TaskID"] != null && dt.Rows[n]["TaskID"].ToString() != "")
{
model.TaskID = long.Parse(dt.Rows[n]["TaskID"].ToString());
}
if (dt.Rows[n]["TaskName"] != null && dt.Rows[n]["TaskName"].ToString() != "")
{
model.TaskName = dt.Rows[n]["TaskName"].ToString();
}
if (dt.Rows[n]["TrunkGroupID"] != null && dt.Rows[n]["TrunkGroupID"].ToString() != "")
{
model.TrunkGroupID = int.Parse(dt.Rows[n]["TrunkGroupID"].ToString());
}
if (dt.Rows[n]["CallerNum"] != null && dt.Rows[n]["CallerNum"].ToString() != "")
{
model.CallerNum = dt.Rows[n]["CallerNum"].ToString();
}
if (dt.Rows[n]["CallType"] != null && dt.Rows[n]["CallType"].ToString() != "")
{
model.CallType = int.Parse(dt.Rows[n]["CallType"].ToString());
}
if (dt.Rows[n]["ExInfo"] != null && dt.Rows[n]["ExInfo"].ToString() != "")
{
model.ExInfo = dt.Rows[n]["ExInfo"].ToString();
}
if (dt.Rows[n]["MaxTrunkCount"] != null && dt.Rows[n]["MaxTrunkCount"].ToString() != "")
{
model.MaxTrunkCount = int.Parse(dt.Rows[n]["MaxTrunkCount"].ToString());
}
if (dt.Rows[n]["IntensityCoefficient"] != null && dt.Rows[n]["IntensityCoefficient"].ToString() != "")
{
model.IntensityCoefficient = decimal.Parse(dt.Rows[n]["IntensityCoefficient"].ToString());
}
if (dt.Rows[n]["ItemTableName"] != null && dt.Rows[n]["ItemTableName"].ToString() != "")
{
model.ItemTableName = dt.Rows[n]["ItemTableName"].ToString();
}
if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
{
model.State = int.Parse(dt.Rows[n]["State"].ToString());
}
if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "")
{
model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
}
if (dt.Rows[n]["y_PSort"] != null && dt.Rows[n]["y_PSort"].ToString() != "")
{
model.y_PSort = int.Parse(dt.Rows[n]["y_PSort"].ToString());
}
if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
{
model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
}
//if (dt.Columns.Contains("F_Title"))
//{
// if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
// {
// model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
// }
//}
if (dt.Rows[n]["y_SXH"] != null && dt.Rows[n]["y_SXH"].ToString() != "")
{
model.y_SXH = int.Parse(dt.Rows[n]["y_SXH"].ToString());
}
if (dt.Rows[n]["y_FPCount"] != null && dt.Rows[n]["y_FPCount"].ToString() != "")
{
model.y_FPCount = int.Parse(dt.Rows[n]["y_FPCount"].ToString());
}
if (dt.Rows[n]["y_YJCount"] != null && dt.Rows[n]["y_YJCount"].ToString() != "")
{
model.y_YJCount = int.Parse(dt.Rows[n]["y_YJCount"].ToString());
}
if (dt.Rows[n]["y_HCCount"] != null && dt.Rows[n]["y_HCCount"].ToString() != "")
{
model.y_HCCount = int.Parse(dt.Rows[n]["y_HCCount"].ToString());
}
if (dt.Rows[n]["y_HSCount"] != null && dt.Rows[n]["y_HSCount"].ToString() != "")
{
model.y_HSCount = int.Parse(dt.Rows[n]["y_HSCount"].ToString());
}
if (dt.Rows[n]["y_HTCount"] != null && dt.Rows[n]["y_HTCount"].ToString() != "")
{
model.y_HTCount = int.Parse(dt.Rows[n]["y_HTCount"].ToString());
}
if (dt.Rows[n]["y_HMCount"] != null && dt.Rows[n]["y_HMCount"].ToString() != "")
{
model.y_HMCount = int.Parse(dt.Rows[n]["y_HMCount"].ToString());
}
if (dt.Rows[n]["y_OkCount"] != null && dt.Rows[n]["y_OkCount"].ToString() != "")
{
model.y_OkCount = int.Parse(dt.Rows[n]["y_OkCount"].ToString());
}
if (dt.Rows[n]["y_RFCount"] != null && dt.Rows[n]["y_RFCount"].ToString() != "")
{
model.y_RFCount = int.Parse(dt.Rows[n]["y_RFCount"].ToString());
}
if (dt.Rows[n]["y_ConsCount"] != null && dt.Rows[n]["y_ConsCount"].ToString() != "")
{
model.y_ConsCount = int.Parse(dt.Rows[n]["y_ConsCount"].ToString());
}
if (dt.Rows[n]["y_InvlCount"] != null && dt.Rows[n]["y_InvlCount"].ToString() != "")
{
model.y_InvlCount = int.Parse(dt.Rows[n]["y_InvlCount"].ToString());
}
if (dt.Rows[n]["y_NoAnswerCount"] != null && dt.Rows[n]["y_NoAnswerCount"].ToString() != "")
{
model.y_NoAnswerCount = int.Parse(dt.Rows[n]["y_NoAnswerCount"].ToString());
}
if (dt.Rows[n]["y_ShutDownCount"] != null && dt.Rows[n]["y_ShutDownCount"].ToString() != "")
{
model.y_ShutDownCount = int.Parse(dt.Rows[n]["y_ShutDownCount"].ToString());
}
if (dt.Rows[n]["TaskType"] != null && dt.Rows[n]["TaskType"].ToString() != "")
{
model.TaskType = int.Parse(dt.Rows[n]["TaskType"].ToString());
}
if (dt.Rows[n]["Pre"] != null && dt.Rows[n]["Pre"].ToString() != "")
{
model.Pre = dt.Rows[n]["Pre"].ToString();
}
if (dt.Rows[n]["Concurrency"] != null && dt.Rows[n]["Concurrency"].ToString() != "")
{
model.Concurrency = float.Parse(dt.Rows[n]["Concurrency"].ToString());
}
if (dt.Rows[n]["ConcurrencyType"] != null && dt.Rows[n]["ConcurrencyType"].ToString() != "")
{
model.ConcurrencyType = int.Parse(dt.Rows[n]["ConcurrencyType"].ToString());
}
if (dt.Rows[n]["PlanStartDate"] != null && dt.Rows[n]["PlanStartDate"].ToString() != "")
{
model.PlanStartDate = DateTime.Parse(dt.Rows[n]["PlanStartDate"].ToString());
}
if (dt.Rows[n]["PlanEndDate"] != null && dt.Rows[n]["PlanEndDate"].ToString() != "")
{
model.PlanEndDate = DateTime.Parse(dt.Rows[n]["PlanEndDate"].ToString());
}
if (dt.Rows[n]["StartTime1"] != null && dt.Rows[n]["StartTime1"].ToString() != "")
{
model.StartTime1 = DateTime.Parse(dt.Rows[n]["StartTime1"].ToString());
}
if (dt.Rows[n]["StartTime2"] != null && dt.Rows[n]["StartTime2"].ToString() != "")
{
model.StartTime2 = DateTime.Parse(dt.Rows[n]["StartTime2"].ToString());
}
if (dt.Rows[n]["EndTime1"] != null && dt.Rows[n]["EndTime1"].ToString() != "")
{
model.EndTime1 = DateTime.Parse(dt.Rows[n]["EndTime1"].ToString());
}
if (dt.Rows[n]["EndTime2"] != null && dt.Rows[n]["EndTime2"].ToString() != "")
{
model.EndTime2 = DateTime.Parse(dt.Rows[n]["EndTime2"].ToString());
}
if (dt.Rows[n]["AgentGroupId"] != null && dt.Rows[n]["AgentGroupId"].ToString() != "")
{
model.AgentGroupId = Convert.ToInt32(dt.Rows[n]["AgentGroupId"].ToString());
}
modelList.Add(model);
}
}
return modelList;
}
/////
///// 获得数据列表
/////
//public List DataTableToListPager(DataTable dt)
//{
// List modelList = new List();
// int rowsCount = dt.Rows.Count;
// var columns = dt.Columns;
// if (rowsCount > 0)
// {
// CallCenterApi.Model.vw_CTI_TaskPager model;
// for (int n = 0; n < rowsCount; n++)
// {
// try
// {
// model = new CallCenterApi.Model.vw_CTI_TaskPager();
// if (dt.Rows[n]["TaskID"] != null && dt.Rows[n]["TaskID"].ToString() != "")
// {
// model.TaskID = long.Parse(dt.Rows[n]["TaskID"].ToString());
// }
// if (dt.Rows[n]["TaskName"] != null && dt.Rows[n]["TaskName"].ToString() != "")
// {
// model.TaskName = dt.Rows[n]["TaskName"].ToString();
// }
// if (columns.Contains("TrunkGroupID"))
// {
// if (dt.Rows[n]["TrunkGroupID"] != null && dt.Rows[n]["TrunkGroupID"].ToString() != "")
// {
// model.TrunkGroupID = int.Parse(dt.Rows[n]["TrunkGroupID"].ToString());
// }
// }
// if (dt.Rows[n]["CallerNum"] != null && dt.Rows[n]["CallerNum"].ToString() != "")
// {
// model.CallerNum = dt.Rows[n]["CallerNum"].ToString();
// }
// if (dt.Rows[n]["CallType"] != null && dt.Rows[n]["CallType"].ToString() != "")
// {
// model.CallType = int.Parse(dt.Rows[n]["CallType"].ToString());
// }
// if (dt.Rows[n]["ExInfo"] != null && dt.Rows[n]["ExInfo"].ToString() != "")
// {
// model.ExInfo = dt.Rows[n]["ExInfo"].ToString();
// }
// if (dt.Rows[n]["MaxTrunkCount"] != null && dt.Rows[n]["MaxTrunkCount"].ToString() != "")
// {
// model.MaxTrunkCount = int.Parse(dt.Rows[n]["MaxTrunkCount"].ToString());
// }
// if (dt.Rows[n]["IntensityCoefficient"] != null && dt.Rows[n]["IntensityCoefficient"].ToString() != "")
// {
// model.IntensityCoefficient = decimal.Parse(dt.Rows[n]["IntensityCoefficient"].ToString());
// }
// if (dt.Rows[n]["ItemTableName"] != null && dt.Rows[n]["ItemTableName"].ToString() != "")
// {
// model.ItemTableName = dt.Rows[n]["ItemTableName"].ToString();
// }
// if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
// {
// model.State = int.Parse(dt.Rows[n]["State"].ToString());
// }
// if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "")
// {
// model.AddTime = Convert.ToDateTime(dt.Rows[n]["AddTime"].ToString());
// }
// if (dt.Rows[n]["y_PSort"] != null && dt.Rows[n]["y_PSort"].ToString() != "")
// {
// model.y_PSort = int.Parse(dt.Rows[n]["y_PSort"].ToString());
// }
// if (dt.Rows[n]["y_TkModelId"] != null && dt.Rows[n]["y_TkModelId"].ToString() != "")
// {
// model.y_TkModelId = long.Parse(dt.Rows[n]["y_TkModelId"].ToString());
// }
// if (dt.Rows[n]["y_SXH"] != null && dt.Rows[n]["y_SXH"].ToString() != "")
// {
// model.y_SXH = int.Parse(dt.Rows[n]["y_SXH"].ToString());
// }
// if (dt.Rows[n]["y_FPCount"] != null && dt.Rows[n]["y_FPCount"].ToString() != "")
// {
// model.y_FPCount = int.Parse(dt.Rows[n]["y_FPCount"].ToString());
// }
// if (dt.Rows[n]["y_YJCount"] != null && dt.Rows[n]["y_YJCount"].ToString() != "")
// {
// model.y_YJCount = int.Parse(dt.Rows[n]["y_YJCount"].ToString());
// }
// if (dt.Rows[n]["y_HCCount"] != null && dt.Rows[n]["y_HCCount"].ToString() != "")
// {
// model.y_HCCount = int.Parse(dt.Rows[n]["y_HCCount"].ToString());
// }
// if (dt.Rows[n]["y_HSCount"] != null && dt.Rows[n]["y_HSCount"].ToString() != "")
// {
// model.y_HSCount = int.Parse(dt.Rows[n]["y_HSCount"].ToString());
// }
// if (dt.Rows[n]["y_HTCount"] != null && dt.Rows[n]["y_HTCount"].ToString() != "")
// {
// model.y_HTCount = int.Parse(dt.Rows[n]["y_HTCount"].ToString());
// }
// if (dt.Rows[n]["y_HMCount"] != null && dt.Rows[n]["y_HMCount"].ToString() != "")
// {
// model.y_HMCount = int.Parse(dt.Rows[n]["y_HMCount"].ToString());
// }
// if (dt.Rows[n]["y_OkCount"] != null && dt.Rows[n]["y_OkCount"].ToString() != "")
// {
// model.y_OkCount = int.Parse(dt.Rows[n]["y_OkCount"].ToString());
// }
// if (dt.Rows[n]["y_RFCount"] != null && dt.Rows[n]["y_RFCount"].ToString() != "")
// {
// model.y_RFCount = int.Parse(dt.Rows[n]["y_RFCount"].ToString());
// }
// if (dt.Rows[n]["y_ConsCount"] != null && dt.Rows[n]["y_ConsCount"].ToString() != "")
// {
// model.y_ConsCount = int.Parse(dt.Rows[n]["y_ConsCount"].ToString());
// }
// if (dt.Rows[n]["y_InvlCount"] != null && dt.Rows[n]["y_InvlCount"].ToString() != "")
// {
// model.y_InvlCount = int.Parse(dt.Rows[n]["y_InvlCount"].ToString());
// }
// if (dt.Rows[n]["y_NoAnswerCount"] != null && dt.Rows[n]["y_NoAnswerCount"].ToString() != "")
// {
// model.y_NoAnswerCount = int.Parse(dt.Rows[n]["y_NoAnswerCount"].ToString());
// }
// if (dt.Rows[n]["y_ShutDownCount"] != null && dt.Rows[n]["y_ShutDownCount"].ToString() != "")
// {
// model.y_ShutDownCount = int.Parse(dt.Rows[n]["y_ShutDownCount"].ToString());
// }
// if (dt.Rows[n]["TaskType"] != null && dt.Rows[n]["TaskType"].ToString() != "")
// {
// model.TaskType = int.Parse(dt.Rows[n]["TaskType"].ToString());
// }
// model.F_Title = dt.Rows[n]["F_Title"].ToString();
// modelList.Add(model);
// }
// catch
// {
// throw new Exception("AddTime=" + dt.Rows[n]["AddTime"].ToString());
// }
// }
// }
// return modelList;
//}
///
/// 获得数据列表
///
public DataSet GetAllList()
{
return GetList("");
}
///
/// 分页获取数据列表
///
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
///
/// 分页获取数据列表
///
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
}
///
/// 分页获取数据列表
///
//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
//{
//return dal.GetList(PageSize,PageIndex,strWhere);
//}
public DataSet GetTask(int groupId)
{
return dal.GetTask(groupId);
}
#endregion Method
}
}