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

namespace ZXDT.CallCenter.DAL
{
    /// <summary>
    /// 数据访问类:T_Hr_EmployeeBase
    /// </summary>
    public partial class T_Hr_EmployeeBase
    {
        public T_Hr_EmployeeBase()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_EmployeeId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from T_Hr_EmployeeBase");
            strSql.Append(" where F_EmployeeId=@F_EmployeeId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_EmployeeId", SqlDbType.Int,4)
            };
            parameters[0].Value = F_EmployeeId;

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


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ZXDT.CallCenter.Model.T_Hr_EmployeeBase model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_Hr_EmployeeBase(");
            strSql.Append("F_DepartmentId,F_RealName,F_WorkingCode,F_WorkingDate,F_Sex,F_Photo,F_IDCard,F_Birth,F_NativePlace,F_Address,F_Phone,F_LinkPerson,F_LinkPhone,F_CreatedBy,F_CreatedOn,F_ModifiedBy,F_ModifiedOn,F_DeletionStateCode,F_GroupID,F_DepartmentName,F_SchoolInfo,F_Professional,F_GraduationDate,F_Resume,F_Records,F_WorkDeptId,F_Position,F_WorkDate,F_OfficePhone,F_MoveRecords,F_ContractStart,F_ContractEnd,F_ContractNature,F_ContractReminder,F_NowPay,F_Welfare,F_TranPayRecords,F_DimissionDate,F_RetireBill,F_DimissionCause,F_Education)");
            strSql.Append(" values (");
            strSql.Append("@F_DepartmentId,@F_RealName,@F_WorkingCode,@F_WorkingDate,@F_Sex,@F_Photo,@F_IDCard,@F_Birth,@F_NativePlace,@F_Address,@F_Phone,@F_LinkPerson,@F_LinkPhone,@F_CreatedBy,@F_CreatedOn,@F_ModifiedBy,@F_ModifiedOn,@F_DeletionStateCode,@F_GroupID,@F_DepartmentName,@F_SchoolInfo,@F_Professional,@F_GraduationDate,@F_Resume,@F_Records,@F_WorkDeptId,@F_Position,@F_WorkDate,@F_OfficePhone,@F_MoveRecords,@F_ContractStart,@F_ContractEnd,@F_ContractNature,@F_ContractReminder,@F_NowPay,@F_Welfare,@F_TranPayRecords,@F_DimissionDate,@F_RetireBill,@F_DimissionCause,@F_Education)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_DepartmentId", SqlDbType.Int,4),
                    new SqlParameter("@F_RealName", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkingCode", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkingDate", SqlDbType.DateTime),
                    new SqlParameter("@F_Sex", SqlDbType.SmallInt,2),
                    new SqlParameter("@F_Photo", SqlDbType.VarChar,50),
                    new SqlParameter("@F_IDCard", SqlDbType.VarChar,20),
                    new SqlParameter("@F_Birth", SqlDbType.DateTime),
                    new SqlParameter("@F_NativePlace", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Address", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Phone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_LinkPerson", SqlDbType.VarChar,50),
                    new SqlParameter("@F_LinkPhone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_CreatedBy", SqlDbType.Int,4),
                    new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
                    new SqlParameter("@F_ModifiedBy", SqlDbType.Int,4),
                    new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
                    new SqlParameter("@F_DeletionStateCode", SqlDbType.SmallInt,2),
                    new SqlParameter("@F_GroupID", SqlDbType.Int,4),
                    new SqlParameter("@F_DepartmentName", SqlDbType.VarChar,500),
                    new SqlParameter("@F_SchoolInfo", SqlDbType.VarChar,50),
                    new SqlParameter("@F_Professional", SqlDbType.VarChar,50),
                    new SqlParameter("@F_GraduationDate", SqlDbType.DateTime),
                    new SqlParameter("@F_Resume", SqlDbType.Text),
                    new SqlParameter("@F_Records", SqlDbType.Text),
                    new SqlParameter("@F_WorkDeptId", SqlDbType.Int,4),
                    new SqlParameter("@F_Position", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkDate", SqlDbType.DateTime),
                    new SqlParameter("@F_OfficePhone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_MoveRecords", SqlDbType.Text),
                    new SqlParameter("@F_ContractStart", SqlDbType.DateTime),
                    new SqlParameter("@F_ContractEnd", SqlDbType.DateTime),
                    new SqlParameter("@F_ContractNature", SqlDbType.VarChar,50),
                    new SqlParameter("@F_ContractReminder", SqlDbType.DateTime),
                    new SqlParameter("@F_NowPay", SqlDbType.Decimal,9),
                    new SqlParameter("@F_Welfare", SqlDbType.VarChar,200),
                    new SqlParameter("@F_TranPayRecords", SqlDbType.Text),
                    new SqlParameter("@F_DimissionDate", SqlDbType.DateTime),
                    new SqlParameter("@F_RetireBill", SqlDbType.VarChar,1),
                    new SqlParameter("@F_DimissionCause", SqlDbType.VarChar,50),
                    new SqlParameter("@F_Education", SqlDbType.Int,4)};
            parameters[0].Value = model.F_DepartmentId;
            parameters[1].Value = model.F_RealName;
            parameters[2].Value = model.F_WorkingCode;
            parameters[3].Value = model.F_WorkingDate;
            parameters[4].Value = model.F_Sex;
            parameters[5].Value = model.F_Photo;
            parameters[6].Value = model.F_IDCard;
            parameters[7].Value = model.F_Birth;
            parameters[8].Value = model.F_NativePlace;
            parameters[9].Value = model.F_Address;
            parameters[10].Value = model.F_Phone;
            parameters[11].Value = model.F_LinkPerson;
            parameters[12].Value = model.F_LinkPhone;
            parameters[13].Value = model.F_CreatedBy;
            parameters[14].Value = model.F_CreatedOn;
            parameters[15].Value = model.F_ModifiedBy;
            parameters[16].Value = model.F_ModifiedOn;
            parameters[17].Value = model.F_DeletionStateCode;
            parameters[18].Value = model.F_GroupID;
            parameters[19].Value = model.F_DepartmentName;
            parameters[20].Value = model.F_SchoolInfo;
            parameters[21].Value = model.F_Professional;
            parameters[22].Value = model.F_GraduationDate;
            parameters[23].Value = model.F_Resume;
            parameters[24].Value = model.F_Records;
            parameters[25].Value = model.F_WorkDeptId;
            parameters[26].Value = model.F_Position;
            parameters[27].Value = model.F_WorkDate;
            parameters[28].Value = model.F_OfficePhone;
            parameters[29].Value = model.F_MoveRecords;
            parameters[30].Value = model.F_ContractStart;
            parameters[31].Value = model.F_ContractEnd;
            parameters[32].Value = model.F_ContractNature;
            parameters[33].Value = model.F_ContractReminder;
            parameters[34].Value = model.F_NowPay;
            parameters[35].Value = model.F_Welfare;
            parameters[36].Value = model.F_TranPayRecords;
            parameters[37].Value = model.F_DimissionDate;
            parameters[38].Value = model.F_RetireBill;
            parameters[39].Value = model.F_DimissionCause;
            parameters[40].Value = model.F_Education;

            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_Hr_EmployeeBase model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_Hr_EmployeeBase set ");
            strSql.Append("F_DepartmentId=@F_DepartmentId,");
            strSql.Append("F_RealName=@F_RealName,");
            strSql.Append("F_WorkingCode=@F_WorkingCode,");
            strSql.Append("F_WorkingDate=@F_WorkingDate,");
            strSql.Append("F_Sex=@F_Sex,");
            strSql.Append("F_Photo=@F_Photo,");
            strSql.Append("F_IDCard=@F_IDCard,");
            strSql.Append("F_Birth=@F_Birth,");
            strSql.Append("F_NativePlace=@F_NativePlace,");
            strSql.Append("F_Address=@F_Address,");
            strSql.Append("F_Phone=@F_Phone,");
            strSql.Append("F_LinkPerson=@F_LinkPerson,");
            strSql.Append("F_LinkPhone=@F_LinkPhone,");
            strSql.Append("F_CreatedBy=@F_CreatedBy,");
            strSql.Append("F_CreatedOn=@F_CreatedOn,");
            strSql.Append("F_ModifiedBy=@F_ModifiedBy,");
            strSql.Append("F_ModifiedOn=@F_ModifiedOn,");
            strSql.Append("F_DeletionStateCode=@F_DeletionStateCode,");
            strSql.Append("F_GroupID=@F_GroupID,");
            strSql.Append("F_DepartmentName=@F_DepartmentName,");
            strSql.Append("F_SchoolInfo=@F_SchoolInfo,");
            strSql.Append("F_Professional=@F_Professional,");
            strSql.Append("F_GraduationDate=@F_GraduationDate,");
            strSql.Append("F_Resume=@F_Resume,");
            strSql.Append("F_Records=@F_Records,");
            strSql.Append("F_WorkDeptId=@F_WorkDeptId,");
            strSql.Append("F_Position=@F_Position,");
            strSql.Append("F_WorkDate=@F_WorkDate,");
            strSql.Append("F_OfficePhone=@F_OfficePhone,");
            strSql.Append("F_MoveRecords=@F_MoveRecords,");
            strSql.Append("F_ContractStart=@F_ContractStart,");
            strSql.Append("F_ContractEnd=@F_ContractEnd,");
            strSql.Append("F_ContractNature=@F_ContractNature,");
            strSql.Append("F_ContractReminder=@F_ContractReminder,");
            strSql.Append("F_NowPay=@F_NowPay,");
            strSql.Append("F_Welfare=@F_Welfare,");
            strSql.Append("F_TranPayRecords=@F_TranPayRecords,");
            strSql.Append("F_DimissionDate=@F_DimissionDate,");
            strSql.Append("F_RetireBill=@F_RetireBill,");
            strSql.Append("F_DimissionCause=@F_DimissionCause,");
            strSql.Append("F_Education=@F_Education");
            strSql.Append(" where F_EmployeeId=@F_EmployeeId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_DepartmentId", SqlDbType.Int,4),
                    new SqlParameter("@F_RealName", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkingCode", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkingDate", SqlDbType.DateTime),
                    new SqlParameter("@F_Sex", SqlDbType.SmallInt,2),
                    new SqlParameter("@F_Photo", SqlDbType.VarChar,50),
                    new SqlParameter("@F_IDCard", SqlDbType.VarChar,20),
                    new SqlParameter("@F_Birth", SqlDbType.DateTime),
                    new SqlParameter("@F_NativePlace", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Address", SqlDbType.VarChar,200),
                    new SqlParameter("@F_Phone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_LinkPerson", SqlDbType.VarChar,50),
                    new SqlParameter("@F_LinkPhone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_CreatedBy", SqlDbType.Int,4),
                    new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
                    new SqlParameter("@F_ModifiedBy", SqlDbType.Int,4),
                    new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
                    new SqlParameter("@F_DeletionStateCode", SqlDbType.SmallInt,2),
                    new SqlParameter("@F_GroupID", SqlDbType.Int,4),
                    new SqlParameter("@F_DepartmentName", SqlDbType.VarChar,500),
                    new SqlParameter("@F_SchoolInfo", SqlDbType.VarChar,50),
                    new SqlParameter("@F_Professional", SqlDbType.VarChar,50),
                    new SqlParameter("@F_GraduationDate", SqlDbType.DateTime),
                    new SqlParameter("@F_Resume", SqlDbType.Text),
                    new SqlParameter("@F_Records", SqlDbType.Text),
                    new SqlParameter("@F_WorkDeptId", SqlDbType.Int,4),
                    new SqlParameter("@F_Position", SqlDbType.VarChar,50),
                    new SqlParameter("@F_WorkDate", SqlDbType.DateTime),
                    new SqlParameter("@F_OfficePhone", SqlDbType.VarChar,50),
                    new SqlParameter("@F_MoveRecords", SqlDbType.Text),
                    new SqlParameter("@F_ContractStart", SqlDbType.DateTime),
                    new SqlParameter("@F_ContractEnd", SqlDbType.DateTime),
                    new SqlParameter("@F_ContractNature", SqlDbType.VarChar,50),
                    new SqlParameter("@F_ContractReminder", SqlDbType.DateTime),
                    new SqlParameter("@F_NowPay", SqlDbType.Decimal,9),
                    new SqlParameter("@F_Welfare", SqlDbType.VarChar,200),
                    new SqlParameter("@F_TranPayRecords", SqlDbType.Text),
                    new SqlParameter("@F_DimissionDate", SqlDbType.DateTime),
                    new SqlParameter("@F_RetireBill", SqlDbType.VarChar,1),
                    new SqlParameter("@F_DimissionCause", SqlDbType.VarChar,50),
                    new SqlParameter("@F_Education", SqlDbType.Int,4),
                    new SqlParameter("@F_EmployeeId", SqlDbType.Int,4)};
            parameters[0].Value = model.F_DepartmentId;
            parameters[1].Value = model.F_RealName;
            parameters[2].Value = model.F_WorkingCode;
            parameters[3].Value = model.F_WorkingDate;
            parameters[4].Value = model.F_Sex;
            parameters[5].Value = model.F_Photo;
            parameters[6].Value = model.F_IDCard;
            parameters[7].Value = model.F_Birth;
            parameters[8].Value = model.F_NativePlace;
            parameters[9].Value = model.F_Address;
            parameters[10].Value = model.F_Phone;
            parameters[11].Value = model.F_LinkPerson;
            parameters[12].Value = model.F_LinkPhone;
            parameters[13].Value = model.F_CreatedBy;
            parameters[14].Value = model.F_CreatedOn;
            parameters[15].Value = model.F_ModifiedBy;
            parameters[16].Value = model.F_ModifiedOn;
            parameters[17].Value = model.F_DeletionStateCode;
            parameters[18].Value = model.F_GroupID;
            parameters[19].Value = model.F_DepartmentName;
            parameters[20].Value = model.F_SchoolInfo;
            parameters[21].Value = model.F_Professional;
            parameters[22].Value = model.F_GraduationDate;
            parameters[23].Value = model.F_Resume;
            parameters[24].Value = model.F_Records;
            parameters[25].Value = model.F_WorkDeptId;
            parameters[26].Value = model.F_Position;
            parameters[27].Value = model.F_WorkDate;
            parameters[28].Value = model.F_OfficePhone;
            parameters[29].Value = model.F_MoveRecords;
            parameters[30].Value = model.F_ContractStart;
            parameters[31].Value = model.F_ContractEnd;
            parameters[32].Value = model.F_ContractNature;
            parameters[33].Value = model.F_ContractReminder;
            parameters[34].Value = model.F_NowPay;
            parameters[35].Value = model.F_Welfare;
            parameters[36].Value = model.F_TranPayRecords;
            parameters[37].Value = model.F_DimissionDate;
            parameters[38].Value = model.F_RetireBill;
            parameters[39].Value = model.F_DimissionCause;
            parameters[40].Value = model.F_Education;
            parameters[41].Value = model.F_EmployeeId;

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

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

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_Hr_EmployeeBase ");
            strSql.Append(" where F_EmployeeId=@F_EmployeeId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_EmployeeId", SqlDbType.Int,4)
            };
            parameters[0].Value = F_EmployeeId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string F_EmployeeIdlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_Hr_EmployeeBase ");
            strSql.Append(" where F_EmployeeId in (" + F_EmployeeIdlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZXDT.CallCenter.Model.T_Hr_EmployeeBase GetModel(int F_EmployeeId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 F_EmployeeId,F_DepartmentId,F_RealName,F_WorkingCode,F_WorkingDate,F_Sex,F_Photo,F_IDCard,F_Birth,F_NativePlace,F_Address,F_Phone,F_LinkPerson,F_LinkPhone,F_CreatedBy,F_CreatedOn,F_ModifiedBy,F_ModifiedOn,F_DeletionStateCode,F_GroupID,F_DepartmentName,F_SchoolInfo,F_Professional,F_GraduationDate,F_Resume,F_Records,F_WorkDeptId,F_Position,F_WorkDate,F_OfficePhone,F_MoveRecords,F_ContractStart,F_ContractEnd,F_ContractNature,F_ContractReminder,F_NowPay,F_Welfare,F_TranPayRecords,F_DimissionDate,F_RetireBill,F_DimissionCause,F_Education from T_Hr_EmployeeBase ");
            strSql.Append(" where F_EmployeeId=@F_EmployeeId");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_EmployeeId", SqlDbType.Int,4)
            };
            parameters[0].Value = F_EmployeeId;

            ZXDT.CallCenter.Model.T_Hr_EmployeeBase model = new ZXDT.CallCenter.Model.T_Hr_EmployeeBase();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZXDT.CallCenter.Model.T_Hr_EmployeeBase DataRowToModel(DataRow row)
        {
            ZXDT.CallCenter.Model.T_Hr_EmployeeBase model = new ZXDT.CallCenter.Model.T_Hr_EmployeeBase();
            if (row != null)
            {
                if (row["F_EmployeeId"] != null && row["F_EmployeeId"].ToString() != "")
                {
                    model.F_EmployeeId = int.Parse(row["F_EmployeeId"].ToString());
                }
                if (row["F_DepartmentId"] != null && row["F_DepartmentId"].ToString() != "")
                {
                    model.F_DepartmentId = int.Parse(row["F_DepartmentId"].ToString());
                }
                if (row["F_RealName"] != null)
                {
                    model.F_RealName = row["F_RealName"].ToString();
                }
                if (row["F_WorkingCode"] != null)
                {
                    model.F_WorkingCode = row["F_WorkingCode"].ToString();
                }
                if (row["F_WorkingDate"] != null && row["F_WorkingDate"].ToString() != "")
                {
                    model.F_WorkingDate = DateTime.Parse(row["F_WorkingDate"].ToString());
                }
                if (row["F_Sex"] != null && row["F_Sex"].ToString() != "")
                {
                    model.F_Sex = int.Parse(row["F_Sex"].ToString());
                }
                if (row["F_Photo"] != null)
                {
                    model.F_Photo = row["F_Photo"].ToString();
                }
                if (row["F_IDCard"] != null)
                {
                    model.F_IDCard = row["F_IDCard"].ToString();
                }
                if (row["F_Birth"] != null && row["F_Birth"].ToString() != "")
                {
                    model.F_Birth = DateTime.Parse(row["F_Birth"].ToString());
                }
                if (row["F_NativePlace"] != null)
                {
                    model.F_NativePlace = row["F_NativePlace"].ToString();
                }
                if (row["F_Address"] != null)
                {
                    model.F_Address = row["F_Address"].ToString();
                }
                if (row["F_Phone"] != null)
                {
                    model.F_Phone = row["F_Phone"].ToString();
                }
                if (row["F_LinkPerson"] != null)
                {
                    model.F_LinkPerson = row["F_LinkPerson"].ToString();
                }
                if (row["F_LinkPhone"] != null)
                {
                    model.F_LinkPhone = row["F_LinkPhone"].ToString();
                }
                if (row["F_CreatedBy"] != null && row["F_CreatedBy"].ToString() != "")
                {
                    model.F_CreatedBy = int.Parse(row["F_CreatedBy"].ToString());
                }
                if (row["F_CreatedOn"] != null && row["F_CreatedOn"].ToString() != "")
                {
                    model.F_CreatedOn = DateTime.Parse(row["F_CreatedOn"].ToString());
                }
                if (row["F_ModifiedBy"] != null && row["F_ModifiedBy"].ToString() != "")
                {
                    model.F_ModifiedBy = int.Parse(row["F_ModifiedBy"].ToString());
                }
                if (row["F_ModifiedOn"] != null && row["F_ModifiedOn"].ToString() != "")
                {
                    model.F_ModifiedOn = DateTime.Parse(row["F_ModifiedOn"].ToString());
                }
                if (row["F_DeletionStateCode"] != null && row["F_DeletionStateCode"].ToString() != "")
                {
                    model.F_DeletionStateCode = int.Parse(row["F_DeletionStateCode"].ToString());
                }
                if (row["F_GroupID"] != null && row["F_GroupID"].ToString() != "")
                {
                    model.F_GroupID = int.Parse(row["F_GroupID"].ToString());
                }
                if (row["F_DepartmentName"] != null)
                {
                    model.F_DepartmentName = row["F_DepartmentName"].ToString();
                }
                if (row["F_SchoolInfo"] != null)
                {
                    model.F_SchoolInfo = row["F_SchoolInfo"].ToString();
                }
                if (row["F_Professional"] != null)
                {
                    model.F_Professional = row["F_Professional"].ToString();
                }
                if (row["F_GraduationDate"] != null && row["F_GraduationDate"].ToString() != "")
                {
                    model.F_GraduationDate = DateTime.Parse(row["F_GraduationDate"].ToString());
                }
                if (row["F_Resume"] != null)
                {
                    model.F_Resume = row["F_Resume"].ToString();
                }
                if (row["F_Records"] != null)
                {
                    model.F_Records = row["F_Records"].ToString();
                }
                if (row["F_WorkDeptId"] != null && row["F_WorkDeptId"].ToString() != "")
                {
                    model.F_WorkDeptId = int.Parse(row["F_WorkDeptId"].ToString());
                }
                if (row["F_Position"] != null)
                {
                    model.F_Position = row["F_Position"].ToString();
                }
                if (row["F_WorkDate"] != null && row["F_WorkDate"].ToString() != "")
                {
                    model.F_WorkDate = DateTime.Parse(row["F_WorkDate"].ToString());
                }
                if (row["F_OfficePhone"] != null)
                {
                    model.F_OfficePhone = row["F_OfficePhone"].ToString();
                }
                if (row["F_MoveRecords"] != null)
                {
                    model.F_MoveRecords = row["F_MoveRecords"].ToString();
                }
                if (row["F_ContractStart"] != null && row["F_ContractStart"].ToString() != "")
                {
                    model.F_ContractStart = DateTime.Parse(row["F_ContractStart"].ToString());
                }
                if (row["F_ContractEnd"] != null && row["F_ContractEnd"].ToString() != "")
                {
                    model.F_ContractEnd = DateTime.Parse(row["F_ContractEnd"].ToString());
                }
                if (row["F_ContractNature"] != null)
                {
                    model.F_ContractNature = row["F_ContractNature"].ToString();
                }
                if (row["F_ContractReminder"] != null && row["F_ContractReminder"].ToString() != "")
                {
                    model.F_ContractReminder = DateTime.Parse(row["F_ContractReminder"].ToString());
                }
                if (row["F_NowPay"] != null && row["F_NowPay"].ToString() != "")
                {
                    model.F_NowPay = decimal.Parse(row["F_NowPay"].ToString());
                }
                if (row["F_Welfare"] != null)
                {
                    model.F_Welfare = row["F_Welfare"].ToString();
                }
                if (row["F_TranPayRecords"] != null)
                {
                    model.F_TranPayRecords = row["F_TranPayRecords"].ToString();
                }
                if (row["F_DimissionDate"] != null && row["F_DimissionDate"].ToString() != "")
                {
                    model.F_DimissionDate = DateTime.Parse(row["F_DimissionDate"].ToString());
                }
                if (row["F_RetireBill"] != null)
                {
                    model.F_RetireBill = row["F_RetireBill"].ToString();
                }
                if (row["F_DimissionCause"] != null)
                {
                    model.F_DimissionCause = row["F_DimissionCause"].ToString();
                }
                if (row["F_Education"] != null && row["F_Education"].ToString() != "")
                {
                    model.F_Education = int.Parse(row["F_Education"].ToString());
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select F_EmployeeId,F_DepartmentId,F_RealName,F_WorkingCode,F_WorkingDate,F_Sex,F_Photo,F_IDCard,F_Birth,F_NativePlace,F_Address,F_Phone,F_LinkPerson,F_LinkPhone,F_CreatedBy,F_CreatedOn,F_ModifiedBy,F_ModifiedOn,F_DeletionStateCode,F_GroupID,F_DepartmentName,F_SchoolInfo,F_Professional,F_GraduationDate,F_Resume,F_Records,F_WorkDeptId,F_Position,F_WorkDate,F_OfficePhone,F_MoveRecords,F_ContractStart,F_ContractEnd,F_ContractNature,F_ContractReminder,F_NowPay,F_Welfare,F_TranPayRecords,F_DimissionDate,F_RetireBill,F_DimissionCause,F_Education ");
            strSql.Append(" FROM T_Hr_EmployeeBase ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" F_EmployeeId,F_DepartmentId,F_RealName,F_WorkingCode,F_WorkingDate,F_Sex,F_Photo,F_IDCard,F_Birth,F_NativePlace,F_Address,F_Phone,F_LinkPerson,F_LinkPhone,F_CreatedBy,F_CreatedOn,F_ModifiedBy,F_ModifiedOn,F_DeletionStateCode,F_GroupID,F_DepartmentName,F_SchoolInfo,F_Professional,F_GraduationDate,F_Resume,F_Records,F_WorkDeptId,F_Position,F_WorkDate,F_OfficePhone,F_MoveRecords,F_ContractStart,F_ContractEnd,F_ContractNature,F_ContractReminder,F_NowPay,F_Welfare,F_TranPayRecords,F_DimissionDate,F_RetireBill,F_DimissionCause,F_Education ");
            strSql.Append(" FROM T_Hr_EmployeeBase ");
            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_Hr_EmployeeBase ");
            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_EmployeeId desc");
            }
            strSql.Append(")AS Row, T.*  from T_Hr_EmployeeBase 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_Hr_EmployeeBase";
			parameters[1].Value = "F_EmployeeId";
			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  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}