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
{
    /// <summary>
	/// 数据访问类:T_Call_OutTaskRecords
	/// </summary>
	public partial class T_Call_OutTaskRecords
    {
        public T_Call_OutTaskRecords()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from T_Call_OutTaskRecords");
            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);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CallCenterApi.Model.T_Call_OutTaskRecords model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_Call_OutTaskRecords(");
            strSql.Append("F_TelID,F_TaskId,F_CusID,F_CusName,F_Phone,F_PhoneBy,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,F_AskInfo,F_AskRes,F_HJJGId,F_HJJGName,F_YHFKId,F_YHFKName,F_OptTime,F_OptUserCode,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_TelID,@F_TaskId,@F_CusID,@F_CusName,@F_Phone,@F_PhoneBy,@F_FPState,@F_YJState,@F_HCState,@F_UserId,@F_UserName,@F_CreateTime,@F_AskInfo,@F_AskRes,@F_HJJGId,@F_HJJGName,@F_YHFKId,@F_YHFKName,@F_OptTime,@F_OptUserCode,@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_TelID", SqlDbType.Int,4),
                    new SqlParameter("@F_TaskId", SqlDbType.Int,4),
                    new SqlParameter("@F_CusID", SqlDbType.Int,4),
                    new SqlParameter("@F_CusName", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Phone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PhoneBy", SqlDbType.VarChar,200),
                    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("@F_AskInfo", SqlDbType.Text),
                    new SqlParameter("@F_AskRes", SqlDbType.Text),
                    new SqlParameter("@F_HJJGId", SqlDbType.Int,4),
                    new SqlParameter("@F_HJJGName", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_YHFKId", SqlDbType.Int,4),
                    new SqlParameter("@F_YHFKName", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_OptTime", SqlDbType.DateTime),
                    new SqlParameter("@F_OptUserCode", SqlDbType.VarChar,50),
                    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_TelID;
            parameters[1].Value = model.F_TaskId;
            parameters[2].Value = model.F_CusID;
            parameters[3].Value = model.F_CusName;
            parameters[4].Value = model.F_Phone;
            parameters[5].Value = model.F_PhoneBy;
            parameters[6].Value = model.F_FPState;
            parameters[7].Value = model.F_YJState;
            parameters[8].Value = model.F_HCState;
            parameters[9].Value = model.F_UserId;
            parameters[10].Value = model.F_UserName;
            parameters[11].Value = model.F_CreateTime;
            parameters[12].Value = model.F_AskInfo;
            parameters[13].Value = model.F_AskRes;
            parameters[14].Value = model.F_HJJGId;
            parameters[15].Value = model.F_HJJGName;
            parameters[16].Value = model.F_YHFKId;
            parameters[17].Value = model.F_YHFKName;
            parameters[18].Value = model.F_OptTime;
            parameters[19].Value = model.F_OptUserCode;
            parameters[20].Value = model.ExpandIntField1;
            parameters[21].Value = model.ExpandIntField2;
            parameters[22].Value = model.ExpandIntField3;
            parameters[23].Value = model.ExpandIntField4;
            parameters[24].Value = model.ExpandIntField5;
            parameters[25].Value = model.ExpandIntField6;
            parameters[26].Value = model.ExpandDecField1;
            parameters[27].Value = model.ExpandDecField2;
            parameters[28].Value = model.ExpandDecField3;
            parameters[29].Value = model.ExpandDecField4;
            parameters[30].Value = model.ExpandDecField5;
            parameters[31].Value = model.ExpandDecField6;
            parameters[32].Value = model.ExpandDatField1;
            parameters[33].Value = model.ExpandDatField2;
            parameters[34].Value = model.ExpandDatField3;
            parameters[35].Value = model.ExpandDatField4;
            parameters[36].Value = model.ExpandDatField5;
            parameters[37].Value = model.ExpandDatField6;
            parameters[38].Value = model.ExpandVchField1;
            parameters[39].Value = model.ExpandVchField2;
            parameters[40].Value = model.ExpandVchField3;
            parameters[41].Value = model.ExpandVchField4;
            parameters[42].Value = model.ExpandVchField5;
            parameters[43].Value = model.ExpandVchField6;
            parameters[44].Value = model.ExpandVchField7;
            parameters[45].Value = model.ExpandVchField8;
            parameters[46].Value = model.ExpandVchField9;
            parameters[47].Value = model.ExpandVchField10;
            parameters[48].Value = model.ExpandVchField11;
            parameters[49].Value = model.ExpandVchField12;
            parameters[50].Value = model.ExpandVchField13;
            parameters[51].Value = model.ExpandVchField14;
            parameters[52].Value = model.ExpandVchField15;
            parameters[53].Value = model.ExpandSintField1;
            parameters[54].Value = model.ExpandSintField2;
            parameters[55].Value = model.ExpandSintField3;
            parameters[56].Value = model.ExpandSintField4;
            parameters[57].Value = model.ExpandSintField5;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CallCenterApi.Model.T_Call_OutTaskRecords model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Call_OutTaskRecords set ");
            strSql.Append("F_TelID=@F_TelID,");
            strSql.Append("F_TaskId=@F_TaskId,");
            strSql.Append("F_CusID=@F_CusID,");
            strSql.Append("F_CusName=@F_CusName,");
            strSql.Append("F_Phone=@F_Phone,");
            strSql.Append("F_PhoneBy=@F_PhoneBy,");
            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("F_AskInfo=@F_AskInfo,");
            strSql.Append("F_AskRes=@F_AskRes,");
            strSql.Append("F_HJJGId=@F_HJJGId,");
            strSql.Append("F_HJJGName=@F_HJJGName,");
            strSql.Append("F_YHFKId=@F_YHFKId,");
            strSql.Append("F_YHFKName=@F_YHFKName,");
            strSql.Append("F_OptTime=@F_OptTime,");
            strSql.Append("F_OptUserCode=@F_OptUserCode,");
            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_TelID", SqlDbType.Int,4),
                    new SqlParameter("@F_TaskId", SqlDbType.Int,4),
                    new SqlParameter("@F_CusID", SqlDbType.Int,4),
                    new SqlParameter("@F_CusName", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Phone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PhoneBy", SqlDbType.VarChar,200),
                    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("@F_AskInfo", SqlDbType.Text),
                    new SqlParameter("@F_AskRes", SqlDbType.Text),
                    new SqlParameter("@F_HJJGId", SqlDbType.Int,4),
                    new SqlParameter("@F_HJJGName", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_YHFKId", SqlDbType.Int,4),
                    new SqlParameter("@F_YHFKName", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_OptTime", SqlDbType.DateTime),
                    new SqlParameter("@F_OptUserCode", SqlDbType.VarChar,50),
                    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_TelID;
            parameters[1].Value = model.F_TaskId;
            parameters[2].Value = model.F_CusID;
            parameters[3].Value = model.F_CusName;
            parameters[4].Value = model.F_Phone;
            parameters[5].Value = model.F_PhoneBy;
            parameters[6].Value = model.F_FPState;
            parameters[7].Value = model.F_YJState;
            parameters[8].Value = model.F_HCState;
            parameters[9].Value = model.F_UserId;
            parameters[10].Value = model.F_UserName;
            parameters[11].Value = model.F_CreateTime;
            parameters[12].Value = model.F_AskInfo;
            parameters[13].Value = model.F_AskRes;
            parameters[14].Value = model.F_HJJGId;
            parameters[15].Value = model.F_HJJGName;
            parameters[16].Value = model.F_YHFKId;
            parameters[17].Value = model.F_YHFKName;
            parameters[18].Value = model.F_OptTime;
            parameters[19].Value = model.F_OptUserCode;
            parameters[20].Value = model.ExpandIntField1;
            parameters[21].Value = model.ExpandIntField2;
            parameters[22].Value = model.ExpandIntField3;
            parameters[23].Value = model.ExpandIntField4;
            parameters[24].Value = model.ExpandIntField5;
            parameters[25].Value = model.ExpandIntField6;
            parameters[26].Value = model.ExpandDecField1;
            parameters[27].Value = model.ExpandDecField2;
            parameters[28].Value = model.ExpandDecField3;
            parameters[29].Value = model.ExpandDecField4;
            parameters[30].Value = model.ExpandDecField5;
            parameters[31].Value = model.ExpandDecField6;
            parameters[32].Value = model.ExpandDatField1;
            parameters[33].Value = model.ExpandDatField2;
            parameters[34].Value = model.ExpandDatField3;
            parameters[35].Value = model.ExpandDatField4;
            parameters[36].Value = model.ExpandDatField5;
            parameters[37].Value = model.ExpandDatField6;
            parameters[38].Value = model.ExpandVchField1;
            parameters[39].Value = model.ExpandVchField2;
            parameters[40].Value = model.ExpandVchField3;
            parameters[41].Value = model.ExpandVchField4;
            parameters[42].Value = model.ExpandVchField5;
            parameters[43].Value = model.ExpandVchField6;
            parameters[44].Value = model.ExpandVchField7;
            parameters[45].Value = model.ExpandVchField8;
            parameters[46].Value = model.ExpandVchField9;
            parameters[47].Value = model.ExpandVchField10;
            parameters[48].Value = model.ExpandVchField11;
            parameters[49].Value = model.ExpandVchField12;
            parameters[50].Value = model.ExpandVchField13;
            parameters[51].Value = model.ExpandVchField14;
            parameters[52].Value = model.ExpandVchField15;
            parameters[53].Value = model.ExpandSintField1;
            parameters[54].Value = model.ExpandSintField2;
            parameters[55].Value = model.ExpandSintField3;
            parameters[56].Value = model.ExpandSintField4;
            parameters[57].Value = model.ExpandSintField5;
            parameters[58].Value = model.F_Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int F_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_Call_OutTaskRecords ");
            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;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string F_Idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_Call_OutTaskRecords ");
            strSql.Append(" where F_Id in (" + F_Idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CallCenterApi.Model.T_Call_OutTaskRecords GetModel(int F_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 F_Id,F_TelID,F_TaskId,F_CusID,F_CusName,F_Phone,F_PhoneBy,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,F_AskInfo,F_AskRes,F_HJJGId,F_HJJGName,F_YHFKId,F_YHFKName,F_OptTime,F_OptUserCode,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 from T_Call_OutTaskRecords ");
            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_OutTaskRecords model = new CallCenterApi.Model.T_Call_OutTaskRecords();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CallCenterApi.Model.T_Call_OutTaskRecords DataRowToModel(DataRow row)
        {
            CallCenterApi.Model.T_Call_OutTaskRecords model = new CallCenterApi.Model.T_Call_OutTaskRecords();
            if (row != null)
            {
                if (row["F_Id"] != null && row["F_Id"].ToString() != "")
                {
                    model.F_Id = int.Parse(row["F_Id"].ToString());
                }
                if (row["F_TelID"] != null && row["F_TelID"].ToString() != "")
                {
                    model.F_TelID = int.Parse(row["F_TelID"].ToString());
                }
                if (row["F_TaskId"] != null && row["F_TaskId"].ToString() != "")
                {
                    model.F_TaskId = int.Parse(row["F_TaskId"].ToString());
                }
                if (row["F_CusID"] != null && row["F_CusID"].ToString() != "")
                {
                    model.F_CusID = int.Parse(row["F_CusID"].ToString());
                }
                if (row["F_CusName"] != null)
                {
                    model.F_CusName = row["F_CusName"].ToString();
                }
                if (row["F_Phone"] != null)
                {
                    model.F_Phone = row["F_Phone"].ToString();
                }
                if (row["F_PhoneBy"] != null)
                {
                    model.F_PhoneBy = row["F_PhoneBy"].ToString();
                }
                if (row["F_FPState"] != null && row["F_FPState"].ToString() != "")
                {
                    model.F_FPState = int.Parse(row["F_FPState"].ToString());
                }
                if (row["F_YJState"] != null && row["F_YJState"].ToString() != "")
                {
                    model.F_YJState = int.Parse(row["F_YJState"].ToString());
                }
                if (row["F_HCState"] != null && row["F_HCState"].ToString() != "")
                {
                    model.F_HCState = int.Parse(row["F_HCState"].ToString());
                }
                if (row["F_UserId"] != null && row["F_UserId"].ToString() != "")
                {
                    model.F_UserId = int.Parse(row["F_UserId"].ToString());
                }
                if (row["F_UserName"] != null)
                {
                    model.F_UserName = row["F_UserName"].ToString();
                }
                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
                {
                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
                }
                if (row["F_AskInfo"] != null)
                {
                    model.F_AskInfo = row["F_AskInfo"].ToString();
                }
                if (row["F_AskRes"] != null)
                {
                    model.F_AskRes = row["F_AskRes"].ToString();
                }
                if (row["F_HJJGId"] != null && row["F_HJJGId"].ToString() != "")
                {
                    model.F_HJJGId = int.Parse(row["F_HJJGId"].ToString());
                }
                if (row["F_HJJGName"] != null)
                {
                    model.F_HJJGName = row["F_HJJGName"].ToString();
                }
                if (row["F_YHFKId"] != null && row["F_YHFKId"].ToString() != "")
                {
                    model.F_YHFKId = int.Parse(row["F_YHFKId"].ToString());
                }
                if (row["F_YHFKName"] != null)
                {
                    model.F_YHFKName = row["F_YHFKName"].ToString();
                }
                if (row["F_OptTime"] != null && row["F_OptTime"].ToString() != "")
                {
                    model.F_OptTime = DateTime.Parse(row["F_OptTime"].ToString());
                }
                if (row["F_OptUserCode"] != null)
                {
                    model.F_OptUserCode = row["F_OptUserCode"].ToString();
                }
                if (row["ExpandIntField1"] != null && row["ExpandIntField1"].ToString() != "")
                {
                    model.ExpandIntField1 = int.Parse(row["ExpandIntField1"].ToString());
                }
                if (row["ExpandIntField2"] != null && row["ExpandIntField2"].ToString() != "")
                {
                    model.ExpandIntField2 = int.Parse(row["ExpandIntField2"].ToString());
                }
                if (row["ExpandIntField3"] != null && row["ExpandIntField3"].ToString() != "")
                {
                    model.ExpandIntField3 = int.Parse(row["ExpandIntField3"].ToString());
                }
                if (row["ExpandIntField4"] != null && row["ExpandIntField4"].ToString() != "")
                {
                    model.ExpandIntField4 = int.Parse(row["ExpandIntField4"].ToString());
                }
                if (row["ExpandIntField5"] != null && row["ExpandIntField5"].ToString() != "")
                {
                    model.ExpandIntField5 = int.Parse(row["ExpandIntField5"].ToString());
                }
                if (row["ExpandIntField6"] != null && row["ExpandIntField6"].ToString() != "")
                {
                    model.ExpandIntField6 = int.Parse(row["ExpandIntField6"].ToString());
                }
                if (row["ExpandDecField1"] != null && row["ExpandDecField1"].ToString() != "")
                {
                    model.ExpandDecField1 = decimal.Parse(row["ExpandDecField1"].ToString());
                }
                if (row["ExpandDecField2"] != null && row["ExpandDecField2"].ToString() != "")
                {
                    model.ExpandDecField2 = decimal.Parse(row["ExpandDecField2"].ToString());
                }
                if (row["ExpandDecField3"] != null && row["ExpandDecField3"].ToString() != "")
                {
                    model.ExpandDecField3 = decimal.Parse(row["ExpandDecField3"].ToString());
                }
                if (row["ExpandDecField4"] != null && row["ExpandDecField4"].ToString() != "")
                {
                    model.ExpandDecField4 = decimal.Parse(row["ExpandDecField4"].ToString());
                }
                if (row["ExpandDecField5"] != null && row["ExpandDecField5"].ToString() != "")
                {
                    model.ExpandDecField5 = decimal.Parse(row["ExpandDecField5"].ToString());
                }
                if (row["ExpandDecField6"] != null && row["ExpandDecField6"].ToString() != "")
                {
                    model.ExpandDecField6 = decimal.Parse(row["ExpandDecField6"].ToString());
                }
                if (row["ExpandDatField1"] != null && row["ExpandDatField1"].ToString() != "")
                {
                    model.ExpandDatField1 = DateTime.Parse(row["ExpandDatField1"].ToString());
                }
                if (row["ExpandDatField2"] != null && row["ExpandDatField2"].ToString() != "")
                {
                    model.ExpandDatField2 = DateTime.Parse(row["ExpandDatField2"].ToString());
                }
                if (row["ExpandDatField3"] != null && row["ExpandDatField3"].ToString() != "")
                {
                    model.ExpandDatField3 = DateTime.Parse(row["ExpandDatField3"].ToString());
                }
                if (row["ExpandDatField4"] != null && row["ExpandDatField4"].ToString() != "")
                {
                    model.ExpandDatField4 = DateTime.Parse(row["ExpandDatField4"].ToString());
                }
                if (row["ExpandDatField5"] != null && row["ExpandDatField5"].ToString() != "")
                {
                    model.ExpandDatField5 = DateTime.Parse(row["ExpandDatField5"].ToString());
                }
                if (row["ExpandDatField6"] != null && row["ExpandDatField6"].ToString() != "")
                {
                    model.ExpandDatField6 = DateTime.Parse(row["ExpandDatField6"].ToString());
                }
                if (row["ExpandVchField1"] != null)
                {
                    model.ExpandVchField1 = row["ExpandVchField1"].ToString();
                }
                if (row["ExpandVchField2"] != null)
                {
                    model.ExpandVchField2 = row["ExpandVchField2"].ToString();
                }
                if (row["ExpandVchField3"] != null)
                {
                    model.ExpandVchField3 = row["ExpandVchField3"].ToString();
                }
                if (row["ExpandVchField4"] != null)
                {
                    model.ExpandVchField4 = row["ExpandVchField4"].ToString();
                }
                if (row["ExpandVchField5"] != null)
                {
                    model.ExpandVchField5 = row["ExpandVchField5"].ToString();
                }
                if (row["ExpandVchField6"] != null)
                {
                    model.ExpandVchField6 = row["ExpandVchField6"].ToString();
                }
                if (row["ExpandVchField7"] != null)
                {
                    model.ExpandVchField7 = row["ExpandVchField7"].ToString();
                }
                if (row["ExpandVchField8"] != null)
                {
                    model.ExpandVchField8 = row["ExpandVchField8"].ToString();
                }
                if (row["ExpandVchField9"] != null)
                {
                    model.ExpandVchField9 = row["ExpandVchField9"].ToString();
                }
                if (row["ExpandVchField10"] != null)
                {
                    model.ExpandVchField10 = row["ExpandVchField10"].ToString();
                }
                if (row["ExpandVchField11"] != null)
                {
                    model.ExpandVchField11 = row["ExpandVchField11"].ToString();
                }
                if (row["ExpandVchField12"] != null)
                {
                    model.ExpandVchField12 = row["ExpandVchField12"].ToString();
                }
                if (row["ExpandVchField13"] != null)
                {
                    model.ExpandVchField13 = row["ExpandVchField13"].ToString();
                }
                if (row["ExpandVchField14"] != null)
                {
                    model.ExpandVchField14 = row["ExpandVchField14"].ToString();
                }
                if (row["ExpandVchField15"] != null)
                {
                    model.ExpandVchField15 = row["ExpandVchField15"].ToString();
                }
                if (row["ExpandSintField1"] != null && row["ExpandSintField1"].ToString() != "")
                {
                    model.ExpandSintField1 = int.Parse(row["ExpandSintField1"].ToString());
                }
                if (row["ExpandSintField2"] != null && row["ExpandSintField2"].ToString() != "")
                {
                    model.ExpandSintField2 = int.Parse(row["ExpandSintField2"].ToString());
                }
                if (row["ExpandSintField3"] != null && row["ExpandSintField3"].ToString() != "")
                {
                    model.ExpandSintField3 = int.Parse(row["ExpandSintField3"].ToString());
                }
                if (row["ExpandSintField4"] != null && row["ExpandSintField4"].ToString() != "")
                {
                    model.ExpandSintField4 = int.Parse(row["ExpandSintField4"].ToString());
                }
                if (row["ExpandSintField5"] != null && row["ExpandSintField5"].ToString() != "")
                {
                    model.ExpandSintField5 = int.Parse(row["ExpandSintField5"].ToString());
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select F_Id,F_TelID,F_TaskId,F_CusID,F_CusName,F_Phone,F_PhoneBy,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,F_AskInfo,F_AskRes,F_HJJGId,F_HJJGName,F_YHFKId,F_YHFKName,F_OptTime,F_OptUserCode,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_OutTaskRecords ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        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_TelID,F_TaskId,F_CusID,F_CusName,F_Phone,F_PhoneBy,F_FPState,F_YJState,F_HCState,F_UserId,F_UserName,F_CreateTime,F_AskInfo,F_AskRes,F_HJJGId,F_HJJGName,F_YHFKId,F_YHFKName,F_OptTime,F_OptUserCode,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_OutTaskRecords ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM T_Call_OutTaskRecords ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        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_OutTaskRecords 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());
        }

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}
