public static CustomList <LatestNews> GetAllLatestNewsForDisplay() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <LatestNews> LatestNewsCollection = new CustomList <LatestNews>(); IDataReader reader = null; String sql = "Exec GetLatestNews"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { LatestNews newLatestNews = new LatestNews(); newLatestNews.NewsDetails = reader.GetString("NewsDetails"); LatestNewsCollection.Add(newLatestNews); } return(LatestNewsCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <LatestNews> GetAllLatestNews() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <LatestNews> LatestNewsCollection = new CustomList <LatestNews>(); IDataReader reader = null; const String sql = "select *from LatestNews"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { LatestNews newLatestNews = new LatestNews(); newLatestNews.SetData(reader); LatestNewsCollection.Add(newLatestNews); } LatestNewsCollection.InsertSpName = "spInsertLatestNews"; LatestNewsCollection.UpdateSpName = "spUpdateLatestNews"; LatestNewsCollection.DeleteSpName = "spDeleteLatestNews"; return(LatestNewsCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList<LatestNews> GetAllLatestNews() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList<LatestNews> LatestNewsCollection = new CustomList<LatestNews>(); IDataReader reader = null; const String sql = "select *from LatestNews"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { LatestNews newLatestNews = new LatestNews(); newLatestNews.SetData(reader); LatestNewsCollection.Add(newLatestNews); } LatestNewsCollection.InsertSpName = "spInsertLatestNews"; LatestNewsCollection.UpdateSpName = "spUpdateLatestNews"; LatestNewsCollection.DeleteSpName = "spDeleteLatestNews"; return LatestNewsCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public static CustomList<LatestNews> GetAllLatestNewsForDisplay() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList<LatestNews> LatestNewsCollection = new CustomList<LatestNews>(); IDataReader reader = null; String sql = "Exec GetLatestNews"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { LatestNews newLatestNews = new LatestNews(); newLatestNews.NewsDetails = reader.GetString("NewsDetails"); LatestNewsCollection.Add(newLatestNews); } return LatestNewsCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }