public IList<University> GetUniveristyByProId(int ProId) { IList<Core.Business.University> universitylist = new List<Core.Business.University>(); SqlServerUtility sql = new SqlServerUtility(SqlConnectionString); sql.AddParameter("@ProvinceId", SqlDbType.Int, ProId); SqlDataReader reader = sql.ExecuteSPReader("USP_University_Select_By_ProId"); if (reader != null) { while (reader.Read()) { Core.Business.University university = new Core.Business.University(); if (!reader.IsDBNull(0)) university.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) university.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) university.DateCreated = reader.GetDateTime(2); if (!reader.IsDBNull(3)) university.Name = reader.GetString(3); if (!reader.IsDBNull(4)) university.LibServicesAddress = reader.GetString(4); university.MarkOld(); universitylist.Add(university); } reader.Close(); } return universitylist; }
// �����û�Id��ȡѧУ��Ϣ ��̨���� public University GetUniversityByAccountId(long AccountId) { SqlServerUtility sql = new SqlServerUtility(SqlConnectionString); sql.AddParameter("@AccountId", SqlDbType.BigInt, AccountId); SqlDataReader reader = sql.ExecuteSPReader("USP_University_Select_By_AccountId"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.University university = new Core.Business.University(); if (!reader.IsDBNull(0)) university.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) university.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) university.DateCreated = reader.GetDateTime(2); if (!reader.IsDBNull(3)) university.Name = reader.GetString(3); if (!reader.IsDBNull(4)) university.LibServicesAddress = reader.GetString(4); reader.Close(); return university; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
/// <summary> /// /// </summary> /// <param name="pagingInfo"></param> /// <param name="proId"></param> /// <param name="name"></param> /// <returns></returns> public IList<Core.Business.University> GetUniversityByProIdAndName(CY.UME.Core.PagingInfo pagingInfo, int proId, string name) { IList<Core.Business.University> universitylist = new List<Core.Business.University>(); SqlServerUtility sql = new SqlServerUtility(SqlConnectionString); sql.AddParameter("@PageNumber", SqlDbType.Int, pagingInfo.CurrentPage); sql.AddParameter("@PageSize", SqlDbType.Int, pagingInfo.PageSize); sql.AddParameter("@Tables", SqlDbType.NVarChar, "University"); sql.AddParameter("@PK", SqlDbType.NVarChar, "ID"); sql.AddParameter("@Sort", SqlDbType.NVarChar, "Id DESC"); sql.AddParameter("@Fields", SqlDbType.NVarChar, "[ID], [ProvinceId],[DateCreated],[Name],[LibServicesAddress]"); string where = "1 = 1"; if (proId != 0)//ʡ�ݲ�Ϊ�� where += " AND ProvinceId = " + proId; if (name.Length != 0)//���Ʋ�Ϊ�� where += " AND [Name] like '%" + name + "%' "; sql.AddParameter("@Filter", SqlDbType.NVarChar, where); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.University university = new Core.Business.University(); if (!reader.IsDBNull(0)) university.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) university.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) university.DateCreated = reader.GetDateTime(2); if (!reader.IsDBNull(3)) university.Name = reader.GetString(3); if (!reader.IsDBNull(4)) university.LibServicesAddress = reader.GetString(4); university.MarkOld(); universitylist.Add(university); } reader.Close(); } return universitylist; }