using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCenterApi.BLL
{
    /// <summary>
    /// T_Call_TaskTelNum
    /// </summary>
    public partial class T_Call_TaskTelNum
    {
        private readonly CallCenterApi.DAL.T_Call_TaskTelNum dal = new CallCenterApi.DAL.T_Call_TaskTelNum();
        public T_Call_TaskTelNum()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_Id)
        {
            return dal.Exists(F_Id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CallCenterApi.Model.T_Call_TaskTelNum model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CallCenterApi.Model.T_Call_TaskTelNum model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateFP(int id, int userid, string username)
        {
            return dal.UpdateFP(id, userid, username);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateHJJG(int id, int resid, string name)
        {
            return dal.UpdateHJJG(id, resid, name);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateQXFP(string arrid)
        {
            return dal.UpdateQXFP(arrid);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateHC(int id, int state)
        {
            return dal.UpdateHC(id, state);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateYJ(int id, int state)
        {
            return dal.UpdateYJ(id, state);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateAsk(CallCenterApi.Model.T_Call_TaskTelNum model)
        {
            return dal.UpdateAsk(model);
        }

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

            return dal.Delete(F_Id);
        }

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

            return dal.ClearPhone(F_Id);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string F_Idlist)
        {
            return dal.DeleteList(F_Idlist);
        }

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

            return dal.GetModel(F_Id);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Call_TaskTelNum> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Call_TaskTelNum> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_Call_TaskTelNum> modelList = new List<CallCenterApi.Model.T_Call_TaskTelNum>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_Call_TaskTelNum model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_Call_TaskTelNum();
                    if (dt.Rows[n]["F_Id"] != null && dt.Rows[n]["F_Id"].ToString() != "")
                    {
                        model.F_Id = int.Parse(dt.Rows[n]["F_Id"].ToString());
                    }
                    if (dt.Rows[n]["F_TaskId"] != null && dt.Rows[n]["F_TaskId"].ToString() != "")
                    {
                        model.F_TaskId = int.Parse(dt.Rows[n]["F_TaskId"].ToString());
                    }
                    if (dt.Rows[n]["F_Phone"] != null && dt.Rows[n]["F_Phone"].ToString() != "")
                    {
                        model.F_Phone = dt.Rows[n]["F_Phone"].ToString();
                    }
                    if (dt.Rows[n]["F_Customer"] != null && dt.Rows[n]["F_Customer"].ToString() != "")
                    {
                        model.F_Customer = dt.Rows[n]["F_Customer"].ToString();
                    }
                    if (dt.Rows[n]["F_PhoneBy"] != null && dt.Rows[n]["F_PhoneBy"].ToString() != "")
                    {
                        model.F_PhoneBy = dt.Rows[n]["F_PhoneBy"].ToString();
                    }
                    if (dt.Rows[n]["F_Sex"] != null && dt.Rows[n]["F_Sex"].ToString() != "")
                    {
                        model.F_Sex = dt.Rows[n]["F_Sex"].ToString();
                    }
                    if (dt.Rows[n]["F_FPState"] != null && dt.Rows[n]["F_FPState"].ToString() != "")
                    {
                        model.F_FPState = int.Parse(dt.Rows[n]["F_FPState"].ToString());
                    }
                    if (dt.Rows[n]["F_YJState"] != null && dt.Rows[n]["F_YJState"].ToString() != "")
                    {
                        model.F_YJState = int.Parse(dt.Rows[n]["F_YJState"].ToString());
                    }
                    if (dt.Rows[n]["F_HCState"] != null && dt.Rows[n]["F_HCState"].ToString() != "")
                    {
                        model.F_HCState = int.Parse(dt.Rows[n]["F_HCState"].ToString());
                    }
                    if (dt.Rows[n]["F_UserId"] != null && dt.Rows[n]["F_UserId"].ToString() != "")
                    {
                        model.F_UserId = int.Parse(dt.Rows[n]["F_UserId"].ToString());
                    }
                    if (dt.Rows[n]["F_UserName"] != null && dt.Rows[n]["F_UserName"].ToString() != "")
                    {
                        model.F_UserName = dt.Rows[n]["F_UserName"].ToString();
                    }
                    if (dt.Rows[n]["F_CreateTime"] != null && dt.Rows[n]["F_CreateTime"].ToString() != "")
                    {
                        model.F_CreateTime = DateTime.Parse(dt.Rows[n]["F_CreateTime"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField1"] != null && dt.Rows[n]["ExpandIntField1"].ToString() != "")
                    {
                        model.ExpandIntField1 = int.Parse(dt.Rows[n]["ExpandIntField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField2"] != null && dt.Rows[n]["ExpandIntField2"].ToString() != "")
                    {
                        model.ExpandIntField2 = int.Parse(dt.Rows[n]["ExpandIntField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField3"] != null && dt.Rows[n]["ExpandIntField3"].ToString() != "")
                    {
                        model.ExpandIntField3 = int.Parse(dt.Rows[n]["ExpandIntField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField4"] != null && dt.Rows[n]["ExpandIntField4"].ToString() != "")
                    {
                        model.ExpandIntField4 = int.Parse(dt.Rows[n]["ExpandIntField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField5"] != null && dt.Rows[n]["ExpandIntField5"].ToString() != "")
                    {
                        model.ExpandIntField5 = int.Parse(dt.Rows[n]["ExpandIntField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField6"] != null && dt.Rows[n]["ExpandIntField6"].ToString() != "")
                    {
                        model.ExpandIntField6 = int.Parse(dt.Rows[n]["ExpandIntField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField1"] != null && dt.Rows[n]["ExpandDecField1"].ToString() != "")
                    {
                        model.ExpandDecField1 = decimal.Parse(dt.Rows[n]["ExpandDecField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField2"] != null && dt.Rows[n]["ExpandDecField2"].ToString() != "")
                    {
                        model.ExpandDecField2 = decimal.Parse(dt.Rows[n]["ExpandDecField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField3"] != null && dt.Rows[n]["ExpandDecField3"].ToString() != "")
                    {
                        model.ExpandDecField3 = decimal.Parse(dt.Rows[n]["ExpandDecField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField4"] != null && dt.Rows[n]["ExpandDecField4"].ToString() != "")
                    {
                        model.ExpandDecField4 = decimal.Parse(dt.Rows[n]["ExpandDecField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField5"] != null && dt.Rows[n]["ExpandDecField5"].ToString() != "")
                    {
                        model.ExpandDecField5 = decimal.Parse(dt.Rows[n]["ExpandDecField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField6"] != null && dt.Rows[n]["ExpandDecField6"].ToString() != "")
                    {
                        model.ExpandDecField6 = decimal.Parse(dt.Rows[n]["ExpandDecField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField1"] != null && dt.Rows[n]["ExpandDatField1"].ToString() != "")
                    {
                        model.ExpandDatField1 = DateTime.Parse(dt.Rows[n]["ExpandDatField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField2"] != null && dt.Rows[n]["ExpandDatField2"].ToString() != "")
                    {
                        model.ExpandDatField2 = DateTime.Parse(dt.Rows[n]["ExpandDatField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField3"] != null && dt.Rows[n]["ExpandDatField3"].ToString() != "")
                    {
                        model.ExpandDatField3 = DateTime.Parse(dt.Rows[n]["ExpandDatField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField4"] != null && dt.Rows[n]["ExpandDatField4"].ToString() != "")
                    {
                        model.ExpandDatField4 = DateTime.Parse(dt.Rows[n]["ExpandDatField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField5"] != null && dt.Rows[n]["ExpandDatField5"].ToString() != "")
                    {
                        model.ExpandDatField5 = DateTime.Parse(dt.Rows[n]["ExpandDatField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField6"] != null && dt.Rows[n]["ExpandDatField6"].ToString() != "")
                    {
                        model.ExpandDatField6 = DateTime.Parse(dt.Rows[n]["ExpandDatField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandVchField1"] != null && dt.Rows[n]["ExpandVchField1"].ToString() != "")
                    {
                        model.ExpandVchField1 = dt.Rows[n]["ExpandVchField1"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField2"] != null && dt.Rows[n]["ExpandVchField2"].ToString() != "")
                    {
                        model.ExpandVchField2 = dt.Rows[n]["ExpandVchField2"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField3"] != null && dt.Rows[n]["ExpandVchField3"].ToString() != "")
                    {
                        model.ExpandVchField3 = dt.Rows[n]["ExpandVchField3"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField4"] != null && dt.Rows[n]["ExpandVchField4"].ToString() != "")
                    {
                        model.ExpandVchField4 = dt.Rows[n]["ExpandVchField4"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField5"] != null && dt.Rows[n]["ExpandVchField5"].ToString() != "")
                    {
                        model.ExpandVchField5 = dt.Rows[n]["ExpandVchField5"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField6"] != null && dt.Rows[n]["ExpandVchField6"].ToString() != "")
                    {
                        model.ExpandVchField6 = dt.Rows[n]["ExpandVchField6"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField7"] != null && dt.Rows[n]["ExpandVchField7"].ToString() != "")
                    {
                        model.ExpandVchField7 = dt.Rows[n]["ExpandVchField7"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField8"] != null && dt.Rows[n]["ExpandVchField8"].ToString() != "")
                    {
                        model.ExpandVchField8 = dt.Rows[n]["ExpandVchField8"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField9"] != null && dt.Rows[n]["ExpandVchField9"].ToString() != "")
                    {
                        model.ExpandVchField9 = dt.Rows[n]["ExpandVchField9"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField10"] != null && dt.Rows[n]["ExpandVchField10"].ToString() != "")
                    {
                        model.ExpandVchField10 = dt.Rows[n]["ExpandVchField10"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField11"] != null && dt.Rows[n]["ExpandVchField11"].ToString() != "")
                    {
                        model.ExpandVchField11 = dt.Rows[n]["ExpandVchField11"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField12"] != null && dt.Rows[n]["ExpandVchField12"].ToString() != "")
                    {
                        model.ExpandVchField12 = dt.Rows[n]["ExpandVchField12"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField13"] != null && dt.Rows[n]["ExpandVchField13"].ToString() != "")
                    {
                        model.ExpandVchField13 = dt.Rows[n]["ExpandVchField13"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField14"] != null && dt.Rows[n]["ExpandVchField14"].ToString() != "")
                    {
                        model.ExpandVchField14 = dt.Rows[n]["ExpandVchField14"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField15"] != null && dt.Rows[n]["ExpandVchField15"].ToString() != "")
                    {
                        model.ExpandVchField15 = dt.Rows[n]["ExpandVchField15"].ToString();
                    }
                    if (dt.Rows[n]["ExpandSintField1"] != null && dt.Rows[n]["ExpandSintField1"].ToString() != "")
                    {
                        model.ExpandSintField1 = int.Parse(dt.Rows[n]["ExpandSintField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField2"] != null && dt.Rows[n]["ExpandSintField2"].ToString() != "")
                    {
                        model.ExpandSintField2 = int.Parse(dt.Rows[n]["ExpandSintField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField3"] != null && dt.Rows[n]["ExpandSintField3"].ToString() != "")
                    {
                        model.ExpandSintField3 = int.Parse(dt.Rows[n]["ExpandSintField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField4"] != null && dt.Rows[n]["ExpandSintField4"].ToString() != "")
                    {
                        model.ExpandSintField4 = int.Parse(dt.Rows[n]["ExpandSintField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField5"] != null && dt.Rows[n]["ExpandSintField5"].ToString() != "")
                    {
                        model.ExpandSintField5 = int.Parse(dt.Rows[n]["ExpandSintField5"].ToString());
                    }
                    try
                    {
                        model.TaskName = dt.Rows[n]["TaskName"].ToString();
                    }
                    catch
                    { }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Call_TaskTelNumRes> DataTableToListRes(DataTable dt)
        {
            List<CallCenterApi.Model.T_Call_TaskTelNumRes> modelList = new List<CallCenterApi.Model.T_Call_TaskTelNumRes>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_Call_TaskTelNumRes model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CallCenterApi.Model.T_Call_TaskTelNumRes();
                    if (dt.Rows[n]["F_Id"] != null && dt.Rows[n]["F_Id"].ToString() != "")
                    {
                        model.F_Id = int.Parse(dt.Rows[n]["F_Id"].ToString());
                    }
                    if (dt.Rows[n]["F_TaskId"] != null && dt.Rows[n]["F_TaskId"].ToString() != "")
                    {
                        model.F_TaskId = int.Parse(dt.Rows[n]["F_TaskId"].ToString());
                    }
                    if (dt.Rows[n]["F_Phone"] != null && dt.Rows[n]["F_Phone"].ToString() != "")
                    {
                        model.F_Phone = dt.Rows[n]["F_Phone"].ToString();
                    }
                    if (dt.Rows[n]["F_Customer"] != null && dt.Rows[n]["F_Customer"].ToString() != "")
                    {
                        model.F_Customer = dt.Rows[n]["F_Customer"].ToString();
                    }
                    if (dt.Rows[n]["F_PhoneBy"] != null && dt.Rows[n]["F_PhoneBy"].ToString() != "")
                    {
                        model.F_PhoneBy = dt.Rows[n]["F_PhoneBy"].ToString();
                    }
                    if (dt.Rows[n]["F_Sex"] != null && dt.Rows[n]["F_Sex"].ToString() != "")
                    {
                        model.F_Sex = dt.Rows[n]["F_Sex"].ToString();
                    }
                    if (dt.Rows[n]["F_FPState"] != null && dt.Rows[n]["F_FPState"].ToString() != "")
                    {
                        model.F_FPState = int.Parse(dt.Rows[n]["F_FPState"].ToString());
                    }
                    if (dt.Rows[n]["F_YJState"] != null && dt.Rows[n]["F_YJState"].ToString() != "")
                    {
                        model.F_YJState = int.Parse(dt.Rows[n]["F_YJState"].ToString());
                    }
                    if (dt.Rows[n]["F_HCState"] != null && dt.Rows[n]["F_HCState"].ToString() != "")
                    {
                        model.F_HCState = int.Parse(dt.Rows[n]["F_HCState"].ToString());
                    }
                    if (dt.Rows[n]["F_UserId"] != null && dt.Rows[n]["F_UserId"].ToString() != "")
                    {
                        model.F_UserId = int.Parse(dt.Rows[n]["F_UserId"].ToString());
                    }
                    if (dt.Rows[n]["F_UserName"] != null && dt.Rows[n]["F_UserName"].ToString() != "")
                    {
                        model.F_UserName = dt.Rows[n]["F_UserName"].ToString();
                    }
                    if (dt.Rows[n]["F_CreateTime"] != null && dt.Rows[n]["F_CreateTime"].ToString() != "")
                    {
                        model.F_CreateTime = DateTime.Parse(dt.Rows[n]["F_CreateTime"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField1"] != null && dt.Rows[n]["ExpandIntField1"].ToString() != "")
                    {
                        model.ExpandIntField1 = int.Parse(dt.Rows[n]["ExpandIntField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField2"] != null && dt.Rows[n]["ExpandIntField2"].ToString() != "")
                    {
                        model.ExpandIntField2 = int.Parse(dt.Rows[n]["ExpandIntField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField3"] != null && dt.Rows[n]["ExpandIntField3"].ToString() != "")
                    {
                        model.ExpandIntField3 = int.Parse(dt.Rows[n]["ExpandIntField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField4"] != null && dt.Rows[n]["ExpandIntField4"].ToString() != "")
                    {
                        model.ExpandIntField4 = int.Parse(dt.Rows[n]["ExpandIntField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField5"] != null && dt.Rows[n]["ExpandIntField5"].ToString() != "")
                    {
                        model.ExpandIntField5 = int.Parse(dt.Rows[n]["ExpandIntField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandIntField6"] != null && dt.Rows[n]["ExpandIntField6"].ToString() != "")
                    {
                        model.ExpandIntField6 = int.Parse(dt.Rows[n]["ExpandIntField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField1"] != null && dt.Rows[n]["ExpandDecField1"].ToString() != "")
                    {
                        model.ExpandDecField1 = decimal.Parse(dt.Rows[n]["ExpandDecField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField2"] != null && dt.Rows[n]["ExpandDecField2"].ToString() != "")
                    {
                        model.ExpandDecField2 = decimal.Parse(dt.Rows[n]["ExpandDecField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField3"] != null && dt.Rows[n]["ExpandDecField3"].ToString() != "")
                    {
                        model.ExpandDecField3 = decimal.Parse(dt.Rows[n]["ExpandDecField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField4"] != null && dt.Rows[n]["ExpandDecField4"].ToString() != "")
                    {
                        model.ExpandDecField4 = decimal.Parse(dt.Rows[n]["ExpandDecField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField5"] != null && dt.Rows[n]["ExpandDecField5"].ToString() != "")
                    {
                        model.ExpandDecField5 = decimal.Parse(dt.Rows[n]["ExpandDecField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDecField6"] != null && dt.Rows[n]["ExpandDecField6"].ToString() != "")
                    {
                        model.ExpandDecField6 = decimal.Parse(dt.Rows[n]["ExpandDecField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField1"] != null && dt.Rows[n]["ExpandDatField1"].ToString() != "")
                    {
                        model.ExpandDatField1 = DateTime.Parse(dt.Rows[n]["ExpandDatField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField2"] != null && dt.Rows[n]["ExpandDatField2"].ToString() != "")
                    {
                        model.ExpandDatField2 = DateTime.Parse(dt.Rows[n]["ExpandDatField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField3"] != null && dt.Rows[n]["ExpandDatField3"].ToString() != "")
                    {
                        model.ExpandDatField3 = DateTime.Parse(dt.Rows[n]["ExpandDatField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField4"] != null && dt.Rows[n]["ExpandDatField4"].ToString() != "")
                    {
                        model.ExpandDatField4 = DateTime.Parse(dt.Rows[n]["ExpandDatField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField5"] != null && dt.Rows[n]["ExpandDatField5"].ToString() != "")
                    {
                        model.ExpandDatField5 = DateTime.Parse(dt.Rows[n]["ExpandDatField5"].ToString());
                    }
                    if (dt.Rows[n]["ExpandDatField6"] != null && dt.Rows[n]["ExpandDatField6"].ToString() != "")
                    {
                        model.ExpandDatField6 = DateTime.Parse(dt.Rows[n]["ExpandDatField6"].ToString());
                    }
                    if (dt.Rows[n]["ExpandVchField1"] != null && dt.Rows[n]["ExpandVchField1"].ToString() != "")
                    {
                        model.ExpandVchField1 = dt.Rows[n]["ExpandVchField1"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField2"] != null && dt.Rows[n]["ExpandVchField2"].ToString() != "")
                    {
                        model.ExpandVchField2 = dt.Rows[n]["ExpandVchField2"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField3"] != null && dt.Rows[n]["ExpandVchField3"].ToString() != "")
                    {
                        model.ExpandVchField3 = dt.Rows[n]["ExpandVchField3"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField4"] != null && dt.Rows[n]["ExpandVchField4"].ToString() != "")
                    {
                        model.ExpandVchField4 = dt.Rows[n]["ExpandVchField4"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField5"] != null && dt.Rows[n]["ExpandVchField5"].ToString() != "")
                    {
                        model.ExpandVchField5 = dt.Rows[n]["ExpandVchField5"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField6"] != null && dt.Rows[n]["ExpandVchField6"].ToString() != "")
                    {
                        model.ExpandVchField6 = dt.Rows[n]["ExpandVchField6"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField7"] != null && dt.Rows[n]["ExpandVchField7"].ToString() != "")
                    {
                        model.ExpandVchField7 = dt.Rows[n]["ExpandVchField7"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField8"] != null && dt.Rows[n]["ExpandVchField8"].ToString() != "")
                    {
                        model.ExpandVchField8 = dt.Rows[n]["ExpandVchField8"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField9"] != null && dt.Rows[n]["ExpandVchField9"].ToString() != "")
                    {
                        model.ExpandVchField9 = dt.Rows[n]["ExpandVchField9"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField10"] != null && dt.Rows[n]["ExpandVchField10"].ToString() != "")
                    {
                        model.ExpandVchField10 = dt.Rows[n]["ExpandVchField10"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField11"] != null && dt.Rows[n]["ExpandVchField11"].ToString() != "")
                    {
                        model.ExpandVchField11 = dt.Rows[n]["ExpandVchField11"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField12"] != null && dt.Rows[n]["ExpandVchField12"].ToString() != "")
                    {
                        model.ExpandVchField12 = dt.Rows[n]["ExpandVchField12"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField13"] != null && dt.Rows[n]["ExpandVchField13"].ToString() != "")
                    {
                        model.ExpandVchField13 = dt.Rows[n]["ExpandVchField13"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField14"] != null && dt.Rows[n]["ExpandVchField14"].ToString() != "")
                    {
                        model.ExpandVchField14 = dt.Rows[n]["ExpandVchField14"].ToString();
                    }
                    if (dt.Rows[n]["ExpandVchField15"] != null && dt.Rows[n]["ExpandVchField15"].ToString() != "")
                    {
                        model.ExpandVchField15 = dt.Rows[n]["ExpandVchField15"].ToString();
                    }
                    if (dt.Rows[n]["ExpandSintField1"] != null && dt.Rows[n]["ExpandSintField1"].ToString() != "")
                    {
                        model.ExpandSintField1 = int.Parse(dt.Rows[n]["ExpandSintField1"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField2"] != null && dt.Rows[n]["ExpandSintField2"].ToString() != "")
                    {
                        model.ExpandSintField2 = int.Parse(dt.Rows[n]["ExpandSintField2"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField3"] != null && dt.Rows[n]["ExpandSintField3"].ToString() != "")
                    {
                        model.ExpandSintField3 = int.Parse(dt.Rows[n]["ExpandSintField3"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField4"] != null && dt.Rows[n]["ExpandSintField4"].ToString() != "")
                    {
                        model.ExpandSintField4 = int.Parse(dt.Rows[n]["ExpandSintField4"].ToString());
                    }
                    if (dt.Rows[n]["ExpandSintField5"] != null && dt.Rows[n]["ExpandSintField5"].ToString() != "")
                    {
                        model.ExpandSintField5 = int.Parse(dt.Rows[n]["ExpandSintField5"].ToString());
                    }
                    try
                    {
                        model.TaskName = dt.Rows[n]["TaskName"].ToString();
                    }
                    catch
                    { }
                    DataTable newdt = new DataTable();
                    try
                    {
                        model.CallOutCount = 0;
                        model.CallOutJTCount = 0;
                        string id = dt.Rows[n]["F_Id"].ToString();
                        newdt = new BLL.T_Call_CallRecords().GetList(" OperateType=7 and CallType=1 and OperateObject='" + id + "' order by BeginTime desc ").Tables[0];
                        if (newdt.Rows.Count > 0)
                        {
                            model.LastCallTime = DateTime.Parse(newdt.Rows[0]["BeginTime"].ToString());
                            model.CallOutCount = newdt.Rows.Count;
                            model.CallOutJTCount = newdt.Select(" CallState=1 ").Length;
                        }
                    }
                    catch
                    { }
                    finally
                    {
                        newdt.Clear();
                        newdt.Dispose();
                    }

                    if (dt.Rows[n]["F_HJJGId"] != null && dt.Rows[n]["F_HJJGId"].ToString() != "")
                    {
                        model.F_HJJGId = int.Parse(dt.Rows[n]["F_HJJGId"].ToString());
                    }
                    if (dt.Rows[n]["F_HJJGName"] != null && dt.Rows[n]["F_HJJGName"].ToString() != "")
                    {
                        model.F_HJJGName = dt.Rows[n]["F_HJJGName"].ToString();
                    }

                    if (dt.Rows[n]["F_YHFKId"] != null && dt.Rows[n]["F_YHFKId"].ToString() != "")
                    {
                        model.F_YHFKId = int.Parse(dt.Rows[n]["F_YHFKId"].ToString());
                    }
                    if (dt.Rows[n]["F_YHFKName"] != null && dt.Rows[n]["F_YHFKName"].ToString() != "")
                    {
                        model.F_YHFKName = dt.Rows[n]["F_YHFKName"].ToString();
                    }

                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        /// <summary>
        /// 获取表结构
        /// </summary>
        /// <returns></returns>
        public DataTable GetTableDesign()
        {
            return dal.GetTableDesign();
        }

        /// <summary>
        /// 大量数据导入SqlBulkCopy
        /// </summary>
        /// <returns></returns>
        public void SqlBulkCopy(DataTable dt)
        {
            dal.SqlBulkCopy(dt);
        }

        #endregion  Method
    }
}
