| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- namespace CallCenterApi.BLL
- {
- /// <summary>
- /// 计划表
- /// </summary>
- 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
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(long TaskID)
- {
- return dal.Exists(TaskID);
- }
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public long Add(CallCenterApi.Model.T_CTI_Task model)
- {
- return dal.Add(model);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(CallCenterApi.Model.T_CTI_Task model)
- {
- return dal.Update(model);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool UpdateState(int id, int state)
- {
- return dal.UpdateState(id, state);
- }
- /// <summary>
- /// 更新多条数据
- /// </summary>
- public bool UpdateStateBatch(string where, int state)
- {
- return dal.UpdateStateBatch(where, state);
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- public bool Delete(long TaskID)
- {
- return dal.Delete(TaskID);
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- public bool DeleteList(string TaskIDlist)
- {
- return dal.DeleteList(TaskIDlist);
- }
- /// <summary>
- /// 删除指定任务下所有号码
- /// </summary>
- public int DeletePhoneByTaskId(long TaskID)
- {
- return taskTelNumDAL.DeletePhoneByTaskId(TaskID);
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public CallCenterApi.Model.T_CTI_Task GetModel(long TaskID)
- {
- return dal.GetModel(TaskID);
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public DataSet GetList(string strWhere)
- {
- return dal.GetList(strWhere);
- }
- /// <summary>
- /// 获得前几行数据
- /// </summary>
- public DataSet GetList(int Top, string strWhere, string filedOrder)
- {
- return dal.GetList(Top, strWhere, filedOrder);
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public List<CallCenterApi.Model.T_CTI_Task> GetModelList(string strWhere)
- {
- DataSet ds = dal.GetList(strWhere);
- return DataTableToList(ds.Tables[0]);
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public List<CallCenterApi.Model.T_CTI_Task> DataTableToList(DataTable dt)
- {
- List<CallCenterApi.Model.T_CTI_Task> modelList = new List<CallCenterApi.Model.T_CTI_Task>();
- 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;
- }
- ///// <summary>
- ///// 获得数据列表
- ///// </summary>
- //public List<CallCenterApi.Model.vw_CTI_TaskPager> DataTableToListPager(DataTable dt)
- //{
- // List<CallCenterApi.Model.vw_CTI_TaskPager> modelList = new List<CallCenterApi.Model.vw_CTI_TaskPager>();
- // 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;
- //}
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public DataSet GetAllList()
- {
- return GetList("");
- }
- /// <summary>
- /// 分页获取数据列表
- /// </summary>
- public int GetRecordCount(string strWhere)
- {
- return dal.GetRecordCount(strWhere);
- }
- /// <summary>
- /// 分页获取数据列表
- /// </summary>
- public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
- {
- return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
- }
- /// <summary>
- /// 分页获取数据列表
- /// </summary>
- //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
- }
- }
|