public Core.Business.StaffInfo Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectStaffInfo); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.StaffInfo staffInfo = new Core.Business.StaffInfo(); if (!reader.IsDBNull(0)) staffInfo.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) staffInfo.Code = reader.GetString(1); if (!reader.IsDBNull(2)) staffInfo.Name = reader.GetString(2); if (!reader.IsDBNull(3)) staffInfo.Gender = reader.GetString(3); if (!reader.IsDBNull(4)) staffInfo.Nation = reader.GetString(4); if (!reader.IsDBNull(5)) staffInfo.Origin = reader.GetString(5); if (!reader.IsDBNull(6)) staffInfo.IdentifyCode = reader.GetString(6); if (!reader.IsDBNull(7)) staffInfo.Birthday = reader.GetDateTime(7); if (!reader.IsDBNull(8)) staffInfo.PoliticalCode = reader.GetString(8); if (!reader.IsDBNull(9)) staffInfo.JoinDate = reader.GetDateTime(9); if (!reader.IsDBNull(10)) staffInfo.EducateLvl = reader.GetString(10); if (!reader.IsDBNull(11)) staffInfo.ScholarLvl = reader.GetString(11); if (!reader.IsDBNull(12)) staffInfo.TitleLvl = reader.GetString(12); if (!reader.IsDBNull(13)) staffInfo.QualityLvl = reader.GetString(13); if (!reader.IsDBNull(14)) staffInfo.TeachSubject = reader.GetString(14); if (!reader.IsDBNull(15)) staffInfo.OriginWork = reader.GetString(15); if (!reader.IsDBNull(16)) staffInfo.GraduteSchool = reader.GetString(16); if (!reader.IsDBNull(17)) staffInfo.ProfessName = reader.GetString(17); if (!reader.IsDBNull(18)) staffInfo.SchoolTypeCode = reader.GetString(18); if (!reader.IsDBNull(19)) staffInfo.Address = reader.GetString(19); if (!reader.IsDBNull(20)) staffInfo.CellPhone = reader.GetString(20); if (!reader.IsDBNull(21)) staffInfo.Phone = reader.GetString(21); if (!reader.IsDBNull(22)) staffInfo.StaffCate = reader.GetString(22); if (!reader.IsDBNull(23)) staffInfo.Photo = reader.GetString(23); if (!reader.IsDBNull(24)) staffInfo.DepartmentCode = reader.GetString(24); if (!reader.IsDBNull(25)) staffInfo.Des = reader.GetString(25); if (!reader.IsDBNull(26)) staffInfo.AttachmentCode = reader.GetString(26); if (!reader.IsDBNull(27)) staffInfo.Positon = reader.GetString(27); if (!reader.IsDBNull(28)) staffInfo.Password = reader.GetString(28); reader.Close(); return staffInfo; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<StaffInfo> Fill(string queryParam) { if (string.IsNullOrEmpty(queryParam)) return GetAllStaffInfo(); IList<Core.Business.StaffInfo> staffInfolist = new List<Core.Business.StaffInfo>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllStaffInfo + queryParam); if (reader != null) { while (reader.Read()) { Core.Business.StaffInfo staffInfo = new Core.Business.StaffInfo(); if (!reader.IsDBNull(0)) staffInfo.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) staffInfo.Code = reader.GetString(1); if (!reader.IsDBNull(2)) staffInfo.Name = reader.GetString(2); if (!reader.IsDBNull(3)) staffInfo.Gender = reader.GetString(3); if (!reader.IsDBNull(4)) staffInfo.Nation = reader.GetString(4); if (!reader.IsDBNull(5)) staffInfo.Origin = reader.GetString(5); if (!reader.IsDBNull(6)) staffInfo.IdentifyCode = reader.GetString(6); if (!reader.IsDBNull(7)) staffInfo.Birthday = reader.GetDateTime(7); if (!reader.IsDBNull(8)) staffInfo.PoliticalCode = reader.GetString(8); if (!reader.IsDBNull(9)) staffInfo.JoinDate = reader.GetDateTime(9); if (!reader.IsDBNull(10)) staffInfo.EducateLvl = reader.GetString(10); if (!reader.IsDBNull(11)) staffInfo.ScholarLvl = reader.GetString(11); if (!reader.IsDBNull(12)) staffInfo.TitleLvl = reader.GetString(12); if (!reader.IsDBNull(13)) staffInfo.QualityLvl = reader.GetString(13); if (!reader.IsDBNull(14)) staffInfo.TeachSubject = reader.GetString(14); if (!reader.IsDBNull(15)) staffInfo.OriginWork = reader.GetString(15); if (!reader.IsDBNull(16)) staffInfo.GraduteSchool = reader.GetString(16); if (!reader.IsDBNull(17)) staffInfo.ProfessName = reader.GetString(17); if (!reader.IsDBNull(18)) staffInfo.SchoolTypeCode = reader.GetString(18); if (!reader.IsDBNull(19)) staffInfo.Address = reader.GetString(19); if (!reader.IsDBNull(20)) staffInfo.CellPhone = reader.GetString(20); if (!reader.IsDBNull(21)) staffInfo.Phone = reader.GetString(21); if (!reader.IsDBNull(22)) staffInfo.StaffCate = reader.GetString(22); if (!reader.IsDBNull(23)) staffInfo.Photo = reader.GetString(23); if (!reader.IsDBNull(24)) staffInfo.DepartmentCode = reader.GetString(24); if (!reader.IsDBNull(25)) staffInfo.Des = reader.GetString(25); if (!reader.IsDBNull(26)) staffInfo.AttachmentCode = reader.GetString(26); if (!reader.IsDBNull(27)) staffInfo.Positon = reader.GetString(27); if (!reader.IsDBNull(28)) staffInfo.Password = reader.GetString(28); staffInfo.MarkOld(); staffInfolist.Add(staffInfo); } reader.Close(); } return staffInfolist; }
public IList<StaffInfo> Search(string sname, string scate) { IList<Core.Business.StaffInfo> staffInfolist = new List<Core.Business.StaffInfo>(); SqlServerUtility sql = new SqlServerUtility(); string sqlstr = String.Empty; if (sname == string.Empty || sname == "" || (String.IsNullOrEmpty(sname))) { if (scate == "allcate") { return StaffInfo.GetAllStaffInfo(); } else { sqlstr = SqlSearchStaffInfoByType; sql.AddParameter("@StaffCate", SqlDbType.NVarChar, scate); } } else { sql.AddParameter("@Name", SqlDbType.NVarChar, sname); if (scate == "allcate") { sqlstr = SqlSearchStaffInfoByName; } else { sqlstr = SqlSearchStaffInfoByNameAndType; sql.AddParameter("@StaffCate", SqlDbType.NVarChar, scate); } } SqlDataReader reader = sql.ExecuteSqlReader(sqlstr); if (reader != null) { while (!reader.IsClosed && reader.Read()) { Core.Business.StaffInfo staffInfo = new Core.Business.StaffInfo(); if (!reader.IsDBNull(0)) staffInfo.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) staffInfo.Code = reader.GetString(1); if (!reader.IsDBNull(2)) staffInfo.Name = reader.GetString(2); if (!reader.IsDBNull(3)) staffInfo.Gender = reader.GetString(3); if (!reader.IsDBNull(4)) staffInfo.Nation = reader.GetString(4); if (!reader.IsDBNull(5)) staffInfo.Origin = reader.GetString(5); if (!reader.IsDBNull(6)) staffInfo.IdentifyCode = reader.GetString(6); if (!reader.IsDBNull(7)) staffInfo.Birthday = reader.GetDateTime(7); if (!reader.IsDBNull(8)) staffInfo.PoliticalCode = reader.GetString(8); if (!reader.IsDBNull(9)) staffInfo.JoinDate = reader.GetDateTime(9); if (!reader.IsDBNull(10)) staffInfo.EducateLvl = reader.GetString(10); if (!reader.IsDBNull(11)) staffInfo.ScholarLvl = reader.GetString(11); if (!reader.IsDBNull(12)) staffInfo.TitleLvl = reader.GetString(12); if (!reader.IsDBNull(13)) staffInfo.QualityLvl = reader.GetString(13); if (!reader.IsDBNull(14)) staffInfo.TeachSubject = reader.GetString(14); if (!reader.IsDBNull(15)) staffInfo.OriginWork = reader.GetString(15); if (!reader.IsDBNull(16)) staffInfo.GraduteSchool = reader.GetString(16); if (!reader.IsDBNull(17)) staffInfo.ProfessName = reader.GetString(17); if (!reader.IsDBNull(18)) staffInfo.SchoolTypeCode = reader.GetString(18); if (!reader.IsDBNull(19)) staffInfo.Address = reader.GetString(19); if (!reader.IsDBNull(20)) staffInfo.CellPhone = reader.GetString(20); if (!reader.IsDBNull(21)) staffInfo.Phone = reader.GetString(21); if (!reader.IsDBNull(22)) staffInfo.StaffCate = reader.GetString(22); if (!reader.IsDBNull(23)) staffInfo.Photo = reader.GetString(23); if (!reader.IsDBNull(24)) staffInfo.DepartmentCode = reader.GetString(24); if (!reader.IsDBNull(25)) staffInfo.Des = reader.GetString(25); if (!reader.IsDBNull(26)) staffInfo.AttachmentCode = reader.GetString(26); if (!reader.IsDBNull(27)) staffInfo.Positon = reader.GetString(27); if (!reader.IsDBNull(28)) staffInfo.Password = reader.GetString(28); staffInfo.MarkOld(); staffInfolist.Add(staffInfo); } reader.Close(); } return staffInfolist; //else //{ // if (reader != null && !reader.IsClosed) // reader.Close(); // return null; //} }
public IList<Core.Business.StaffInfo> GetAllStaffInfo() { IList<Core.Business.StaffInfo> staffInfolist = new List<Core.Business.StaffInfo>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllStaffInfo); if (reader != null) { while (reader.Read()) { Core.Business.StaffInfo staffInfo = new Core.Business.StaffInfo(); if (!reader.IsDBNull(0)) staffInfo.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) staffInfo.Code = reader.GetString(1); if (!reader.IsDBNull(2)) staffInfo.Name = reader.GetString(2); if (!reader.IsDBNull(3)) staffInfo.Gender = reader.GetString(3); if (!reader.IsDBNull(4)) staffInfo.Nation = reader.GetString(4); if (!reader.IsDBNull(5)) staffInfo.Origin = reader.GetString(5); if (!reader.IsDBNull(6)) staffInfo.IdentifyCode = reader.GetString(6); if (!reader.IsDBNull(7)) staffInfo.Birthday = reader.GetDateTime(7); if (!reader.IsDBNull(8)) staffInfo.PoliticalCode = reader.GetString(8); if (!reader.IsDBNull(9)) staffInfo.JoinDate = reader.GetDateTime(9); if (!reader.IsDBNull(10)) staffInfo.EducateLvl = reader.GetString(10); if (!reader.IsDBNull(11)) staffInfo.ScholarLvl = reader.GetString(11); if (!reader.IsDBNull(12)) staffInfo.TitleLvl = reader.GetString(12); if (!reader.IsDBNull(13)) staffInfo.QualityLvl = reader.GetString(13); if (!reader.IsDBNull(14)) staffInfo.TeachSubject = reader.GetString(14); if (!reader.IsDBNull(15)) staffInfo.OriginWork = reader.GetString(15); if (!reader.IsDBNull(16)) staffInfo.GraduteSchool = reader.GetString(16); if (!reader.IsDBNull(17)) staffInfo.ProfessName = reader.GetString(17); if (!reader.IsDBNull(18)) staffInfo.SchoolTypeCode = reader.GetString(18); if (!reader.IsDBNull(19)) staffInfo.Address = reader.GetString(19); if (!reader.IsDBNull(20)) staffInfo.CellPhone = reader.GetString(20); if (!reader.IsDBNull(21)) staffInfo.Phone = reader.GetString(21); if (!reader.IsDBNull(22)) staffInfo.StaffCate = reader.GetString(22); if (!reader.IsDBNull(23)) staffInfo.Photo = reader.GetString(23); if (!reader.IsDBNull(24)) staffInfo.DepartmentCode = reader.GetString(24); if (!reader.IsDBNull(25)) staffInfo.Des = reader.GetString(25); if (!reader.IsDBNull(26)) staffInfo.AttachmentCode = reader.GetString(26); if (!reader.IsDBNull(27)) staffInfo.Positon = reader.GetString(27); if (!reader.IsDBNull(28)) staffInfo.Password = reader.GetString(28); staffInfo.MarkOld(); staffInfolist.Add(staffInfo); } reader.Close(); } //else //{ // for (int I = 0; I < 2; ++I) // { // Core.Business.StaffInfo staffInfo = new Core.Business.StaffInfo(); // int sid = I; // staffInfo.Id = sid; // staffInfo.Code = "No." + I.ToString(); // staffInfo.Name = "Test"; // staffInfo.Gender = "Test"; // staffInfo.Nation = "Test"; // staffInfo.Origin = "Test"; // staffInfo.IdentifyCode = "Test"; // staffInfo.Birthday = DateTime.Today; // staffInfo.PoliticalCode = "Test"; // staffInfo.JoinDate = DateTime.Today; // staffInfo.EducateLvl = "Test"; // staffInfo.ScholarLvl = "Test"; // staffInfo.TitleLvl = "Test"; // staffInfo.QualityLvl = "Test"; // staffInfo.TeachSubject = "Test"; // staffInfo.OriginWork = "Test"; // staffInfo.GraduteSchool = "Test"; // staffInfo.ProfessName = "Test"; // staffInfo.SchoolTypeCode = "Test"; // staffInfo.Address = "Test"; // staffInfo.CellPhone = "Test"; // staffInfo.Phone = "Test"; // staffInfo.StaffCate = "Test"; // staffInfo.Photo = "Test"; // staffInfo.DepartmentCode = "Test"; // staffInfo.Des = "Test"; // staffInfo.AttachmentCode = "Test"; // staffInfo.Positon = "Test"; // staffInfo.MarkOld(); // staffInfolist.Add(staffInfo); // } //} return staffInfolist; }