/// <summary> /// 返回满足查询条件的人员基本信息实体列表 /// </summary> /// <param name="param">查询条件</param> /// <returns>人员基本信息实体列表</returns> public IList <Sys_Person> GetSys_Persons(QueryParameter param) { string sql = @"SELECT KeyId, PersonCode, WorkNo, PersonName, DomainAcc, PassWord, SexId, Birthday, IDCard, Photo, Nation, NativePlace, PoliticalId, JoinDate, EducationId, GraduateFrom, Perfessional, Ability, IsFulltime, WorkType, WorkStartDate, JobLevel, JobSure, DutyId, DutySure, Contact, Officephone, Homephone, Mobilephone, HomeAddress, PostCode, EMail, Certificate, Status, DisplayOrder, Remark, HelperCode, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn FROM dbo.Sys_Person"; if (param != null) { sql = QueryParameter.CompleteSqlString(sql, param); } Database db = DatabaseFactory.CreateDatabase(DBLink.SysDBLink.ToString()); DbCommand command = db.GetSqlStringCommand(sql); if (param != null) { //设置参数 foreach (IExpression exp in param.WhereExpressions) { if (exp is SimpleExpression) { SimpleExpression simple = exp as SimpleExpression; db.AddInParameter(command, simple.ExpName, simple.DbType, simple.Value); } } } IList <Sys_Person> list = new List <Sys_Person>(); using (IDataReader dr = db.ExecuteReader(command)) { while (dr.Read()) { Sys_Person sys_Person = new Sys_Person(); sys_Person.KeyId = (int)dr["KeyId"]; sys_Person.PersonCode = (string)dr["PersonCode"]; sys_Person.WorkNo = dr["WorkNo"] == DBNull.Value ? null : (string)dr["WorkNo"]; sys_Person.PersonName = (string)dr["PersonName"]; sys_Person.DomainAcc = (string)dr["DomainAcc"]; sys_Person.PassWord = (string)dr["PassWord"]; sys_Person.SexId = (int)dr["SexId"]; sys_Person.Birthday = dr["Birthday"] == DBNull.Value ? null : (DateTime?)dr["Birthday"]; sys_Person.IDCard = dr["IDCard"] == DBNull.Value ? null : (string)dr["IDCard"]; sys_Person.Photo = dr["Photo"] == DBNull.Value ? null : (byte[])dr["Photo"]; sys_Person.Nation = dr["Nation"] == DBNull.Value ? null : (string)dr["Nation"]; sys_Person.NativePlace = dr["NativePlace"] == DBNull.Value ? null : (string)dr["NativePlace"]; sys_Person.PoliticalId = dr["PoliticalId"] == DBNull.Value ? null : (int?)dr["PoliticalId"]; sys_Person.JoinDate = dr["JoinDate"] == DBNull.Value ? null : (DateTime?)dr["JoinDate"]; sys_Person.EducationId = dr["EducationId"] == DBNull.Value ? null : (int?)dr["EducationId"]; sys_Person.GraduateFrom = dr["GraduateFrom"] == DBNull.Value ? null : (string)dr["GraduateFrom"]; sys_Person.Perfessional = dr["Perfessional"] == DBNull.Value ? null : (string)dr["Perfessional"]; sys_Person.Ability = dr["Ability"] == DBNull.Value ? null : (string)dr["Ability"]; sys_Person.IsFulltime = dr["IsFulltime"] == DBNull.Value ? null : (bool?)dr["IsFulltime"]; sys_Person.WorkType = dr["WorkType"] == DBNull.Value ? null : (int?)dr["WorkType"]; sys_Person.WorkStartDate = dr["WorkStartDate"] == DBNull.Value ? null : (DateTime?)dr["WorkStartDate"]; sys_Person.JobLevel = dr["JobLevel"] == DBNull.Value ? null : (int?)dr["JobLevel"]; sys_Person.JobSure = dr["JobSure"] == DBNull.Value ? null : (DateTime?)dr["JobSure"]; sys_Person.DutyId = dr["DutyId"] == DBNull.Value ? null : (int?)dr["DutyId"]; sys_Person.DutySure = dr["DutySure"] == DBNull.Value ? null : (DateTime?)dr["DutySure"]; sys_Person.Contact = dr["Contact"] == DBNull.Value ? null : (string)dr["Contact"]; sys_Person.Officephone = dr["Officephone"] == DBNull.Value ? null : (string)dr["Officephone"]; sys_Person.Homephone = dr["Homephone"] == DBNull.Value ? null : (string)dr["Homephone"]; sys_Person.Mobilephone = dr["Mobilephone"] == DBNull.Value ? null : (string)dr["Mobilephone"]; sys_Person.HomeAddress = dr["HomeAddress"] == DBNull.Value ? null : (string)dr["HomeAddress"]; sys_Person.PostCode = dr["PostCode"] == DBNull.Value ? null : (string)dr["PostCode"]; sys_Person.EMail = dr["EMail"] == DBNull.Value ? null : (string)dr["EMail"]; sys_Person.Certificate = dr["Certificate"] == DBNull.Value ? null : (string)dr["Certificate"]; sys_Person.Status = (bool)dr["Status"]; sys_Person.DisplayOrder = dr["DisplayOrder"] == DBNull.Value ? null : (int?)dr["DisplayOrder"]; sys_Person.Remark = dr["Remark"] == DBNull.Value ? null : (string)dr["Remark"]; sys_Person.HelperCode = dr["HelperCode"] == DBNull.Value ? null : (string)dr["HelperCode"]; sys_Person.CreatedBy = (int)dr["CreatedBy"]; sys_Person.CreatedOn = (DateTime)dr["CreatedOn"]; sys_Person.ModifiedBy = dr["ModifiedBy"] == DBNull.Value ? null : (int?)dr["ModifiedBy"]; sys_Person.ModifiedOn = dr["ModifiedOn"] == DBNull.Value ? null : (DateTime?)dr["ModifiedOn"]; list.Add(sys_Person); } } return(list); }