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_Repository_List_log
	/// </summary>
	public partial class T_Repository_List_log
    {
        public T_Repository_List_log()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_LogId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from T_Repository_List_log");
            strSql.Append(" where F_LogId=@F_LogId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_LogId", SqlDbType.Int,4)
            };
            parameters[0].Value = F_LogId;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(CallCenterApi.Model.T_Repository_List_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_Repository_List_log(");
            strSql.Append("F_RepositoryId,F_DeptId,F_Key,F_Title,F_MainDept,F_PublicPhone1,F_PublicPhone2,F_PrivatePhone1,F_PrivatePhone2,F_Points,F_BaseAnswer,F_EndAnswer,F_DealType,F_LegalLimitTime,F_PromiseLimitTime,F_IsPay,F_PayMoney,F_OfficeAddress,F_Object,F_BusLine,F_OfficeTime,F_OtherDept,F_OtherPublicPhone,F_OtherPrivatePhone,F_Remark,F_BaseOn,F_Process,F_Material,F_Template,F_PayInfo,F_File,F_State,F_IsUrgent,F_CreateBy,F_CreateOn,F_Action)");
            strSql.Append(" values (");
            strSql.Append("@F_RepositoryId,@F_DeptId,@F_Key,@F_Title,@F_MainDept,@F_PublicPhone1,@F_PublicPhone2,@F_PrivatePhone1,@F_PrivatePhone2,@F_Points,@F_BaseAnswer,@F_EndAnswer,@F_DealType,@F_LegalLimitTime,@F_PromiseLimitTime,@F_IsPay,@F_PayMoney,@F_OfficeAddress,@F_Object,@F_BusLine,@F_OfficeTime,@F_OtherDept,@F_OtherPublicPhone,@F_OtherPrivatePhone,@F_Remark,@F_BaseOn,@F_Process,@F_Material,@F_Template,@F_PayInfo,@F_File,@F_State,@F_IsUrgent,@F_CreateBy,@F_CreateOn,@F_Action)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_RepositoryId", SqlDbType.Int,4),
                    new SqlParameter("@F_DeptId", SqlDbType.Int,4),
                    new SqlParameter("@F_Key", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_Title", SqlDbType.NVarChar,2000),
                    new SqlParameter("@F_MainDept", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_PublicPhone1", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PublicPhone2", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PrivatePhone1", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PrivatePhone2", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Points", SqlDbType.NVarChar),
                    new SqlParameter("@F_BaseAnswer", SqlDbType.NVarChar),
                    new SqlParameter("@F_EndAnswer", SqlDbType.NVarChar),
                    new SqlParameter("@F_DealType", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_LegalLimitTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_PromiseLimitTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_IsPay", SqlDbType.Int,4),
                    new SqlParameter("@F_PayMoney", SqlDbType.Decimal,9),
                    new SqlParameter("@F_OfficeAddress", SqlDbType.NVarChar,2000),
                    new SqlParameter("@F_Object", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_BusLine", SqlDbType.NVarChar),
                    new SqlParameter("@F_OfficeTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_OtherDept", SqlDbType.NVarChar),
                    new SqlParameter("@F_OtherPublicPhone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_OtherPrivatePhone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Remark", SqlDbType.NVarChar),
                    new SqlParameter("@F_BaseOn", SqlDbType.NVarChar),
                    new SqlParameter("@F_Process", SqlDbType.NVarChar),
                    new SqlParameter("@F_Material", SqlDbType.NVarChar),
                    new SqlParameter("@F_Template", SqlDbType.NVarChar),
                    new SqlParameter("@F_PayInfo", SqlDbType.NVarChar),
                    new SqlParameter("@F_File", SqlDbType.VarChar),
                    new SqlParameter("@F_State", SqlDbType.Int,4),
                    new SqlParameter("@F_IsUrgent", SqlDbType.Int,4),
                    new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
                    new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
                    new SqlParameter("@F_Action", SqlDbType.Int,4)};
            parameters[0].Value = model.F_RepositoryId;
            parameters[1].Value = model.F_DeptId;
            parameters[2].Value = model.F_Key;
            parameters[3].Value = model.F_Title;
            parameters[4].Value = model.F_MainDept;
            parameters[5].Value = model.F_PublicPhone1;
            parameters[6].Value = model.F_PublicPhone2;
            parameters[7].Value = model.F_PrivatePhone1;
            parameters[8].Value = model.F_PrivatePhone2;
            parameters[9].Value = model.F_Points;
            parameters[10].Value = model.F_BaseAnswer;
            parameters[11].Value = model.F_EndAnswer;
            parameters[12].Value = model.F_DealType;
            parameters[13].Value = model.F_LegalLimitTime;
            parameters[14].Value = model.F_PromiseLimitTime;
            parameters[15].Value = model.F_IsPay;
            parameters[16].Value = model.F_PayMoney;
            parameters[17].Value = model.F_OfficeAddress;
            parameters[18].Value = model.F_Object;
            parameters[19].Value = model.F_BusLine;
            parameters[20].Value = model.F_OfficeTime;
            parameters[21].Value = model.F_OtherDept;
            parameters[22].Value = model.F_OtherPublicPhone;
            parameters[23].Value = model.F_OtherPrivatePhone;
            parameters[24].Value = model.F_Remark;
            parameters[25].Value = model.F_BaseOn;
            parameters[26].Value = model.F_Process;
            parameters[27].Value = model.F_Material;
            parameters[28].Value = model.F_Template;
            parameters[29].Value = model.F_PayInfo;
            parameters[30].Value = model.F_File;
            parameters[31].Value = model.F_State;
            parameters[32].Value = model.F_IsUrgent;
            parameters[33].Value = model.F_CreateBy;
            parameters[34].Value = model.F_CreateOn;
            parameters[35].Value = model.F_Action;

            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_Repository_List_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Repository_List_log set ");
            strSql.Append("F_RepositoryId=@F_RepositoryId,");
            strSql.Append("F_DeptId=@F_DeptId,");
            strSql.Append("F_Key=@F_Key,");
            strSql.Append("F_Title=@F_Title,");
            strSql.Append("F_MainDept=@F_MainDept,");
            strSql.Append("F_PublicPhone1=@F_PublicPhone1,");
            strSql.Append("F_PublicPhone2=@F_PublicPhone2,");
            strSql.Append("F_PrivatePhone1=@F_PrivatePhone1,");
            strSql.Append("F_PrivatePhone2=@F_PrivatePhone2,");
            strSql.Append("F_Points=@F_Points,");
            strSql.Append("F_BaseAnswer=@F_BaseAnswer,");
            strSql.Append("F_EndAnswer=@F_EndAnswer,");
            strSql.Append("F_DealType=@F_DealType,");
            strSql.Append("F_LegalLimitTime=@F_LegalLimitTime,");
            strSql.Append("F_PromiseLimitTime=@F_PromiseLimitTime,");
            strSql.Append("F_IsPay=@F_IsPay,");
            strSql.Append("F_PayMoney=@F_PayMoney,");
            strSql.Append("F_OfficeAddress=@F_OfficeAddress,");
            strSql.Append("F_Object=@F_Object,");
            strSql.Append("F_BusLine=@F_BusLine,");
            strSql.Append("F_OfficeTime=@F_OfficeTime,");
            strSql.Append("F_OtherDept=@F_OtherDept,");
            strSql.Append("F_OtherPublicPhone=@F_OtherPublicPhone,");
            strSql.Append("F_OtherPrivatePhone=@F_OtherPrivatePhone,");
            strSql.Append("F_Remark=@F_Remark,");
            strSql.Append("F_BaseOn=@F_BaseOn,");
            strSql.Append("F_Process=@F_Process,");
            strSql.Append("F_Material=@F_Material,");
            strSql.Append("F_Template=@F_Template,");
            strSql.Append("F_PayInfo=@F_PayInfo,");
            strSql.Append("F_File=@F_File,");
            strSql.Append("F_State=@F_State,");
            strSql.Append("F_IsUrgent=@F_IsUrgent,");
            strSql.Append("F_CreateBy=@F_CreateBy,");
            strSql.Append("F_CreateOn=@F_CreateOn,");
            strSql.Append("F_Action=@F_Action");
            strSql.Append(" where F_LogId=@F_LogId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_RepositoryId", SqlDbType.Int,4),
                    new SqlParameter("@F_DeptId", SqlDbType.Int,4),
                     new SqlParameter("@F_Key", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_Title", SqlDbType.NVarChar,2000),
                    new SqlParameter("@F_MainDept", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_PublicPhone1", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PublicPhone2", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PrivatePhone1", SqlDbType.VarChar,200),
                    new SqlParameter("@F_PrivatePhone2", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Points", SqlDbType.NVarChar),
                    new SqlParameter("@F_BaseAnswer", SqlDbType.NVarChar),
                    new SqlParameter("@F_EndAnswer", SqlDbType.NVarChar),
                    new SqlParameter("@F_DealType", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_LegalLimitTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_PromiseLimitTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_IsPay", SqlDbType.Int,4),
                    new SqlParameter("@F_PayMoney", SqlDbType.Decimal,9),
                    new SqlParameter("@F_OfficeAddress", SqlDbType.NVarChar,2000),
                    new SqlParameter("@F_Object", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_BusLine", SqlDbType.NVarChar),
                    new SqlParameter("@F_OfficeTime", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_OtherDept", SqlDbType.NVarChar),
                    new SqlParameter("@F_OtherPublicPhone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_OtherPrivatePhone", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Remark", SqlDbType.NVarChar),
                    new SqlParameter("@F_BaseOn", SqlDbType.NVarChar),
                    new SqlParameter("@F_Process", SqlDbType.NVarChar),
                    new SqlParameter("@F_Material", SqlDbType.NVarChar),
                    new SqlParameter("@F_Template", SqlDbType.NVarChar),
                    new SqlParameter("@F_PayInfo", SqlDbType.NVarChar),
                    new SqlParameter("@F_File", SqlDbType.VarChar),
                    new SqlParameter("@F_State", SqlDbType.Int,4),
                    new SqlParameter("@F_IsUrgent", SqlDbType.Int,4),
                    new SqlParameter("@F_CreateBy", SqlDbType.VarChar,50),
                    new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
                    new SqlParameter("@F_Action", SqlDbType.Int,4),
                    new SqlParameter("@F_LogId", SqlDbType.Int,4)};
            parameters[0].Value = model.F_RepositoryId;
            parameters[1].Value = model.F_DeptId;
            parameters[2].Value = model.F_Key;
            parameters[3].Value = model.F_Title;
            parameters[4].Value = model.F_MainDept;
            parameters[5].Value = model.F_PublicPhone1;
            parameters[6].Value = model.F_PublicPhone2;
            parameters[7].Value = model.F_PrivatePhone1;
            parameters[8].Value = model.F_PrivatePhone2;
            parameters[9].Value = model.F_Points;
            parameters[10].Value = model.F_BaseAnswer;
            parameters[11].Value = model.F_EndAnswer;
            parameters[12].Value = model.F_DealType;
            parameters[13].Value = model.F_LegalLimitTime;
            parameters[14].Value = model.F_PromiseLimitTime;
            parameters[15].Value = model.F_IsPay;
            parameters[16].Value = model.F_PayMoney;
            parameters[17].Value = model.F_OfficeAddress;
            parameters[18].Value = model.F_Object;
            parameters[19].Value = model.F_BusLine;
            parameters[20].Value = model.F_OfficeTime;
            parameters[21].Value = model.F_OtherDept;
            parameters[22].Value = model.F_OtherPublicPhone;
            parameters[23].Value = model.F_OtherPrivatePhone;
            parameters[24].Value = model.F_Remark;
            parameters[25].Value = model.F_BaseOn;
            parameters[26].Value = model.F_Process;
            parameters[27].Value = model.F_Material;
            parameters[28].Value = model.F_Template;
            parameters[29].Value = model.F_PayInfo;
            parameters[30].Value = model.F_File;
            parameters[31].Value = model.F_State;
            parameters[32].Value = model.F_IsUrgent;
            parameters[33].Value = model.F_CreateBy;
            parameters[34].Value = model.F_CreateOn;
            parameters[35].Value = model.F_Action;
            parameters[36].Value = model.F_LogId;

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

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

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

            CallCenterApi.Model.T_Repository_List_log model = new CallCenterApi.Model.T_Repository_List_log();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["F_LogId"] != null && ds.Tables[0].Rows[0]["F_LogId"].ToString() != "")
                {
                    model.F_LogId = int.Parse(ds.Tables[0].Rows[0]["F_LogId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_RepositoryId"] != null && ds.Tables[0].Rows[0]["F_RepositoryId"].ToString() != "")
                {
                    model.F_RepositoryId = int.Parse(ds.Tables[0].Rows[0]["F_RepositoryId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_DeptId"] != null && ds.Tables[0].Rows[0]["F_DeptId"].ToString() != "")
                {
                    model.F_DeptId = int.Parse(ds.Tables[0].Rows[0]["F_DeptId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_Key"] != null && ds.Tables[0].Rows[0]["F_Key"].ToString() != "")
                {
                    model.F_Key = ds.Tables[0].Rows[0]["F_Key"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Title"] != null && ds.Tables[0].Rows[0]["F_Title"].ToString() != "")
                {
                    model.F_Title = ds.Tables[0].Rows[0]["F_Title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_MainDept"] != null && ds.Tables[0].Rows[0]["F_MainDept"].ToString() != "")
                {
                    model.F_MainDept = ds.Tables[0].Rows[0]["F_MainDept"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PublicPhone1"] != null && ds.Tables[0].Rows[0]["F_PublicPhone1"].ToString() != "")
                {
                    model.F_PublicPhone1 = ds.Tables[0].Rows[0]["F_PublicPhone1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PublicPhone2"] != null && ds.Tables[0].Rows[0]["F_PublicPhone2"].ToString() != "")
                {
                    model.F_PublicPhone2 = ds.Tables[0].Rows[0]["F_PublicPhone2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PrivatePhone1"] != null && ds.Tables[0].Rows[0]["F_PrivatePhone1"].ToString() != "")
                {
                    model.F_PrivatePhone1 = ds.Tables[0].Rows[0]["F_PrivatePhone1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PrivatePhone2"] != null && ds.Tables[0].Rows[0]["F_PrivatePhone2"].ToString() != "")
                {
                    model.F_PrivatePhone2 = ds.Tables[0].Rows[0]["F_PrivatePhone2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Points"] != null && ds.Tables[0].Rows[0]["F_Points"].ToString() != "")
                {
                    model.F_Points = ds.Tables[0].Rows[0]["F_Points"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_BaseAnswer"] != null && ds.Tables[0].Rows[0]["F_BaseAnswer"].ToString() != "")
                {
                    model.F_BaseAnswer = ds.Tables[0].Rows[0]["F_BaseAnswer"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_EndAnswer"] != null && ds.Tables[0].Rows[0]["F_EndAnswer"].ToString() != "")
                {
                    model.F_EndAnswer = ds.Tables[0].Rows[0]["F_EndAnswer"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_DealType"] != null && ds.Tables[0].Rows[0]["F_DealType"].ToString() != "")
                {
                    model.F_DealType = ds.Tables[0].Rows[0]["F_DealType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_LegalLimitTime"] != null && ds.Tables[0].Rows[0]["F_LegalLimitTime"].ToString() != "")
                {
                    model.F_LegalLimitTime = ds.Tables[0].Rows[0]["F_LegalLimitTime"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PromiseLimitTime"] != null && ds.Tables[0].Rows[0]["F_PromiseLimitTime"].ToString() != "")
                {
                    model.F_PromiseLimitTime = ds.Tables[0].Rows[0]["F_PromiseLimitTime"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_IsPay"] != null && ds.Tables[0].Rows[0]["F_IsPay"].ToString() != "")
                {
                    model.F_IsPay = int.Parse(ds.Tables[0].Rows[0]["F_IsPay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_PayMoney"] != null && ds.Tables[0].Rows[0]["F_PayMoney"].ToString() != "")
                {
                    model.F_PayMoney = decimal.Parse(ds.Tables[0].Rows[0]["F_PayMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_OfficeAddress"] != null && ds.Tables[0].Rows[0]["F_OfficeAddress"].ToString() != "")
                {
                    model.F_OfficeAddress = ds.Tables[0].Rows[0]["F_OfficeAddress"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Object"] != null && ds.Tables[0].Rows[0]["F_Object"].ToString() != "")
                {
                    model.F_Object = ds.Tables[0].Rows[0]["F_Object"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_BusLine"] != null && ds.Tables[0].Rows[0]["F_BusLine"].ToString() != "")
                {
                    model.F_BusLine = ds.Tables[0].Rows[0]["F_BusLine"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_OfficeTime"] != null && ds.Tables[0].Rows[0]["F_OfficeTime"].ToString() != "")
                {
                    model.F_OfficeTime = ds.Tables[0].Rows[0]["F_OfficeTime"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_OtherDept"] != null && ds.Tables[0].Rows[0]["F_OtherDept"].ToString() != "")
                {
                    model.F_OtherDept = ds.Tables[0].Rows[0]["F_OtherDept"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_OtherPublicPhone"] != null && ds.Tables[0].Rows[0]["F_OtherPublicPhone"].ToString() != "")
                {
                    model.F_OtherPublicPhone = ds.Tables[0].Rows[0]["F_OtherPublicPhone"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_OtherPrivatePhone"] != null && ds.Tables[0].Rows[0]["F_OtherPrivatePhone"].ToString() != "")
                {
                    model.F_OtherPrivatePhone = ds.Tables[0].Rows[0]["F_OtherPrivatePhone"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Remark"] != null && ds.Tables[0].Rows[0]["F_Remark"].ToString() != "")
                {
                    model.F_Remark = ds.Tables[0].Rows[0]["F_Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_BaseOn"] != null && ds.Tables[0].Rows[0]["F_BaseOn"].ToString() != "")
                {
                    model.F_BaseOn = ds.Tables[0].Rows[0]["F_BaseOn"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Process"] != null && ds.Tables[0].Rows[0]["F_Process"].ToString() != "")
                {
                    model.F_Process = ds.Tables[0].Rows[0]["F_Process"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Material"] != null && ds.Tables[0].Rows[0]["F_Material"].ToString() != "")
                {
                    model.F_Material = ds.Tables[0].Rows[0]["F_Material"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_Template"] != null && ds.Tables[0].Rows[0]["F_Template"].ToString() != "")
                {
                    model.F_Template = ds.Tables[0].Rows[0]["F_Template"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_PayInfo"] != null && ds.Tables[0].Rows[0]["F_PayInfo"].ToString() != "")
                {
                    model.F_PayInfo = ds.Tables[0].Rows[0]["F_PayInfo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_File"] != null && ds.Tables[0].Rows[0]["F_File"].ToString() != "")
                {
                    model.F_File = ds.Tables[0].Rows[0]["F_File"].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_IsUrgent"] != null && ds.Tables[0].Rows[0]["F_IsUrgent"].ToString() != "")
                {
                    model.F_IsUrgent = int.Parse(ds.Tables[0].Rows[0]["F_IsUrgent"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_CreateBy"] != null && ds.Tables[0].Rows[0]["F_CreateBy"].ToString() != "")
                {
                    model.F_CreateBy = ds.Tables[0].Rows[0]["F_CreateBy"].ToString();
                }
                if (ds.Tables[0].Rows[0]["F_CreateOn"] != null && ds.Tables[0].Rows[0]["F_CreateOn"].ToString() != "")
                {
                    model.F_CreateOn = DateTime.Parse(ds.Tables[0].Rows[0]["F_CreateOn"].ToString());
                }
                if (ds.Tables[0].Rows[0]["F_Action"] != null && ds.Tables[0].Rows[0]["F_Action"].ToString() != "")
                {
                    model.F_Action = int.Parse(ds.Tables[0].Rows[0]["F_Action"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM T_Repository_List_log ");
            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_Repository_List_log ");
            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_Repository_List_log ");
            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_LogId desc");
            }
            strSql.Append(")AS Row, T.*  from T_Repository_List_log 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  Method
    }
}
