public void MakeActive(IStateNews news, IUsers user) { var objdbhelper = new DBHelper(); try { StateNewsDB.Instance.MakeActive(ref objdbhelper, news, user); } catch (Exception objExp) { throw objExp; } finally { objdbhelper.Dispose(); } }
// need to write internal IEnumerable<IStateNews> SelectForPartialNewsList(string StateCode, Int64 NextPageValue) { IDataReader objDataReader = null; List<IStateNews> objNewsList = null; IStateNews objNews = null; DBHelper dbHelper = new DBHelper(); try { dbHelper.AddInParameter("@StateCode", StateCode, DbType.String); dbHelper.AddInParameter("@NextPageValue", NextPageValue, DbType.Int64); objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectPartialStateNewsListApi, CommandType.StoredProcedure); if (objDataReader != null) { objNewsList = new List<IStateNews>(); do { while (objDataReader.Read()) { objNews = new StateNews(); if (!objDataReader.IsDBNull(0)) objNews.NewsID = objDataReader.GetString(0); if (!objDataReader.IsDBNull(1)) objNews.EditorID = objDataReader.GetString(1); if (!objDataReader.IsDBNull(2)) objNews.DisplayOrder = objDataReader.GetInt32(2); if (!objDataReader.IsDBNull(3)) objNews.Heading = objDataReader.GetString(3); if (!objDataReader.IsDBNull(4)) objNews.ShortDescription = objDataReader.GetString(4); if (!objDataReader.IsDBNull(5)) objNews.NewsDescription = objDataReader.GetString(5); if (!objDataReader.IsDBNull(6)) objNews.LanguageID = objDataReader.GetInt32(6); if (!objDataReader.IsDBNull(7)) objNews.StateCode = objDataReader.GetString(7); if (!objDataReader.IsDBNull(8)) objNews.IsApproved = objDataReader.GetInt32(8); if (!objDataReader.IsDBNull(9)) objNews.IsActive = objDataReader.GetInt32(9); if (!objDataReader.IsDBNull(10)) objNews.IsTopNews = objDataReader.GetInt32(10); if (!objDataReader.IsDBNull(11)) objNews.DttmCreated = objDataReader.GetDateTime(11); if (!objDataReader.IsDBNull(12)) objNews.DttmModified = objDataReader.GetDateTime(12); if (!objDataReader.IsDBNull(13)) objNews.ImageUrl = objDataReader.GetString(13); if (!objDataReader.IsDBNull(14)) objNews.ImageCaption = objDataReader.GetString(14); if (!objDataReader.IsDBNull(15)) objNews.ImageCaptionLink = objDataReader.GetString(15); objNewsList.Add(objNews); } } while (objDataReader.NextResult()); } if (!objDataReader.IsClosed) objDataReader.Close(); } catch (Exception objExp) { throw objExp; } finally { dbHelper.ClearAllParameters(); dbHelper.CloseConnection(); dbHelper.Dispose(); } return objNewsList; }
public void Insert(ref DBHelper objdbhelper, IStateNews objNews, IImageDetail objImageDetail, IUsers user) { var objNewsDB = StateNewsDB.Instance; try { objNews.EditorID = "1"; objNews.DisplayOrder = 1; objNews.IsActive = 0; objNews.IsApproved = 0; objNews.LanguageID = 1; //objNews.StateCode = "BR"; objImageDetail.IsActive = 0; objImageDetail.IsFirst = 1; StateNewsDB.Instance.Insert(ref objdbhelper, objNews, objImageDetail, user); } catch (Exception objExp) { throw objExp; } finally { objdbhelper.Dispose(); objNewsDB.Dispose(); } }
public List<ITopNews> SelectTopNewsForActivate() { IDataReader objDataReader = null; List<ITopNews> objTopNewsList = null; ITopNews objTopNews = null; DBHelper dbHelper = new DBHelper(); try { objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectAllTopNews, CommandType.StoredProcedure); if (objDataReader != null) { objTopNewsList = new List<ITopNews>(); do { while (objDataReader.Read()) { objTopNews = new TopNews(); if (!objDataReader.IsDBNull(0)) objTopNews.TopNewsID = objDataReader.GetString(0); if (!objDataReader.IsDBNull(1)) objTopNews.EditorID = objDataReader.GetString(1); if (!objDataReader.IsDBNull(2)) objTopNews.DisplayOrder = objDataReader.GetInt32(2); if (!objDataReader.IsDBNull(3)) objTopNews.Heading = objDataReader.GetString(3); if (!objDataReader.IsDBNull(4)) objTopNews.ShortDescription = objDataReader.GetString(4); if (!objDataReader.IsDBNull(5)) objTopNews.NewsDescription = objDataReader.GetString(5); if (!objDataReader.IsDBNull(6)) objTopNews.LanguageID = objDataReader.GetInt32(6); if (!objDataReader.IsDBNull(7)) objTopNews.IsApproved = objDataReader.GetInt32(7); if (!objDataReader.IsDBNull(8)) objTopNews.IsActive = objDataReader.GetInt32(8); if (!objDataReader.IsDBNull(9)) objTopNews.DttmCreated = objDataReader.GetDateTime(9); if (!objDataReader.IsDBNull(10)) objTopNews.DttmModified = objDataReader.GetDateTime(10); if (!objDataReader.IsDBNull(11)) objTopNews.ImageUrl = objDataReader.GetString(11); if (!objDataReader.IsDBNull(12)) objTopNews.ImageCaption = objDataReader.GetString(12); objTopNewsList.Add(objTopNews); } } while (objDataReader.NextResult()); } if (!objDataReader.IsClosed) objDataReader.Close(); } catch (Exception objExp) { throw objExp; } finally { dbHelper.ClearAllParameters(); dbHelper.CloseConnection(); dbHelper.Dispose(); } return objTopNewsList; }