using CallCenterApi.DB;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CallCenterApi.DAL
{
///
/// 数据访问类:T_Call_TaskTelNum
///
public partial class T_Call_TaskTelNum
{
public T_Call_TaskTelNum()
{ }
#region Method
///
/// 是否存在该记录
///
public bool Exists(int F_Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) from T_Call_TaskTelNum");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_Id", SqlDbType.Int,4)
};
parameters[0].Value = F_Id;
return DbHelperSQL.Exists(strSql.ToString(), parameters);
}
///
/// 增加一条数据
///
public int Add(CallCenterApi.Model.T_Call_TaskTelNum model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into T_Call_TaskTelNum(");
strSql.Append("F_TaskId,F_Phone,F_Customer,F_PhoneBy,F_Sex,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,ExpandIntField1,ExpandIntField2,ExpandIntField3,ExpandIntField4,ExpandIntField5,ExpandIntField6,ExpandDecField1,ExpandDecField2,ExpandDecField3,ExpandDecField4,ExpandDecField5,ExpandDecField6,ExpandDatField1,ExpandDatField2,ExpandDatField3,ExpandDatField4,ExpandDatField5,ExpandDatField6,ExpandVchField1,ExpandVchField2,ExpandVchField3,ExpandVchField4,ExpandVchField5,ExpandVchField6,ExpandVchField7,ExpandVchField8,ExpandVchField9,ExpandVchField10,ExpandVchField11,ExpandVchField12,ExpandVchField13,ExpandVchField14,ExpandVchField15,ExpandSintField1,ExpandSintField2,ExpandSintField3,ExpandSintField4,ExpandSintField5)");
strSql.Append(" values (");
strSql.Append("@F_TaskId,@F_Phone,@F_Customer,@F_PhoneBy,@F_Sex,@F_FPState,@F_YJState,@F_HCState,@F_UserId,@F_UserName,@F_CreateTime,@ExpandIntField1,@ExpandIntField2,@ExpandIntField3,@ExpandIntField4,@ExpandIntField5,@ExpandIntField6,@ExpandDecField1,@ExpandDecField2,@ExpandDecField3,@ExpandDecField4,@ExpandDecField5,@ExpandDecField6,@ExpandDatField1,@ExpandDatField2,@ExpandDatField3,@ExpandDatField4,@ExpandDatField5,@ExpandDatField6,@ExpandVchField1,@ExpandVchField2,@ExpandVchField3,@ExpandVchField4,@ExpandVchField5,@ExpandVchField6,@ExpandVchField7,@ExpandVchField8,@ExpandVchField9,@ExpandVchField10,@ExpandVchField11,@ExpandVchField12,@ExpandVchField13,@ExpandVchField14,@ExpandVchField15,@ExpandSintField1,@ExpandSintField2,@ExpandSintField3,@ExpandSintField4,@ExpandSintField5)");
strSql.Append(";select @@IDENTITY");
SqlParameter[] parameters = {
new SqlParameter("@F_TaskId", SqlDbType.Int,4),
new SqlParameter("@F_Phone", SqlDbType.VarChar,200),
new SqlParameter("@F_Customer", SqlDbType.VarChar,200),
new SqlParameter("@F_PhoneBy", SqlDbType.VarChar,200),
new SqlParameter("@F_Sex", SqlDbType.VarChar,20),
new SqlParameter("@F_FPState", SqlDbType.Int,4),
new SqlParameter("@F_YJState", SqlDbType.Int,4),
new SqlParameter("@F_HCState", SqlDbType.Int,4),
new SqlParameter("@F_UserId", SqlDbType.Int,4),
new SqlParameter("@F_UserName", SqlDbType.VarChar,50),
new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
new SqlParameter("@ExpandIntField1", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField2", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField3", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField4", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField5", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField6", SqlDbType.Int,4),
new SqlParameter("@ExpandDecField1", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField2", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField3", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField4", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField5", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField6", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDatField1", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField2", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField3", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField4", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField5", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField6", SqlDbType.DateTime),
new SqlParameter("@ExpandVchField1", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField2", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField3", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField4", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField5", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField6", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField7", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField8", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField9", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField10", SqlDbType.VarChar,500),
new SqlParameter("@ExpandVchField11", SqlDbType.VarChar,500),
new SqlParameter("@ExpandVchField12", SqlDbType.VarChar,2000),
new SqlParameter("@ExpandVchField13", SqlDbType.VarChar,2000),
new SqlParameter("@ExpandVchField14", SqlDbType.Text),
new SqlParameter("@ExpandVchField15", SqlDbType.Text),
new SqlParameter("@ExpandSintField1", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField2", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField3", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField4", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField5", SqlDbType.SmallInt,2)};
parameters[0].Value = model.F_TaskId;
parameters[1].Value = model.F_Phone;
parameters[2].Value = model.F_Customer;
parameters[3].Value = model.F_PhoneBy;
parameters[4].Value = model.F_Sex;
parameters[5].Value = model.F_FPState;
parameters[6].Value = model.F_YJState;
parameters[7].Value = model.F_HCState;
parameters[8].Value = model.F_UserId;
parameters[9].Value = model.F_UserName;
parameters[10].Value = model.F_CreateTime;
parameters[11].Value = model.ExpandIntField1;
parameters[12].Value = model.ExpandIntField2;
parameters[13].Value = model.ExpandIntField3;
parameters[14].Value = model.ExpandIntField4;
parameters[15].Value = model.ExpandIntField5;
parameters[16].Value = model.ExpandIntField6;
parameters[17].Value = model.ExpandDecField1;
parameters[18].Value = model.ExpandDecField2;
parameters[19].Value = model.ExpandDecField3;
parameters[20].Value = model.ExpandDecField4;
parameters[21].Value = model.ExpandDecField5;
parameters[22].Value = model.ExpandDecField6;
parameters[23].Value = model.ExpandDatField1;
parameters[24].Value = model.ExpandDatField2;
parameters[25].Value = model.ExpandDatField3;
parameters[26].Value = model.ExpandDatField4;
parameters[27].Value = model.ExpandDatField5;
parameters[28].Value = model.ExpandDatField6;
parameters[29].Value = model.ExpandVchField1;
parameters[30].Value = model.ExpandVchField2;
parameters[31].Value = model.ExpandVchField3;
parameters[32].Value = model.ExpandVchField4;
parameters[33].Value = model.ExpandVchField5;
parameters[34].Value = model.ExpandVchField6;
parameters[35].Value = model.ExpandVchField7;
parameters[36].Value = model.ExpandVchField8;
parameters[37].Value = model.ExpandVchField9;
parameters[38].Value = model.ExpandVchField10;
parameters[39].Value = model.ExpandVchField11;
parameters[40].Value = model.ExpandVchField12;
parameters[41].Value = model.ExpandVchField13;
parameters[42].Value = model.ExpandVchField14;
parameters[43].Value = model.ExpandVchField15;
parameters[44].Value = model.ExpandSintField1;
parameters[45].Value = model.ExpandSintField2;
parameters[46].Value = model.ExpandSintField3;
parameters[47].Value = model.ExpandSintField4;
parameters[48].Value = model.ExpandSintField5;
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
}
///
/// 更新一条数据
///
public bool Update(CallCenterApi.Model.T_Call_TaskTelNum model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_TaskId=@F_TaskId,");
strSql.Append("F_Phone=@F_Phone,");
strSql.Append("F_Customer=@F_Customer,");
strSql.Append("F_PhoneBy=@F_PhoneBy,");
strSql.Append("F_Sex=@F_Sex,");
strSql.Append("F_FPState=@F_FPState,");
strSql.Append("F_YJState=@F_YJState,");
strSql.Append("F_HCState=@F_HCState,");
strSql.Append("F_UserId=@F_UserId,");
strSql.Append("F_UserName=@F_UserName,");
strSql.Append("F_CreateTime=@F_CreateTime,");
strSql.Append("ExpandIntField1=@ExpandIntField1,");
strSql.Append("ExpandIntField2=@ExpandIntField2,");
strSql.Append("ExpandIntField3=@ExpandIntField3,");
strSql.Append("ExpandIntField4=@ExpandIntField4,");
strSql.Append("ExpandIntField5=@ExpandIntField5,");
strSql.Append("ExpandIntField6=@ExpandIntField6,");
strSql.Append("ExpandDecField1=@ExpandDecField1,");
strSql.Append("ExpandDecField2=@ExpandDecField2,");
strSql.Append("ExpandDecField3=@ExpandDecField3,");
strSql.Append("ExpandDecField4=@ExpandDecField4,");
strSql.Append("ExpandDecField5=@ExpandDecField5,");
strSql.Append("ExpandDecField6=@ExpandDecField6,");
strSql.Append("ExpandDatField1=@ExpandDatField1,");
strSql.Append("ExpandDatField2=@ExpandDatField2,");
strSql.Append("ExpandDatField3=@ExpandDatField3,");
strSql.Append("ExpandDatField4=@ExpandDatField4,");
strSql.Append("ExpandDatField5=@ExpandDatField5,");
strSql.Append("ExpandDatField6=@ExpandDatField6,");
strSql.Append("ExpandVchField1=@ExpandVchField1,");
strSql.Append("ExpandVchField2=@ExpandVchField2,");
strSql.Append("ExpandVchField3=@ExpandVchField3,");
strSql.Append("ExpandVchField4=@ExpandVchField4,");
strSql.Append("ExpandVchField5=@ExpandVchField5,");
strSql.Append("ExpandVchField6=@ExpandVchField6,");
strSql.Append("ExpandVchField7=@ExpandVchField7,");
strSql.Append("ExpandVchField8=@ExpandVchField8,");
strSql.Append("ExpandVchField9=@ExpandVchField9,");
strSql.Append("ExpandVchField10=@ExpandVchField10,");
strSql.Append("ExpandVchField11=@ExpandVchField11,");
strSql.Append("ExpandVchField12=@ExpandVchField12,");
strSql.Append("ExpandVchField13=@ExpandVchField13,");
strSql.Append("ExpandVchField14=@ExpandVchField14,");
strSql.Append("ExpandVchField15=@ExpandVchField15,");
strSql.Append("ExpandSintField1=@ExpandSintField1,");
strSql.Append("ExpandSintField2=@ExpandSintField2,");
strSql.Append("ExpandSintField3=@ExpandSintField3,");
strSql.Append("ExpandSintField4=@ExpandSintField4,");
strSql.Append("ExpandSintField5=@ExpandSintField5");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_TaskId", SqlDbType.Int,4),
new SqlParameter("@F_Phone", SqlDbType.VarChar,200),
new SqlParameter("@F_Customer", SqlDbType.VarChar,200),
new SqlParameter("@F_PhoneBy", SqlDbType.VarChar,200),
new SqlParameter("@F_Sex", SqlDbType.VarChar,20),
new SqlParameter("@F_FPState", SqlDbType.Int,4),
new SqlParameter("@F_YJState", SqlDbType.Int,4),
new SqlParameter("@F_HCState", SqlDbType.Int,4),
new SqlParameter("@F_UserId", SqlDbType.Int,4),
new SqlParameter("@F_UserName", SqlDbType.VarChar,50),
new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
new SqlParameter("@ExpandIntField1", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField2", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField3", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField4", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField5", SqlDbType.Int,4),
new SqlParameter("@ExpandIntField6", SqlDbType.Int,4),
new SqlParameter("@ExpandDecField1", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField2", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField3", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField4", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField5", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDecField6", SqlDbType.Decimal,9),
new SqlParameter("@ExpandDatField1", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField2", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField3", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField4", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField5", SqlDbType.DateTime),
new SqlParameter("@ExpandDatField6", SqlDbType.DateTime),
new SqlParameter("@ExpandVchField1", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField2", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField3", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField4", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField5", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField6", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField7", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField8", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField9", SqlDbType.VarChar,200),
new SqlParameter("@ExpandVchField10", SqlDbType.VarChar,500),
new SqlParameter("@ExpandVchField11", SqlDbType.VarChar,500),
new SqlParameter("@ExpandVchField12", SqlDbType.VarChar,2000),
new SqlParameter("@ExpandVchField13", SqlDbType.VarChar,2000),
new SqlParameter("@ExpandVchField14", SqlDbType.Text),
new SqlParameter("@ExpandVchField15", SqlDbType.Text),
new SqlParameter("@ExpandSintField1", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField2", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField3", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField4", SqlDbType.SmallInt,2),
new SqlParameter("@ExpandSintField5", SqlDbType.SmallInt,2),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
parameters[0].Value = model.F_TaskId;
parameters[1].Value = model.F_Phone;
parameters[2].Value = model.F_Customer;
parameters[3].Value = model.F_PhoneBy;
parameters[4].Value = model.F_Sex;
parameters[5].Value = model.F_FPState;
parameters[6].Value = model.F_YJState;
parameters[7].Value = model.F_HCState;
parameters[8].Value = model.F_UserId;
parameters[9].Value = model.F_UserName;
parameters[10].Value = model.F_CreateTime;
parameters[11].Value = model.ExpandIntField1;
parameters[12].Value = model.ExpandIntField2;
parameters[13].Value = model.ExpandIntField3;
parameters[14].Value = model.ExpandIntField4;
parameters[15].Value = model.ExpandIntField5;
parameters[16].Value = model.ExpandIntField6;
parameters[17].Value = model.ExpandDecField1;
parameters[18].Value = model.ExpandDecField2;
parameters[19].Value = model.ExpandDecField3;
parameters[20].Value = model.ExpandDecField4;
parameters[21].Value = model.ExpandDecField5;
parameters[22].Value = model.ExpandDecField6;
parameters[23].Value = model.ExpandDatField1;
parameters[24].Value = model.ExpandDatField2;
parameters[25].Value = model.ExpandDatField3;
parameters[26].Value = model.ExpandDatField4;
parameters[27].Value = model.ExpandDatField5;
parameters[28].Value = model.ExpandDatField6;
parameters[29].Value = model.ExpandVchField1;
parameters[30].Value = model.ExpandVchField2;
parameters[31].Value = model.ExpandVchField3;
parameters[32].Value = model.ExpandVchField4;
parameters[33].Value = model.ExpandVchField5;
parameters[34].Value = model.ExpandVchField6;
parameters[35].Value = model.ExpandVchField7;
parameters[36].Value = model.ExpandVchField8;
parameters[37].Value = model.ExpandVchField9;
parameters[38].Value = model.ExpandVchField10;
parameters[39].Value = model.ExpandVchField11;
parameters[40].Value = model.ExpandVchField12;
parameters[41].Value = model.ExpandVchField13;
parameters[42].Value = model.ExpandVchField14;
parameters[43].Value = model.ExpandVchField15;
parameters[44].Value = model.ExpandSintField1;
parameters[45].Value = model.ExpandSintField2;
parameters[46].Value = model.ExpandSintField3;
parameters[47].Value = model.ExpandSintField4;
parameters[48].Value = model.ExpandSintField5;
parameters[49].Value = model.F_Id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新一条数据
///
public bool UpdateFP(int id, int userid, string username)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_FPState=1,");
strSql.Append("F_UserId=@F_UserId,");
strSql.Append("F_UserName=@F_UserName");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_UserId", SqlDbType.Int,4),
new SqlParameter("@F_UserName", SqlDbType.VarChar,50),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
parameters[0].Value = userid;
parameters[1].Value = username;
parameters[2].Value = id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新一条数据
///
public bool UpdateHJJG(int id, int resid, string name)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_HJJGId=@F_HJJGId,");
strSql.Append("F_HJJGName=@F_HJJGName");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_HJJGId", SqlDbType.Int,4),
new SqlParameter("@F_HJJGName", SqlDbType.VarChar,500),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
parameters[0].Value = resid;
parameters[1].Value = name;
parameters[2].Value = id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新一条数据
///
public bool UpdateQXFP(string arrid)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_FPState=0,");
strSql.Append("F_UserId=0,");
strSql.Append("F_UserName=''");
strSql.Append(" where F_Id in (" + arrid + ")");
int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 更新一条数据
///
public bool UpdateHC(int id, int state)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_HCState=@F_HCState");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_HCState", SqlDbType.Int,4),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
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 UpdateYJ(int id, int state)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_YJState=@F_YJState");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_YJState", SqlDbType.Int,4),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
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 UpdateAsk(CallCenterApi.Model.T_Call_TaskTelNum model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update T_Call_TaskTelNum set ");
strSql.Append("F_AskInfo=@F_AskInfo,");
strSql.Append("F_AskRes=@F_AskRes");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_AskInfo", SqlDbType.Text),
new SqlParameter("@F_AskRes", SqlDbType.Text),
new SqlParameter("@F_Id", SqlDbType.Int,4)};
parameters[0].Value = model.F_AskInfo;
parameters[1].Value = model.F_AskRes;
parameters[2].Value = model.F_Id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 删除一条数据
///
public bool Delete(int F_Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_Call_TaskTelNum ");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_Id", SqlDbType.Int,4)
};
parameters[0].Value = F_Id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 删除一条数据
///
public int ClearPhone(int F_Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_Call_TaskTelNum ");
strSql.Append(" where F_TaskId=@F_TaskId and F_FPState=0 ");
SqlParameter[] parameters = {
new SqlParameter("@F_TaskId", SqlDbType.Int,4)
};
parameters[0].Value = F_Id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
return rows;
}
///
/// 批量删除数据
///
public bool DeleteList(string F_Idlist)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_Call_TaskTelNum ");
strSql.Append(" where F_Id in (" + F_Idlist + ") ");
int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
///
/// 删除指定任务下所有号码
///
public int DeletePhoneByTaskId(long id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from T_Call_TaskTelNum ");
strSql.Append(" where F_TaskId=@F_TaskId");
SqlParameter[] parameters = {
new SqlParameter("@F_TaskId", SqlDbType.Int,4)
};
parameters[0].Value = id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
return rows;
}
///
/// 得到一个对象实体
///
public CallCenterApi.Model.T_Call_TaskTelNum GetModel(int F_Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 * from T_Call_TaskTelNum ");
strSql.Append(" where F_Id=@F_Id");
SqlParameter[] parameters = {
new SqlParameter("@F_Id", SqlDbType.Int,4)
};
parameters[0].Value = F_Id;
CallCenterApi.Model.T_Call_TaskTelNum model = new CallCenterApi.Model.T_Call_TaskTelNum();
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["F_Id"] != null && ds.Tables[0].Rows[0]["F_Id"].ToString() != "")
{
model.F_Id = int.Parse(ds.Tables[0].Rows[0]["F_Id"].ToString());
}
if (ds.Tables[0].Rows[0]["F_TaskId"] != null && ds.Tables[0].Rows[0]["F_TaskId"].ToString() != "")
{
model.F_TaskId = int.Parse(ds.Tables[0].Rows[0]["F_TaskId"].ToString());
}
if (ds.Tables[0].Rows[0]["F_Phone"] != null && ds.Tables[0].Rows[0]["F_Phone"].ToString() != "")
{
model.F_Phone = ds.Tables[0].Rows[0]["F_Phone"].ToString();
}
if (ds.Tables[0].Rows[0]["F_Customer"] != null && ds.Tables[0].Rows[0]["F_Customer"].ToString() != "")
{
model.F_Customer = ds.Tables[0].Rows[0]["F_Customer"].ToString();
}
if (ds.Tables[0].Rows[0]["F_PhoneBy"] != null && ds.Tables[0].Rows[0]["F_PhoneBy"].ToString() != "")
{
model.F_PhoneBy = ds.Tables[0].Rows[0]["F_PhoneBy"].ToString();
}
if (ds.Tables[0].Rows[0]["F_Sex"] != null && ds.Tables[0].Rows[0]["F_Sex"].ToString() != "")
{
model.F_Sex = ds.Tables[0].Rows[0]["F_Sex"].ToString();
}
if (ds.Tables[0].Rows[0]["F_FPState"] != null && ds.Tables[0].Rows[0]["F_FPState"].ToString() != "")
{
model.F_FPState = int.Parse(ds.Tables[0].Rows[0]["F_FPState"].ToString());
}
if (ds.Tables[0].Rows[0]["F_YJState"] != null && ds.Tables[0].Rows[0]["F_YJState"].ToString() != "")
{
model.F_YJState = int.Parse(ds.Tables[0].Rows[0]["F_YJState"].ToString());
}
if (ds.Tables[0].Rows[0]["F_HCState"] != null && ds.Tables[0].Rows[0]["F_HCState"].ToString() != "")
{
model.F_HCState = int.Parse(ds.Tables[0].Rows[0]["F_HCState"].ToString());
}
if (ds.Tables[0].Rows[0]["F_UserId"] != null && ds.Tables[0].Rows[0]["F_UserId"].ToString() != "")
{
model.F_UserId = int.Parse(ds.Tables[0].Rows[0]["F_UserId"].ToString());
}
if (ds.Tables[0].Rows[0]["F_UserName"] != null && ds.Tables[0].Rows[0]["F_UserName"].ToString() != "")
{
model.F_UserName = ds.Tables[0].Rows[0]["F_UserName"].ToString();
}
if (ds.Tables[0].Rows[0]["F_CreateTime"] != null && ds.Tables[0].Rows[0]["F_CreateTime"].ToString() != "")
{
model.F_CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["F_CreateTime"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField1"] != null && ds.Tables[0].Rows[0]["ExpandIntField1"].ToString() != "")
{
model.ExpandIntField1 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField1"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField2"] != null && ds.Tables[0].Rows[0]["ExpandIntField2"].ToString() != "")
{
model.ExpandIntField2 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField2"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField3"] != null && ds.Tables[0].Rows[0]["ExpandIntField3"].ToString() != "")
{
model.ExpandIntField3 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField3"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField4"] != null && ds.Tables[0].Rows[0]["ExpandIntField4"].ToString() != "")
{
model.ExpandIntField4 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField4"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField5"] != null && ds.Tables[0].Rows[0]["ExpandIntField5"].ToString() != "")
{
model.ExpandIntField5 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField5"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandIntField6"] != null && ds.Tables[0].Rows[0]["ExpandIntField6"].ToString() != "")
{
model.ExpandIntField6 = int.Parse(ds.Tables[0].Rows[0]["ExpandIntField6"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField1"] != null && ds.Tables[0].Rows[0]["ExpandDecField1"].ToString() != "")
{
model.ExpandDecField1 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField1"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField2"] != null && ds.Tables[0].Rows[0]["ExpandDecField2"].ToString() != "")
{
model.ExpandDecField2 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField2"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField3"] != null && ds.Tables[0].Rows[0]["ExpandDecField3"].ToString() != "")
{
model.ExpandDecField3 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField3"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField4"] != null && ds.Tables[0].Rows[0]["ExpandDecField4"].ToString() != "")
{
model.ExpandDecField4 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField4"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField5"] != null && ds.Tables[0].Rows[0]["ExpandDecField5"].ToString() != "")
{
model.ExpandDecField5 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField5"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDecField6"] != null && ds.Tables[0].Rows[0]["ExpandDecField6"].ToString() != "")
{
model.ExpandDecField6 = decimal.Parse(ds.Tables[0].Rows[0]["ExpandDecField6"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField1"] != null && ds.Tables[0].Rows[0]["ExpandDatField1"].ToString() != "")
{
model.ExpandDatField1 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField1"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField2"] != null && ds.Tables[0].Rows[0]["ExpandDatField2"].ToString() != "")
{
model.ExpandDatField2 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField2"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField3"] != null && ds.Tables[0].Rows[0]["ExpandDatField3"].ToString() != "")
{
model.ExpandDatField3 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField3"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField4"] != null && ds.Tables[0].Rows[0]["ExpandDatField4"].ToString() != "")
{
model.ExpandDatField4 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField4"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField5"] != null && ds.Tables[0].Rows[0]["ExpandDatField5"].ToString() != "")
{
model.ExpandDatField5 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField5"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandDatField6"] != null && ds.Tables[0].Rows[0]["ExpandDatField6"].ToString() != "")
{
model.ExpandDatField6 = DateTime.Parse(ds.Tables[0].Rows[0]["ExpandDatField6"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandVchField1"] != null && ds.Tables[0].Rows[0]["ExpandVchField1"].ToString() != "")
{
model.ExpandVchField1 = ds.Tables[0].Rows[0]["ExpandVchField1"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField2"] != null && ds.Tables[0].Rows[0]["ExpandVchField2"].ToString() != "")
{
model.ExpandVchField2 = ds.Tables[0].Rows[0]["ExpandVchField2"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField3"] != null && ds.Tables[0].Rows[0]["ExpandVchField3"].ToString() != "")
{
model.ExpandVchField3 = ds.Tables[0].Rows[0]["ExpandVchField3"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField4"] != null && ds.Tables[0].Rows[0]["ExpandVchField4"].ToString() != "")
{
model.ExpandVchField4 = ds.Tables[0].Rows[0]["ExpandVchField4"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField5"] != null && ds.Tables[0].Rows[0]["ExpandVchField5"].ToString() != "")
{
model.ExpandVchField5 = ds.Tables[0].Rows[0]["ExpandVchField5"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField6"] != null && ds.Tables[0].Rows[0]["ExpandVchField6"].ToString() != "")
{
model.ExpandVchField6 = ds.Tables[0].Rows[0]["ExpandVchField6"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField7"] != null && ds.Tables[0].Rows[0]["ExpandVchField7"].ToString() != "")
{
model.ExpandVchField7 = ds.Tables[0].Rows[0]["ExpandVchField7"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField8"] != null && ds.Tables[0].Rows[0]["ExpandVchField8"].ToString() != "")
{
model.ExpandVchField8 = ds.Tables[0].Rows[0]["ExpandVchField8"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField9"] != null && ds.Tables[0].Rows[0]["ExpandVchField9"].ToString() != "")
{
model.ExpandVchField9 = ds.Tables[0].Rows[0]["ExpandVchField9"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField10"] != null && ds.Tables[0].Rows[0]["ExpandVchField10"].ToString() != "")
{
model.ExpandVchField10 = ds.Tables[0].Rows[0]["ExpandVchField10"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField11"] != null && ds.Tables[0].Rows[0]["ExpandVchField11"].ToString() != "")
{
model.ExpandVchField11 = ds.Tables[0].Rows[0]["ExpandVchField11"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField12"] != null && ds.Tables[0].Rows[0]["ExpandVchField12"].ToString() != "")
{
model.ExpandVchField12 = ds.Tables[0].Rows[0]["ExpandVchField12"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField13"] != null && ds.Tables[0].Rows[0]["ExpandVchField13"].ToString() != "")
{
model.ExpandVchField13 = ds.Tables[0].Rows[0]["ExpandVchField13"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField14"] != null && ds.Tables[0].Rows[0]["ExpandVchField14"].ToString() != "")
{
model.ExpandVchField14 = ds.Tables[0].Rows[0]["ExpandVchField14"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandVchField15"] != null && ds.Tables[0].Rows[0]["ExpandVchField15"].ToString() != "")
{
model.ExpandVchField15 = ds.Tables[0].Rows[0]["ExpandVchField15"].ToString();
}
if (ds.Tables[0].Rows[0]["ExpandSintField1"] != null && ds.Tables[0].Rows[0]["ExpandSintField1"].ToString() != "")
{
model.ExpandSintField1 = int.Parse(ds.Tables[0].Rows[0]["ExpandSintField1"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandSintField2"] != null && ds.Tables[0].Rows[0]["ExpandSintField2"].ToString() != "")
{
model.ExpandSintField2 = int.Parse(ds.Tables[0].Rows[0]["ExpandSintField2"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandSintField3"] != null && ds.Tables[0].Rows[0]["ExpandSintField3"].ToString() != "")
{
model.ExpandSintField3 = int.Parse(ds.Tables[0].Rows[0]["ExpandSintField3"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandSintField4"] != null && ds.Tables[0].Rows[0]["ExpandSintField4"].ToString() != "")
{
model.ExpandSintField4 = int.Parse(ds.Tables[0].Rows[0]["ExpandSintField4"].ToString());
}
if (ds.Tables[0].Rows[0]["ExpandSintField5"] != null && ds.Tables[0].Rows[0]["ExpandSintField5"].ToString() != "")
{
model.ExpandSintField5 = int.Parse(ds.Tables[0].Rows[0]["ExpandSintField5"].ToString());
}
if (ds.Tables[0].Rows[0]["F_AskInfo"] != null && ds.Tables[0].Rows[0]["F_AskInfo"].ToString() != "")
{
model.F_AskInfo = ds.Tables[0].Rows[0]["F_AskInfo"].ToString();
}
if (ds.Tables[0].Rows[0]["F_AskRes"] != null && ds.Tables[0].Rows[0]["F_AskRes"].ToString() != "")
{
model.F_AskRes = ds.Tables[0].Rows[0]["F_AskRes"].ToString();
}
return model;
}
else
{
return null;
}
}
///
/// 获得数据列表
///
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM T_Call_TaskTelNum ");
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(" F_Id,F_TaskId,F_Phone,F_Customer,F_PhoneBy,F_Sex,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,ExpandIntField1,ExpandIntField2,ExpandIntField3,ExpandIntField4,ExpandIntField5,ExpandIntField6,ExpandDecField1,ExpandDecField2,ExpandDecField3,ExpandDecField4,ExpandDecField5,ExpandDecField6,ExpandDatField1,ExpandDatField2,ExpandDatField3,ExpandDatField4,ExpandDatField5,ExpandDatField6,ExpandVchField1,ExpandVchField2,ExpandVchField3,ExpandVchField4,ExpandVchField5,ExpandVchField6,ExpandVchField7,ExpandVchField8,ExpandVchField9,ExpandVchField10,ExpandVchField11,ExpandVchField12,ExpandVchField13,ExpandVchField14,ExpandVchField15,ExpandSintField1,ExpandSintField2,ExpandSintField3,ExpandSintField4,ExpandSintField5 ");
strSql.Append(" FROM T_Call_TaskTelNum ");
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_Call_TaskTelNum ");
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.F_Id desc");
}
strSql.Append(")AS Row, T.* from T_Call_TaskTelNum 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 DataTable GetTableDesign()
{
return DbHelperSQL.Query("SET FMTONLY ON;SELECT * FROM T_Call_TaskTelNum ;SET FMTONLY OFF; ").Tables[0];
}
///
/// 大量数据导入SqlBulkCopy
///
///
public void SqlBulkCopy(DataTable dt)
{
DbHelperSQL.SqlBulkCopyByDatatable("T_Call_TaskTelNum", dt);
}
/*
///
/// 分页获取数据列表
///
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_Call_TaskTelNum";
parameters[1].Value = "F_Id";
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
}
}