using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using ZXDT.DBUtility;

namespace ZXDT.CallCenter.DAL
{
    /// <summary>
    /// 数据访问类:T_Call_CheckIDCard
    /// </summary>
    public partial class T_Call_CheckIDCard
    {
        public T_Call_CheckIDCard()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from T_Call_CheckIDCard");
            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(ZXDT.CallCenter.Model.T_Call_CheckIDCard model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_Call_CheckIDCard(");
            strSql.Append("F_Code,F_RecordId,F_CallId,F_WorkOrderId,F_IDCard,F_CardInfo,F_Sex,F_Address,F_Birthday,F_Age,F_Name,F_SFId,F_SFName,F_DTType,F_QKInfo,F_SKKYRY,F_CheckCityId,F_CheckCityName,F_CheckXQId,F_CheckXQName,F_CustomerId,F_CustomerName,F_CustomerJH,F_CustomerTel,F_CheckTime,F_UserId,F_UserName,F_State,F_Ext1,F_Ext2,F_Ext3,F_DTChildType,F_LRProviceId,F_LRProviceName,F_LRCityId,F_LRCityName,F_LCProviceId,F_LCProviceName,F_LCCityId,F_LCCityName)");
            strSql.Append(" values (");
            strSql.Append("@F_Code,@F_RecordId,@F_CallId,@F_WorkOrderId,@F_IDCard,@F_CardInfo,@F_Sex,@F_Address,@F_Birthday,@F_Age,@F_Name,@F_SFId,@F_SFName,@F_DTType,@F_QKInfo,@F_SKKYRY,@F_CheckCityId,@F_CheckCityName,@F_CheckXQId,@F_CheckXQName,@F_CustomerId,@F_CustomerName,@F_CustomerJH,@F_CustomerTel,@F_CheckTime,@F_UserId,@F_UserName,@F_State,@F_Ext1,@F_Ext2,@F_Ext3,@F_DTChildType,@F_LRProviceId,@F_LRProviceName,@F_LRCityId,@F_LRCityName,@F_LCProviceId,@F_LCProviceName,@F_LCCityId,@F_LCCityName)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@F_Code", SqlDbType.NVarChar,50),
					new SqlParameter("@F_RecordId", SqlDbType.Int,4),
					new SqlParameter("@F_CallId", SqlDbType.NVarChar,50),
					new SqlParameter("@F_WorkOrderId", SqlDbType.Int,4),
					new SqlParameter("@F_IDCard", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CardInfo", SqlDbType.NVarChar,100),
					new SqlParameter("@F_Sex", SqlDbType.NVarChar,10),
					new SqlParameter("@F_Address", SqlDbType.NVarChar,100),
					new SqlParameter("@F_Birthday", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Age", SqlDbType.Int,4),
					new SqlParameter("@F_Name", SqlDbType.NVarChar,50),
					new SqlParameter("@F_SFId", SqlDbType.Int,4),
					new SqlParameter("@F_SFName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_DTType", SqlDbType.NVarChar,50),
					new SqlParameter("@F_QKInfo", SqlDbType.NVarChar,500),
					new SqlParameter("@F_SKKYRY", SqlDbType.NVarChar,500),
					new SqlParameter("@F_CheckCityId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckXQId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckXQName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
					new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerJH", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerTel", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckTime", SqlDbType.DateTime),
					new SqlParameter("@F_UserId", SqlDbType.Int,4),
					new SqlParameter("@F_UserName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_State", SqlDbType.Int,4),
					new SqlParameter("@F_Ext1", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Ext2", SqlDbType.NVarChar,500),
					new SqlParameter("@F_Ext3", SqlDbType.Int,4),
					new SqlParameter("@F_DTChildType", SqlDbType.Int,4),
					new SqlParameter("@F_LRProviceId", SqlDbType.Int,4),
					new SqlParameter("@F_LRProviceName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LRCityId", SqlDbType.Int,4),
					new SqlParameter("@F_LRCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LCProviceId", SqlDbType.Int,4),
					new SqlParameter("@F_LCProviceName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LCCityId", SqlDbType.Int,4),
					new SqlParameter("@F_LCCityName", SqlDbType.NVarChar,50)};
            parameters[0].Value = model.F_Code;
            parameters[1].Value = model.F_RecordId;
            parameters[2].Value = model.F_CallId;
            parameters[3].Value = model.F_WorkOrderId;
            parameters[4].Value = model.F_IDCard;
            parameters[5].Value = model.F_CardInfo;
            parameters[6].Value = model.F_Sex;
            parameters[7].Value = model.F_Address;
            parameters[8].Value = model.F_Birthday;
            parameters[9].Value = model.F_Age;
            parameters[10].Value = model.F_Name;
            parameters[11].Value = model.F_SFId;
            parameters[12].Value = model.F_SFName;
            parameters[13].Value = model.F_DTType;
            parameters[14].Value = model.F_QKInfo;
            parameters[15].Value = model.F_SKKYRY;
            parameters[16].Value = model.F_CheckCityId;
            parameters[17].Value = model.F_CheckCityName;
            parameters[18].Value = model.F_CheckXQId;
            parameters[19].Value = model.F_CheckXQName;
            parameters[20].Value = model.F_CustomerId;
            parameters[21].Value = model.F_CustomerName;
            parameters[22].Value = model.F_CustomerJH;
            parameters[23].Value = model.F_CustomerTel;
            parameters[24].Value = model.F_CheckTime;
            parameters[25].Value = model.F_UserId;
            parameters[26].Value = model.F_UserName;
            parameters[27].Value = model.F_State;
            parameters[28].Value = model.F_Ext1;
            parameters[29].Value = model.F_Ext2;
            parameters[30].Value = model.F_Ext3;
            parameters[31].Value = model.F_DTChildType;
            parameters[32].Value = model.F_LRProviceId;
            parameters[33].Value = model.F_LRProviceName;
            parameters[34].Value = model.F_LRCityId;
            parameters[35].Value = model.F_LRCityName;
            parameters[36].Value = model.F_LCProviceId;
            parameters[37].Value = model.F_LCProviceName;
            parameters[38].Value = model.F_LCCityId;
            parameters[39].Value = model.F_LCCityName;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ZXDT.CallCenter.Model.T_Call_CheckIDCard model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Call_CheckIDCard set ");
            strSql.Append("F_Code=@F_Code,");
            strSql.Append("F_RecordId=@F_RecordId,");
            strSql.Append("F_CallId=@F_CallId,");
            strSql.Append("F_WorkOrderId=@F_WorkOrderId,");
            strSql.Append("F_IDCard=@F_IDCard,");
            strSql.Append("F_CardInfo=@F_CardInfo,");
            strSql.Append("F_Sex=@F_Sex,");
            strSql.Append("F_Address=@F_Address,");
            strSql.Append("F_Birthday=@F_Birthday,");
            strSql.Append("F_Age=@F_Age,");
            strSql.Append("F_Name=@F_Name,");
            strSql.Append("F_SFId=@F_SFId,");
            strSql.Append("F_SFName=@F_SFName,");
            strSql.Append("F_DTType=@F_DTType,");
            strSql.Append("F_QKInfo=@F_QKInfo,");
            strSql.Append("F_SKKYRY=@F_SKKYRY,");
            strSql.Append("F_CheckCityId=@F_CheckCityId,");
            strSql.Append("F_CheckCityName=@F_CheckCityName,");
            strSql.Append("F_CheckXQId=@F_CheckXQId,");
            strSql.Append("F_CheckXQName=@F_CheckXQName,");
            strSql.Append("F_CustomerId=@F_CustomerId,");
            strSql.Append("F_CustomerName=@F_CustomerName,");
            strSql.Append("F_CustomerJH=@F_CustomerJH,");
            strSql.Append("F_CustomerTel=@F_CustomerTel,");
            strSql.Append("F_CheckTime=@F_CheckTime,");
            strSql.Append("F_UserId=@F_UserId,");
            strSql.Append("F_UserName=@F_UserName,");
            strSql.Append("F_State=@F_State,");
            strSql.Append("F_Ext1=@F_Ext1,");
            strSql.Append("F_Ext2=@F_Ext2,");
            strSql.Append("F_Ext3=@F_Ext3,");
            strSql.Append("F_DTChildType=@F_DTChildType,");
            strSql.Append("F_LRProviceId=@F_LRProviceId,");
            strSql.Append("F_LRProviceName=@F_LRProviceName,");
            strSql.Append("F_LRCityId=@F_LRCityId,");
            strSql.Append("F_LRCityName=@F_LRCityName,");
            strSql.Append("F_LCProviceId=@F_LCProviceId,");
            strSql.Append("F_LCProviceName=@F_LCProviceName,");
            strSql.Append("F_LCCityId=@F_LCCityId,");
            strSql.Append("F_LCCityName=@F_LCCityName");
            strSql.Append(" where F_Id=@F_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@F_Code", SqlDbType.NVarChar,50),
					new SqlParameter("@F_RecordId", SqlDbType.Int,4),
					new SqlParameter("@F_CallId", SqlDbType.NVarChar,50),
					new SqlParameter("@F_WorkOrderId", SqlDbType.Int,4),
					new SqlParameter("@F_IDCard", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CardInfo", SqlDbType.NVarChar,100),
					new SqlParameter("@F_Sex", SqlDbType.NVarChar,10),
					new SqlParameter("@F_Address", SqlDbType.NVarChar,100),
					new SqlParameter("@F_Birthday", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Age", SqlDbType.Int,4),
					new SqlParameter("@F_Name", SqlDbType.NVarChar,50),
					new SqlParameter("@F_SFId", SqlDbType.Int,4),
					new SqlParameter("@F_SFName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_DTType", SqlDbType.NVarChar,50),
					new SqlParameter("@F_QKInfo", SqlDbType.NVarChar,500),
					new SqlParameter("@F_SKKYRY", SqlDbType.NVarChar,500),
					new SqlParameter("@F_CheckCityId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckXQId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckXQName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
					new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerJH", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerTel", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckTime", SqlDbType.DateTime),
					new SqlParameter("@F_UserId", SqlDbType.Int,4),
					new SqlParameter("@F_UserName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_State", SqlDbType.Int,4),
					new SqlParameter("@F_Ext1", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Ext2", SqlDbType.NVarChar,500),
					new SqlParameter("@F_Ext3", SqlDbType.Int,4),
					new SqlParameter("@F_DTChildType", SqlDbType.Int,4),
					new SqlParameter("@F_LRProviceId", SqlDbType.Int,4),
					new SqlParameter("@F_LRProviceName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LRCityId", SqlDbType.Int,4),
					new SqlParameter("@F_LRCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LCProviceId", SqlDbType.Int,4),
					new SqlParameter("@F_LCProviceName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_LCCityId", SqlDbType.Int,4),
					new SqlParameter("@F_LCCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Id", SqlDbType.Int,4)};
            parameters[0].Value = model.F_Code;
            parameters[1].Value = model.F_RecordId;
            parameters[2].Value = model.F_CallId;
            parameters[3].Value = model.F_WorkOrderId;
            parameters[4].Value = model.F_IDCard;
            parameters[5].Value = model.F_CardInfo;
            parameters[6].Value = model.F_Sex;
            parameters[7].Value = model.F_Address;
            parameters[8].Value = model.F_Birthday;
            parameters[9].Value = model.F_Age;
            parameters[10].Value = model.F_Name;
            parameters[11].Value = model.F_SFId;
            parameters[12].Value = model.F_SFName;
            parameters[13].Value = model.F_DTType;
            parameters[14].Value = model.F_QKInfo;
            parameters[15].Value = model.F_SKKYRY;
            parameters[16].Value = model.F_CheckCityId;
            parameters[17].Value = model.F_CheckCityName;
            parameters[18].Value = model.F_CheckXQId;
            parameters[19].Value = model.F_CheckXQName;
            parameters[20].Value = model.F_CustomerId;
            parameters[21].Value = model.F_CustomerName;
            parameters[22].Value = model.F_CustomerJH;
            parameters[23].Value = model.F_CustomerTel;
            parameters[24].Value = model.F_CheckTime;
            parameters[25].Value = model.F_UserId;
            parameters[26].Value = model.F_UserName;
            parameters[27].Value = model.F_State;
            parameters[28].Value = model.F_Ext1;
            parameters[29].Value = model.F_Ext2;
            parameters[30].Value = model.F_Ext3;
            parameters[31].Value = model.F_DTChildType;
            parameters[32].Value = model.F_LRProviceId;
            parameters[33].Value = model.F_LRProviceName;
            parameters[34].Value = model.F_LRCityId;
            parameters[35].Value = model.F_LRCityName;
            parameters[36].Value = model.F_LCProviceId;
            parameters[37].Value = model.F_LCProviceName;
            parameters[38].Value = model.F_LCCityId;
            parameters[39].Value = model.F_LCCityName;
            parameters[40].Value = model.F_Id;

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

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateById(ZXDT.CallCenter.Model.T_Call_CheckIDCard model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Call_CheckIDCard set ");
            strSql.Append("F_Code=@F_Code,");
            strSql.Append("F_IDCard=@F_IDCard,");
            strSql.Append("F_Sex=@F_Sex,");
            strSql.Append("F_Address=@F_Address,");
            strSql.Append("F_Name=@F_Name,");
            strSql.Append("F_DTType=@F_DTType,");
            strSql.Append("F_QKInfo=@F_QKInfo,");
            strSql.Append("F_SKKYRY=@F_SKKYRY,");
            strSql.Append("F_CheckCityId=@F_CheckCityId,");
            strSql.Append("F_CheckCityName=@F_CheckCityName,");
            strSql.Append("F_CheckXQId=@F_CheckXQId,");
            strSql.Append("F_CheckXQName=@F_CheckXQName,");
            strSql.Append("F_CustomerName=@F_CustomerName,");
            strSql.Append("F_CustomerJH=@F_CustomerJH,");
            strSql.Append("F_CustomerTel=@F_CustomerTel,");
            strSql.Append("F_UserName=@F_UserName,");
            strSql.Append("F_State=@F_State,");
            strSql.Append("F_Ext2=@F_Ext2");
            strSql.Append(" where F_Id=@F_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@F_Code", SqlDbType.NVarChar,50),
					new SqlParameter("@F_IDCard", SqlDbType.NVarChar,50),
					new SqlParameter("@F_Sex", SqlDbType.NVarChar,10),
					new SqlParameter("@F_Address", SqlDbType.NVarChar,100),
					new SqlParameter("@F_Name", SqlDbType.NVarChar,50),
					new SqlParameter("@F_DTType", SqlDbType.NVarChar,50),
					new SqlParameter("@F_QKInfo", SqlDbType.NVarChar,500),
					new SqlParameter("@F_SKKYRY", SqlDbType.NVarChar,500),
					new SqlParameter("@F_CheckCityId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckXQId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckXQName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerJH", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerTel", SqlDbType.NVarChar,50),
					new SqlParameter("@F_UserName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_State", SqlDbType.Int,4),
                    new SqlParameter("@F_Ext2", SqlDbType.NVarChar,500),
					new SqlParameter("@F_Id", SqlDbType.Int,4)};
            parameters[0].Value = model.F_Code;
            parameters[1].Value = model.F_IDCard;
            parameters[2].Value = model.F_Sex;
            parameters[3].Value = model.F_Address;
            parameters[4].Value = model.F_Name;
            parameters[5].Value = model.F_DTType;
            parameters[6].Value = model.F_QKInfo;
            parameters[7].Value = model.F_SKKYRY;
            parameters[8].Value = model.F_CheckCityId;
            parameters[9].Value = model.F_CheckCityName;
            parameters[10].Value = model.F_CheckXQId;
            parameters[11].Value = model.F_CheckXQName;
            parameters[12].Value = model.F_CustomerName;
            parameters[13].Value = model.F_CustomerJH;
            parameters[14].Value = model.F_CustomerTel;
            parameters[15].Value = model.F_UserName;
            parameters[16].Value = model.F_State;
            parameters[17].Value = model.F_Ext2;
            parameters[18].Value = model.F_Id;

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

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateByRecordId(ZXDT.CallCenter.Model.T_Call_CheckIDCard model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Call_CheckIDCard set ");
            strSql.Append("F_WorkOrderId=@F_WorkOrderId,");
            strSql.Append("F_CheckCityId=@F_CheckCityId,");
            strSql.Append("F_CheckCityName=@F_CheckCityName,");
            strSql.Append("F_CheckXQId=@F_CheckXQId,");
            strSql.Append("F_CheckXQName=@F_CheckXQName,");
            strSql.Append("F_CustomerId=@F_CustomerId,");
            strSql.Append("F_CustomerName=@F_CustomerName,");
            strSql.Append("F_CustomerJH=@F_CustomerJH,");
            strSql.Append("F_CustomerTel=@F_CustomerTel");
            strSql.Append(" where F_RecordId=@F_RecordId");
            SqlParameter[] parameters = {
					new SqlParameter("@F_WorkOrderId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckCityId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckCityName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CheckXQId", SqlDbType.Int,4),
					new SqlParameter("@F_CheckXQName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
					new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerJH", SqlDbType.NVarChar,50),
					new SqlParameter("@F_CustomerTel", SqlDbType.NVarChar,50),
					new SqlParameter("@F_RecordId", SqlDbType.Int,4)};
            parameters[0].Value = model.F_WorkOrderId;
            parameters[1].Value = model.F_CheckCityId;
            parameters[2].Value = model.F_CheckCityName;
            parameters[3].Value = model.F_CheckXQId;
            parameters[4].Value = model.F_CheckXQName;
            parameters[5].Value = model.F_CustomerId;
            parameters[6].Value = model.F_CustomerName;
            parameters[7].Value = model.F_CustomerJH;
            parameters[8].Value = model.F_CustomerTel;
            parameters[9].Value = model.F_RecordId;

            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_CheckIDCard ");
            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_CheckIDCard ");
            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 ZXDT.CallCenter.Model.T_Call_CheckIDCard GetModel(int F_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from T_Call_CheckIDCard ");
            strSql.Append(" where F_Id=@F_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@F_Id", SqlDbType.Int,4)
			};
            parameters[0].Value = F_Id;

            ZXDT.CallCenter.Model.T_Call_CheckIDCard model = new ZXDT.CallCenter.Model.T_Call_CheckIDCard();
            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_Code"] != null && ds.Tables[0].Rows[0]["F_Code"].ToString() != "")
                {
                    model.F_Code = ds.Tables[0].Rows[0]["F_Code"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_RecordId"] != null && ds.Tables[0].Rows[0]["F_RecordId"].ToString() != "")
                {
                    model.F_RecordId = int.Parse(ds.Tables[0].Rows[0]["F_RecordId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_CallId"] != null && ds.Tables[0].Rows[0]["F_CallId"].ToString() != "")
                {
                    model.F_CallId = ds.Tables[0].Rows[0]["F_CallId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_WorkOrderId"] != null && ds.Tables[0].Rows[0]["F_WorkOrderId"].ToString() != "")
                {
                    model.F_WorkOrderId = int.Parse(ds.Tables[0].Rows[0]["F_WorkOrderId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_IDCard"] != null && ds.Tables[0].Rows[0]["F_IDCard"].ToString() != "")
                {
                    model.F_IDCard = ds.Tables[0].Rows[0]["F_IDCard"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CardInfo"] != null && ds.Tables[0].Rows[0]["F_CardInfo"].ToString() != "")
                {
                    model.F_CardInfo = ds.Tables[0].Rows[0]["F_CardInfo"].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_Address"] != null && ds.Tables[0].Rows[0]["F_Address"].ToString() != "")
                {
                    model.F_Address = ds.Tables[0].Rows[0]["F_Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Birthday"] != null && ds.Tables[0].Rows[0]["F_Birthday"].ToString() != "")
                {
                    model.F_Birthday = ds.Tables[0].Rows[0]["F_Birthday"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Age"] != null && ds.Tables[0].Rows[0]["F_Age"].ToString() != "")
                {
                    model.F_Age = int.Parse(ds.Tables[0].Rows[0]["F_Age"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_Name"] != null && ds.Tables[0].Rows[0]["F_Name"].ToString() != "")
                {
                    model.F_Name = ds.Tables[0].Rows[0]["F_Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_SFId"] != null && ds.Tables[0].Rows[0]["F_SFId"].ToString() != "")
                {
                    model.F_SFId = int.Parse(ds.Tables[0].Rows[0]["F_SFId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_SFName"] != null && ds.Tables[0].Rows[0]["F_SFName"].ToString() != "")
                {
                    model.F_SFName = ds.Tables[0].Rows[0]["F_SFName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_DTType"] != null && ds.Tables[0].Rows[0]["F_DTType"].ToString() != "")
                {
                    model.F_DTType = ds.Tables[0].Rows[0]["F_DTType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_QKInfo"] != null && ds.Tables[0].Rows[0]["F_QKInfo"].ToString() != "")
                {
                    model.F_QKInfo = ds.Tables[0].Rows[0]["F_QKInfo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_SKKYRY"] != null && ds.Tables[0].Rows[0]["F_SKKYRY"].ToString() != "")
                {
                    model.F_SKKYRY = ds.Tables[0].Rows[0]["F_SKKYRY"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CheckCityId"] != null && ds.Tables[0].Rows[0]["F_CheckCityId"].ToString() != "")
                {
                    model.F_CheckCityId = int.Parse(ds.Tables[0].Rows[0]["F_CheckCityId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_CheckCityName"] != null && ds.Tables[0].Rows[0]["F_CheckCityName"].ToString() != "")
                {
                    model.F_CheckCityName = ds.Tables[0].Rows[0]["F_CheckCityName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CheckXQId"] != null && ds.Tables[0].Rows[0]["F_CheckXQId"].ToString() != "")
                {
                    model.F_CheckXQId = int.Parse(ds.Tables[0].Rows[0]["F_CheckXQId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_CheckXQName"] != null && ds.Tables[0].Rows[0]["F_CheckXQName"].ToString() != "")
                {
                    model.F_CheckXQName = ds.Tables[0].Rows[0]["F_CheckXQName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CustomerId"] != null && ds.Tables[0].Rows[0]["F_CustomerId"].ToString() != "")
                {
                    model.F_CustomerId = int.Parse(ds.Tables[0].Rows[0]["F_CustomerId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_CustomerName"] != null && ds.Tables[0].Rows[0]["F_CustomerName"].ToString() != "")
                {
                    model.F_CustomerName = ds.Tables[0].Rows[0]["F_CustomerName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CustomerJH"] != null && ds.Tables[0].Rows[0]["F_CustomerJH"].ToString() != "")
                {
                    model.F_CustomerJH = ds.Tables[0].Rows[0]["F_CustomerJH"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CustomerTel"] != null && ds.Tables[0].Rows[0]["F_CustomerTel"].ToString() != "")
                {
                    model.F_CustomerTel = ds.Tables[0].Rows[0]["F_CustomerTel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CheckTime"] != null && ds.Tables[0].Rows[0]["F_CheckTime"].ToString() != "")
                {
                    model.F_CheckTime = DateTime.Parse(ds.Tables[0].Rows[0]["F_CheckTime"].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_State"] != null && ds.Tables[0].Rows[0]["F_State"].ToString() != "")
                {
                    model.F_State = int.Parse(ds.Tables[0].Rows[0]["F_State"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_Ext1"] != null && ds.Tables[0].Rows[0]["F_Ext1"].ToString() != "")
                {
                    model.F_Ext1 = ds.Tables[0].Rows[0]["F_Ext1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Ext2"] != null && ds.Tables[0].Rows[0]["F_Ext2"].ToString() != "")
                {
                    model.F_Ext2 = ds.Tables[0].Rows[0]["F_Ext2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Ext3"] != null && ds.Tables[0].Rows[0]["F_Ext3"].ToString() != "")
                {
                    model.F_Ext3 = int.Parse(ds.Tables[0].Rows[0]["F_Ext3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_DTChildType"] != null && ds.Tables[0].Rows[0]["F_DTChildType"].ToString() != "")
                {
                    model.F_DTChildType = int.Parse(ds.Tables[0].Rows[0]["F_DTChildType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_LRProviceId"] != null && ds.Tables[0].Rows[0]["F_LRProviceId"].ToString() != "")
                {
                    model.F_LRProviceId = int.Parse(ds.Tables[0].Rows[0]["F_LRProviceId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_LRProviceName"] != null && ds.Tables[0].Rows[0]["F_LRProviceName"].ToString() != "")
                {
                    model.F_LRProviceName = ds.Tables[0].Rows[0]["F_LRProviceName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_LRCityId"] != null && ds.Tables[0].Rows[0]["F_LRCityId"].ToString() != "")
                {
                    model.F_LRCityId = int.Parse(ds.Tables[0].Rows[0]["F_LRCityId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_LRCityName"] != null && ds.Tables[0].Rows[0]["F_LRCityName"].ToString() != "")
                {
                    model.F_LRCityName = ds.Tables[0].Rows[0]["F_LRCityName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_LCProviceId"] != null && ds.Tables[0].Rows[0]["F_LCProviceId"].ToString() != "")
                {
                    model.F_LCProviceId = int.Parse(ds.Tables[0].Rows[0]["F_LCProviceId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_LCProviceName"] != null && ds.Tables[0].Rows[0]["F_LCProviceName"].ToString() != "")
                {
                    model.F_LCProviceName = ds.Tables[0].Rows[0]["F_LCProviceName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_LCCityId"] != null && ds.Tables[0].Rows[0]["F_LCCityId"].ToString() != "")
                {
                    model.F_LCCityId = int.Parse(ds.Tables[0].Rows[0]["F_LCCityId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_LCCityName"] != null && ds.Tables[0].Rows[0]["F_LCCityName"].ToString() != "")
                {
                    model.F_LCCityName = ds.Tables[0].Rows[0]["F_LCCityName"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM T_Call_CheckIDCard ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string Field, string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select " + Field + " ");
            strSql.Append(" FROM T_Call_CheckIDCard ");
            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(" * ");
            strSql.Append(" FROM T_Call_CheckIDCard ");
            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_CheckIDCard ");
            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_CheckIDCard 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());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        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_CheckIDCard";
            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
    }
}

