using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using CallCenterApi.DB;
namespace CallCenterApi.DAL
{
///
/// 数据访问类:T_CTI_Task
///
public partial class T_CTI_Task
{
public T_CTI_Task()
{ }
#region Method
///
/// 是否存在该记录
///
public bool Exists(long TaskID)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) from T_CTI_Task");
strSql.Append(" where TaskID=@TaskID");
SqlParameter[] parameters = {
new SqlParameter("@TaskID", SqlDbType.BigInt)
};
parameters[0].Value = TaskID;
return DbHelperSQL.Exists(strSql.ToString(), parameters);
}
///
/// 增加一条数据
///
public long Add(Model.T_CTI_Task model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into T_CTI_Task(");
strSql.Append("TaskName,TrunkGroupID,CallerNum,CallType,ExInfo,MaxTrunkCount,IntensityCoefficient,ItemTableName,State,AddTime,y_PSort,y_TkModelId,y_SXH,y_FPCount,y_YJCount,y_HCCount,y_HSCount,y_HTCount,y_HMCount,y_OkCount,y_RFCount,y_ConsCount,y_InvlCount,y_NoAnswerCount,y_ShutDownCount,TaskType,Pre,Concurrency,ConcurrencyType,PlanStartDate,PlanEndDate,StartTime1,EndTime1,StartTime2,EndTime2,AgentGroupId)");
strSql.Append(" values (");
strSql.Append("@TaskName,@TrunkGroupID,@CallerNum,@CallType,@ExInfo,@MaxTrunkCount,@IntensityCoefficient,@ItemTableName,@State,@AddTime,@y_PSort,@y_TkModelId,@y_SXH,@y_FPCount,@y_YJCount,@y_HCCount,@y_HSCount,@y_HTCount,@y_HMCount,@y_OkCount,@y_RFCount,@y_ConsCount,@y_InvlCount,@y_NoAnswerCount,@y_ShutDownCount,@TaskType,@Pre,@Concurrency,@ConcurrencyType,@PlanStartDate,@PlanEndDate,@StartTime1,@EndTime1,@StartTime2,@EndTime2,@AgentGroupId)");
strSql.Append(";select @@IDENTITY");
SqlParameter[] parameters = {
new SqlParameter("@TaskName", SqlDbType.VarChar,200),
new SqlParameter("@TrunkGroupID", SqlDbType.Int,4),
new SqlParameter("@CallerNum", SqlDbType.VarChar,11),
new SqlParameter("@CallType", SqlDbType.Int,4),
new SqlParameter("@ExInfo", SqlDbType.VarChar,200),
new SqlParameter("@MaxTrunkCount", SqlDbType.Int,4),
new SqlParameter("@IntensityCoefficient", SqlDbType.Float,8),
new SqlParameter("@ItemTableName", SqlDbType.VarChar,100),
new SqlParameter("@State", SqlDbType.Int,4),
new SqlParameter("@AddTime", SqlDbType.DateTime),
new SqlParameter("@y_PSort", SqlDbType.Int,4),
new SqlParameter("@y_TkModelId", SqlDbType.BigInt,8),
new SqlParameter("@y_SXH", SqlDbType.Int,4),
new SqlParameter("@y_FPCount", SqlDbType.Int,4),
new SqlParameter("@y_YJCount", SqlDbType.Int,4),
new SqlParameter("@y_HCCount", SqlDbType.Int,4),
new SqlParameter("@y_HSCount", SqlDbType.Int,4),
new SqlParameter("@y_HTCount", SqlDbType.Int,4),
new SqlParameter("@y_HMCount", SqlDbType.Int,4),
new SqlParameter("@y_OkCount", SqlDbType.Int,4),
new SqlParameter("@y_RFCount", SqlDbType.Int,4),
new SqlParameter("@y_ConsCount", SqlDbType.Int,4),
new SqlParameter("@y_InvlCount", SqlDbType.Int,4),
new SqlParameter("@y_NoAnswerCount", SqlDbType.Int,4),
new SqlParameter("@y_ShutDownCount", SqlDbType.Int,4),
new SqlParameter("@TaskType", SqlDbType.Int,4),
new SqlParameter("@Pre", SqlDbType.VarChar,300),
new SqlParameter("@ConcurrencyType", SqlDbType.Int),
new SqlParameter("@Concurrency", SqlDbType.Float),
new SqlParameter("@PlanStartDate", SqlDbType.DateTime),
new SqlParameter("@PlanEndDate", SqlDbType.DateTime),
new SqlParameter("@StartTime1", SqlDbType.DateTime),
new SqlParameter("@EndTime1", SqlDbType.DateTime),
new SqlParameter("@StartTime2", SqlDbType.DateTime),
new SqlParameter("@EndTime2", SqlDbType.DateTime),
new SqlParameter("@AgentGroupId", SqlDbType.Int)
};
parameters[0].Value = model.TaskName;
parameters[1].Value = model.TrunkGroupID;
parameters[2].Value = model.CallerNum;
parameters[3].Value = model.CallType;
parameters[4].Value = model.ExInfo;
parameters[5].Value = model.MaxTrunkCount;
parameters[6].Value = model.IntensityCoefficient;
parameters[7].Value = model.ItemTableName;
parameters[8].Value = model.State;
parameters[9].Value = model.AddTime;
parameters[10].Value = model.y_PSort;
parameters[11].Value = model.y_TkModelId;
parameters[12].Value = model.y_SXH;
parameters[13].Value = model.y_FPCount;
parameters[14].Value = model.y_YJCount;
parameters[15].Value = model.y_HCCount;
parameters[16].Value = model.y_HSCount;
parameters[17].Value = model.y_HTCount;
parameters[18].Value = model.y_HMCount;
parameters[19].Value = model.y_OkCount;
parameters[20].Value = model.y_RFCount;
parameters[21].Value = model.y_ConsCount;
parameters[22].Value = model.y_InvlCount;
parameters[23].Value = model.y_NoAnswerCount;
parameters[24].Value = model.y_ShutDownCount;
parameters[25].Value = model.TaskType;
parameters[26].Value = model.Pre;
parameters[27].Value = model.ConcurrencyType;
parameters[28].Value = model.Concurrency;
parameters[29].Value = model.PlanStartDate;
parameters[30].Value = model.PlanEndDate;
parameters[31].Value = model.StartTime1;
parameters[32].Value = model.EndTime1;
parameters[33].Value = model.StartTime2;
parameters[34].Value = model.EndTime2;
parameters[35].Value = model.AgentGroupId;
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt64(obj);
}
}
///
/// 更新一条数据
///
public bool Update(CallCenterApi.Model.T_CTI_Task model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_CTI_Task set ");
strSql.Append("TaskName=@TaskName,");
strSql.Append("TrunkGroupID=@TrunkGroupID,");
strSql.Append("CallerNum=@CallerNum,");
strSql.Append("CallType=@CallType,");
strSql.Append("ExInfo=@ExInfo,");
strSql.Append("MaxTrunkCount=@MaxTrunkCount,");
strSql.Append("IntensityCoefficient=@IntensityCoefficient,");
strSql.Append("ItemTableName=@ItemTableName,");
strSql.Append("AddTime=@AddTime,");
strSql.Append("State=@State,");
strSql.Append("y_PSort=@y_PSort,");
strSql.Append("y_TkModelId=@y_TkModelId,");
strSql.Append("y_SXH=@y_SXH,");
strSql.Append("y_FPCount=@y_FPCount,");
strSql.Append("y_YJCount=@y_YJCount,");
strSql.Append("y_HCCount=@y_HCCount,");
strSql.Append("y_HSCount=@y_HSCount,");
strSql.Append("y_HTCount=@y_HTCount,");
strSql.Append("y_HMCount=@y_HMCount,");
strSql.Append("y_OkCount=@y_OkCount,");
strSql.Append("y_RFCount=@y_RFCount,");
strSql.Append("y_ConsCount=@y_ConsCount,");
strSql.Append("y_InvlCount=@y_InvlCount,");
strSql.Append("y_NoAnswerCount=@y_NoAnswerCount,");
strSql.Append("y_ShutDownCount=@y_ShutDownCount,");
strSql.Append("TaskType=@TaskType, ");
strSql.Append("Pre=@Pre, ");
strSql.Append("Concurrency=@Concurrency, ");
strSql.Append("ConcurrencyType=@ConcurrencyType, ");
strSql.Append("PlanStartDate=@PlanStartDate, ");
strSql.Append("PlanEndDate=@PlanEndDate, ");
strSql.Append("StartTime1=@StartTime1, ");
strSql.Append("EndTime1=@EndTime1, ");
strSql.Append("StartTime2=@StartTime2, ");
strSql.Append("EndTime2=@EndTime2, ");
strSql.Append("AgentGroupId=@AgentGroupId ");
strSql.Append(" where TaskID=@TaskID");
SqlParameter[] parameters = {
new SqlParameter("@TaskName", SqlDbType.VarChar,200),
new SqlParameter("@TrunkGroupID", SqlDbType.Int,4),
new SqlParameter("@CallerNum", SqlDbType.VarChar,11),
new SqlParameter("@CallType", SqlDbType.Int,4),
new SqlParameter("@ExInfo", SqlDbType.VarChar,200),
new SqlParameter("@MaxTrunkCount", SqlDbType.Int,4),
new SqlParameter("@IntensityCoefficient", SqlDbType.Float,8),
new SqlParameter("@ItemTableName", SqlDbType.VarChar,100),
new SqlParameter("@State", SqlDbType.Int,4),
new SqlParameter("@AddTime", SqlDbType.DateTime),
new SqlParameter("@y_PSort", SqlDbType.Int,4),
new SqlParameter("@y_TkModelId", SqlDbType.BigInt,8),
new SqlParameter("@y_SXH", SqlDbType.Int,4),
new SqlParameter("@y_FPCount", SqlDbType.Int,4),
new SqlParameter("@y_YJCount", SqlDbType.Int,4),
new SqlParameter("@y_HCCount", SqlDbType.Int,4),
new SqlParameter("@y_HSCount", SqlDbType.Int,4),
new SqlParameter("@y_HTCount", SqlDbType.Int,4),
new SqlParameter("@y_HMCount", SqlDbType.Int,4),
new SqlParameter("@y_OkCount", SqlDbType.Int,4),
new SqlParameter("@y_RFCount", SqlDbType.Int,4),
new SqlParameter("@y_ConsCount", SqlDbType.Int,4),
new SqlParameter("@y_InvlCount", SqlDbType.Int,4),
new SqlParameter("@y_NoAnswerCount", SqlDbType.Int,4),
new SqlParameter("@y_ShutDownCount", SqlDbType.Int,4),
new SqlParameter("@TaskType", SqlDbType.Int,4),
new SqlParameter("@TaskID",SqlDbType.BigInt),
new SqlParameter("@Pre",SqlDbType.VarChar,300),
new SqlParameter("@Concurrency", SqlDbType.Float),
new SqlParameter("@ConcurrencyType", SqlDbType.Int),
new SqlParameter("@PlanStartDate", SqlDbType.DateTime),
new SqlParameter("@PlanEndDate", SqlDbType.DateTime),
new SqlParameter("@StartTime1", SqlDbType.DateTime),
new SqlParameter("@EndTime1", SqlDbType.DateTime),
new SqlParameter("@StartTime2", SqlDbType.DateTime),
new SqlParameter("@EndTime2", SqlDbType.DateTime),
new SqlParameter("@AgentGroupId", SqlDbType.Int)
};
parameters[0].Value = model.TaskName;
parameters[1].Value = model.TrunkGroupID;
parameters[2].Value = model.CallerNum;
parameters[3].Value = model.CallType;
parameters[4].Value = model.ExInfo;
parameters[5].Value = model.MaxTrunkCount;
parameters[6].Value = model.IntensityCoefficient;
parameters[7].Value = model.ItemTableName;
parameters[8].Value = model.State;
parameters[9].Value = model.AddTime;
parameters[10].Value = model.y_PSort;
parameters[11].Value = model.y_TkModelId;
parameters[12].Value = model.y_SXH;
parameters[13].Value = model.y_FPCount;
parameters[14].Value = model.y_YJCount;
parameters[15].Value = model.y_HCCount;
parameters[16].Value = model.y_HSCount;
parameters[17].Value = model.y_HTCount;
parameters[18].Value = model.y_HMCount;
parameters[19].Value = model.y_OkCount;
parameters[20].Value = model.y_RFCount;
parameters[21].Value = model.y_ConsCount;
parameters[22].Value = model.y_InvlCount;
parameters[23].Value = model.y_NoAnswerCount;
parameters[24].Value = model.y_ShutDownCount;
parameters[25].Value = model.TaskType;
parameters[26].Value = model.TaskID;
parameters[27].Value = model.Pre;
parameters[28].Value = model.Concurrency;
parameters[29].Value = model.ConcurrencyType;
parameters[30].Value = model.PlanStartDate;
parameters[31].Value = model.PlanEndDate;
parameters[32].Value = model.StartTime1;
parameters[33].Value = model.EndTime1;
parameters[34].Value = model.StartTime2;
parameters[35].Value = model.EndTime2;
parameters[36].Value = model.AgentGroupId;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新一条数据
///
public bool UpdateState(int id, int state)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_CTI_Task set ");
strSql.Append("State=@State");
strSql.Append(" where TaskID=@TaskID");
SqlParameter[] parameters = {
new SqlParameter("@State", SqlDbType.Int,4),
new SqlParameter("@TaskID", SqlDbType.BigInt,8)};
parameters[0].Value = state;
parameters[1].Value = id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新多条数据
///
public bool UpdateStateBatch(string where, int state)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_CTI_Task set ");
strSql.Append("State=@State");
if (!string.IsNullOrWhiteSpace(where))
{
strSql.Append(" where ");
strSql.Append(where);
}
SqlParameter[] parameters = {
new SqlParameter("@State", SqlDbType.Int,4) };
parameters[0].Value = state;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 删除一条数据
///
public bool Delete(long TaskID)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_CTI_Task ");
strSql.Append(" where TaskID=@TaskID");
SqlParameter[] parameters = {
new SqlParameter("@TaskID", SqlDbType.BigInt)
};
parameters[0].Value = TaskID;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 批量删除数据
///
public bool DeleteList(string TaskIDlist)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_CTI_Task ");
strSql.Append(" where TaskID in (" + TaskIDlist + ") ");
int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 得到一个对象实体
///
public CallCenterApi.Model.T_CTI_Task GetModel(long TaskID)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 TaskID,TaskName,TrunkGroupID,CallerNum,CallType,ExInfo,MaxTrunkCount,IntensityCoefficient,ItemTableName,State,AddTime,y_PSort,y_TkModelId,y_SXH,y_FPCount,y_YJCount,y_HCCount,y_HSCount,y_HTCount,y_HMCount,y_OkCount,y_RFCount,y_ConsCount,y_InvlCount,y_NoAnswerCount,y_ShutDownCount,TaskType,Pre,Concurrency,ConcurrencyType,PlanStartDate,PlanEndDate,StartTime1,EndTime1,StartTime2,EndTime2,AgentGroupId from T_CTI_Task ");
strSql.Append(" where State>=0 and TaskID=@TaskID ");
SqlParameter[] parameters = {
new SqlParameter("@TaskID", SqlDbType.BigInt)
};
parameters[0].Value = TaskID;
CallCenterApi.Model.T_CTI_Task model = new CallCenterApi.Model.T_CTI_Task();
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["TaskID"] != null && ds.Tables[0].Rows[0]["TaskID"].ToString() != "")
{
model.TaskID = long.Parse(ds.Tables[0].Rows[0]["TaskID"].ToString());
}
if (ds.Tables[0].Rows[0]["TaskName"] != null && ds.Tables[0].Rows[0]["TaskName"].ToString() != "")
{
model.TaskName = ds.Tables[0].Rows[0]["TaskName"].ToString();
}
if (ds.Tables[0].Rows[0]["TrunkGroupID"] != null && ds.Tables[0].Rows[0]["TrunkGroupID"].ToString() != "")
{
model.TrunkGroupID = int.Parse(ds.Tables[0].Rows[0]["TrunkGroupID"].ToString());
}
if (ds.Tables[0].Rows[0]["CallerNum"] != null && ds.Tables[0].Rows[0]["CallerNum"].ToString() != "")
{
model.CallerNum = ds.Tables[0].Rows[0]["CallerNum"].ToString();
}
if (ds.Tables[0].Rows[0]["CallType"] != null && ds.Tables[0].Rows[0]["CallType"].ToString() != "")
{
model.CallType = int.Parse(ds.Tables[0].Rows[0]["CallType"].ToString());
}
if (ds.Tables[0].Rows[0]["ExInfo"] != null && ds.Tables[0].Rows[0]["ExInfo"].ToString() != "")
{
model.ExInfo = ds.Tables[0].Rows[0]["ExInfo"].ToString();
}
if (ds.Tables[0].Rows[0]["MaxTrunkCount"] != null && ds.Tables[0].Rows[0]["MaxTrunkCount"].ToString() != "")
{
model.MaxTrunkCount = int.Parse(ds.Tables[0].Rows[0]["MaxTrunkCount"].ToString());
}
if (ds.Tables[0].Rows[0]["IntensityCoefficient"] != null && ds.Tables[0].Rows[0]["IntensityCoefficient"].ToString() != "")
{
model.IntensityCoefficient = decimal.Parse(ds.Tables[0].Rows[0]["IntensityCoefficient"].ToString());
}
if (ds.Tables[0].Rows[0]["ItemTableName"] != null && ds.Tables[0].Rows[0]["ItemTableName"].ToString() != "")
{
model.ItemTableName = ds.Tables[0].Rows[0]["ItemTableName"].ToString();
}
if (ds.Tables[0].Rows[0]["State"] != null && ds.Tables[0].Rows[0]["State"].ToString() != "")
{
model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
}
if (ds.Tables[0].Rows[0]["AddTime"] != null && ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
{
model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
}
if (ds.Tables[0].Rows[0]["y_PSort"] != null && ds.Tables[0].Rows[0]["y_PSort"].ToString() != "")
{
model.y_PSort = int.Parse(ds.Tables[0].Rows[0]["y_PSort"].ToString());
}
if (ds.Tables[0].Rows[0]["y_TkModelId"] != null && ds.Tables[0].Rows[0]["y_TkModelId"].ToString() != "")
{
model.y_TkModelId = long.Parse(ds.Tables[0].Rows[0]["y_TkModelId"].ToString());
}
if (ds.Tables[0].Rows[0]["y_SXH"] != null && ds.Tables[0].Rows[0]["y_SXH"].ToString() != "")
{
model.y_SXH = int.Parse(ds.Tables[0].Rows[0]["y_SXH"].ToString());
}
if (ds.Tables[0].Rows[0]["y_FPCount"] != null && ds.Tables[0].Rows[0]["y_FPCount"].ToString() != "")
{
model.y_FPCount = int.Parse(ds.Tables[0].Rows[0]["y_FPCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_YJCount"] != null && ds.Tables[0].Rows[0]["y_YJCount"].ToString() != "")
{
model.y_YJCount = int.Parse(ds.Tables[0].Rows[0]["y_YJCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_HCCount"] != null && ds.Tables[0].Rows[0]["y_HCCount"].ToString() != "")
{
model.y_HCCount = int.Parse(ds.Tables[0].Rows[0]["y_HCCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_HSCount"] != null && ds.Tables[0].Rows[0]["y_HSCount"].ToString() != "")
{
model.y_HSCount = int.Parse(ds.Tables[0].Rows[0]["y_HSCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_HTCount"] != null && ds.Tables[0].Rows[0]["y_HTCount"].ToString() != "")
{
model.y_HTCount = int.Parse(ds.Tables[0].Rows[0]["y_HTCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_HMCount"] != null && ds.Tables[0].Rows[0]["y_HMCount"].ToString() != "")
{
model.y_HMCount = int.Parse(ds.Tables[0].Rows[0]["y_HMCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_OkCount"] != null && ds.Tables[0].Rows[0]["y_OkCount"].ToString() != "")
{
model.y_OkCount = int.Parse(ds.Tables[0].Rows[0]["y_OkCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_RFCount"] != null && ds.Tables[0].Rows[0]["y_RFCount"].ToString() != "")
{
model.y_RFCount = int.Parse(ds.Tables[0].Rows[0]["y_RFCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_ConsCount"] != null && ds.Tables[0].Rows[0]["y_ConsCount"].ToString() != "")
{
model.y_ConsCount = int.Parse(ds.Tables[0].Rows[0]["y_ConsCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_InvlCount"] != null && ds.Tables[0].Rows[0]["y_InvlCount"].ToString() != "")
{
model.y_InvlCount = int.Parse(ds.Tables[0].Rows[0]["y_InvlCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_NoAnswerCount"] != null && ds.Tables[0].Rows[0]["y_NoAnswerCount"].ToString() != "")
{
model.y_NoAnswerCount = int.Parse(ds.Tables[0].Rows[0]["y_NoAnswerCount"].ToString());
}
if (ds.Tables[0].Rows[0]["y_ShutDownCount"] != null && ds.Tables[0].Rows[0]["y_ShutDownCount"].ToString() != "")
{
model.y_ShutDownCount = int.Parse(ds.Tables[0].Rows[0]["y_ShutDownCount"].ToString());
}
if (ds.Tables[0].Rows[0]["TaskType"] != null && ds.Tables[0].Rows[0]["TaskType"].ToString() != "")
{
model.TaskType = int.Parse(ds.Tables[0].Rows[0]["TaskType"].ToString());
}
if (ds.Tables[0].Rows[0]["Pre"] != null && ds.Tables[0].Rows[0]["Pre"].ToString() != "")
{
model.Pre = ds.Tables[0].Rows[0]["Pre"].ToString();
}
if (ds.Tables[0].Rows[0]["Concurrency"] != null && ds.Tables[0].Rows[0]["Concurrency"].ToString() != "")
{
model.Concurrency = float.Parse(ds.Tables[0].Rows[0]["Concurrency"].ToString());
}
if (ds.Tables[0].Rows[0]["ConcurrencyType"] != null && ds.Tables[0].Rows[0]["ConcurrencyType"].ToString() != "")
{
model.ConcurrencyType = int.Parse(ds.Tables[0].Rows[0]["ConcurrencyType"].ToString());
}
if (ds.Tables[0].Rows[0]["PlanStartDate"] != null && ds.Tables[0].Rows[0]["PlanStartDate"].ToString() != "")
{
model.PlanStartDate = DateTime.Parse(ds.Tables[0].Rows[0]["PlanStartDate"].ToString());
}
if (ds.Tables[0].Rows[0]["PlanEndDate"] != null && ds.Tables[0].Rows[0]["PlanEndDate"].ToString() != "")
{
model.PlanEndDate = DateTime.Parse(ds.Tables[0].Rows[0]["PlanEndDate"].ToString());
}
if (ds.Tables[0].Rows[0]["StartTime1"] != null && ds.Tables[0].Rows[0]["StartTime1"].ToString() != "")
{
model.StartTime1 = DateTime.Parse(ds.Tables[0].Rows[0]["StartTime1"].ToString());
}
if (ds.Tables[0].Rows[0]["StartTime2"] != null && ds.Tables[0].Rows[0]["StartTime2"].ToString() != "")
{
model.StartTime2 = DateTime.Parse(ds.Tables[0].Rows[0]["StartTime2"].ToString());
}
if (ds.Tables[0].Rows[0]["EndTime1"] != null && ds.Tables[0].Rows[0]["EndTime1"].ToString() != "")
{
model.EndTime1 = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime1"].ToString());
}
if (ds.Tables[0].Rows[0]["EndTime2"] != null && ds.Tables[0].Rows[0]["EndTime2"].ToString() != "")
{
model.EndTime2 = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime2"].ToString());
}
if (ds.Tables[0].Rows[0]["AgentGroupId"] != null && ds.Tables[0].Rows[0]["AgentGroupId"].ToString() != "")
{
model.AgentGroupId = Convert.ToInt32(ds.Tables[0].Rows[0]["AgentGroupId"].ToString());
}
return model;
}
else
{
return null;
}
}
public DataSet GetTask(int groupId)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * FROM ");
strSql.Append(" FROM vw_CTI_TaskPager ");
return DbHelperSQL.Query(strSql.ToString());
}
///
/// 获得数据列表
///
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM vw_CTI_TaskPager ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
///
/// 获得前几行数据
///
public DataSet GetList(int Top, string strWhere, string filedOrder)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select ");
if (Top > 0)
{
strSql.Append(" top " + Top.ToString());
}
strSql.Append(" TaskID,TaskName,TrunkGroupID,CallerNum,CallType,ExInfo,MaxTrunkCount,IntensityCoefficient,ItemTableName,State,AddTime,y_PSort,y_TkModelId,y_SXH,y_FPCount,y_YJCount,y_HCCount,y_HSCount,y_HTCount,y_HMCount,y_OkCount,y_RFCount,y_ConsCount,y_InvlCount,y_NoAnswerCount,y_ShutDownCount,TaskType,Pre,Speed ");
strSql.Append(" FROM T_CTI_Task ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
strSql.Append(" order by " + filedOrder);
return DbHelperSQL.Query(strSql.ToString());
}
///
/// 获取记录总数
///
public int GetRecordCount(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) FROM T_CTI_Task ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
object obj = DbHelperSQL.GetSingle(strSql.ToString());
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
}
///
/// 分页获取数据列表
///
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(orderby.Trim()))
{
strSql.Append("order by T." + orderby);
}
else
{
strSql.Append("order by T.TaskID desc");
}
strSql.Append(")AS Row, T.* from T_CTI_Task T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
return DbHelperSQL.Query(strSql.ToString());
}
/*
///
/// 分页获取数据列表
///
public DataSet GetList(int PageSize,int PageIndex,string strWhere)
{
SqlParameter[] parameters = {
new SqlParameter("@tblName", SqlDbType.VarChar, 255),
new SqlParameter("@fldName", SqlDbType.VarChar, 255),
new SqlParameter("@PageSize", SqlDbType.Int),
new SqlParameter("@PageIndex", SqlDbType.Int),
new SqlParameter("@IsReCount", SqlDbType.Bit),
new SqlParameter("@OrderType", SqlDbType.Bit),
new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
};
parameters[0].Value = "T_CTI_Task";
parameters[1].Value = "TaskID";
parameters[2].Value = PageSize;
parameters[3].Value = PageIndex;
parameters[4].Value = 0;
parameters[5].Value = 0;
parameters[6].Value = strWhere;
return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
}*/
#endregion Method
}
}