public void Insert(ref DBHelper dbInstance, IInterNews objinterNews, IImageDetail objImageDetail, IUsers user) { try { dbInstance.ClearAllParameters(); dbInstance.AddInParameter("@EditorID", objinterNews.EditorID, DbType.String); dbInstance.AddInParameter("@DisplayOrder", objinterNews.DisplayOrder, DbType.Int32); dbInstance.AddInParameter("@Heading", objinterNews.Heading, DbType.String); dbInstance.AddInParameter("@ShortDescription", objinterNews.ShortDescription, DbType.String); dbInstance.AddInParameter("@NewsDescription", objinterNews.NewsDescription, DbType.String); dbInstance.AddInParameter("@LanguageID", objinterNews.LanguageID, DbType.Int32); dbInstance.AddInParameter("@CountryCode", " ", DbType.String); dbInstance.AddInParameter("@IsTopNews", objinterNews.IsTopNews, DbType.Int32); dbInstance.AddInParameter("@ImageUrl", objImageDetail.ImageUrl, DbType.String); dbInstance.AddInParameter("@Caption", objImageDetail.Caption, DbType.String); dbInstance.AddInParameter("@ImageType", objImageDetail.ImageType, DbType.Int32); dbInstance.AddInParameter("@IsFirst", objImageDetail.IsFirst, DbType.Int32); dbInstance.AddInParameter("@UserID", user.UserID, DbType.Int64); dbInstance.ExecuteNonQuery(ProcedureName.InsertInterNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void Update(ref DBHelper dbHelper, IInterNews news, IImageDetail image, IUsers user) { try { dbHelper.ClearAllParameters(); dbHelper.AddInParameter("@NewsID", news.NewsID, DbType.String); dbHelper.AddInParameter("@EditorID", news.EditorID, DbType.String); dbHelper.AddInParameter("@DisplayOrder", news.DisplayOrder, DbType.Int32); dbHelper.AddInParameter("@Heading", news.Heading, DbType.String); dbHelper.AddInParameter("@ShortDescription", news.ShortDescription, DbType.String); dbHelper.AddInParameter("@NewsDescription", news.NewsDescription, DbType.String); dbHelper.AddInParameter("@LanguageID", news.LanguageID, DbType.Int32); dbHelper.AddInParameter("@IsActive", news.IsActive, DbType.Int32); dbHelper.AddInParameter("@IsApproved", news.IsApproved, DbType.Int32); dbHelper.AddInParameter("@IsTopNews", news.IsTopNews, DbType.Int32); dbHelper.AddInParameter("@ImageUrl", image.ImageUrl, DbType.String); dbHelper.AddInParameter("@Caption", image.Caption, DbType.String); dbHelper.AddInParameter("@ImageType", image.ImageType, DbType.Int32); dbHelper.AddInParameter("@IsFirst", image.IsFirst, DbType.Int32); dbHelper.AddInParameter("@IsActieImage", image.IsActive, DbType.Int32); dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64); dbHelper.ExecuteNonQuery(ProcedureName.UpdateIntertNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void UpdateNews(ref DBHelper dbHelper, IInterNews news, IImageDetail image, IUsers user) { try { news.EditorID = news.EditorID == null ? String.Empty : news.EditorID; InterNewsDB.Instance.Update(ref dbHelper, news, image, user); } catch (Exception ex) { throw ex; } }
public void GiveApproval(IInterNews news, IUsers user) { var objdbhelper = new DBHelper(); try { InterNewsDB.Instance.GiveApproval(ref objdbhelper, news, user); } catch (Exception objExp) { throw objExp; } }
public void GiveApproval(ref DBHelper dbHelper, IInterNews objNews, IUsers user) { try { dbHelper.ClearAllParameters(); dbHelper.AddInParameter("@NewsID", objNews.NewsID, DbType.String); dbHelper.AddInParameter("@IsApproved", objNews.IsApproved, DbType.Int32); dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64); dbHelper.ExecuteNonQuery(ProcedureName.MakeApprovedInterNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void MakeActive(ref DBHelper dbHelper, IInterNews objNews, IUsers user) { try { dbHelper.ClearAllParameters(); dbHelper.AddInParameter("@NewsID", objNews.NewsID, DbType.String); dbHelper.AddInParameter("@IsActive", objNews.IsActive, DbType.Int32); dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64); dbHelper.ExecuteNonQuery(ProcedureName.MakeActiveInterNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void Insert(ref DBHelper dbInstance, IInterNews objinterNews, IImageDetail objImageDetail, IUsers user) { try { dbInstance.ClearAllParameters(); dbInstance.AddInParameter("@EditorID", objinterNews.EditorID, DbType.String); dbInstance.AddInParameter("@DisplayOrder", objinterNews.DisplayOrder, DbType.Int32); dbInstance.AddInParameter("@Heading", objinterNews.Heading, DbType.String); dbInstance.AddInParameter("@ShortDescription", objinterNews.ShortDescription, DbType.String); dbInstance.AddInParameter("@NewsDescription", objinterNews.NewsDescription, DbType.String); dbInstance.AddInParameter("@LanguageID", objinterNews.LanguageID, DbType.Int32); dbInstance.AddInParameter("@CountryCode", " ", DbType.String); dbInstance.AddInParameter("@IsTopNews", objinterNews.IsTopNews, DbType.Int32); dbInstance.AddInParameter("@ImageUrl", objImageDetail.ImageUrl, DbType.String); dbInstance.AddInParameter("@Caption", objImageDetail.Caption, DbType.String); dbInstance.AddInParameter("@ImageType", objImageDetail.ImageType, DbType.Int32); dbInstance.AddInParameter("@IsFirst", objImageDetail.IsFirst, DbType.Int32); dbInstance.AddInParameter("@UserID", user.UserID, DbType.Int64); dbInstance.ExecuteNonQuery(ProcedureName.InsertInterNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void Update(ref DBHelper dbHelper, IInterNews news, IImageDetail image, IUsers user) { try { dbHelper.ClearAllParameters(); dbHelper.AddInParameter("@NewsID", news.NewsID, DbType.String); dbHelper.AddInParameter("@EditorID", news.EditorID, DbType.String); dbHelper.AddInParameter("@DisplayOrder", news.DisplayOrder, DbType.Int32); dbHelper.AddInParameter("@Heading", news.Heading, DbType.String); dbHelper.AddInParameter("@ShortDescription", news.ShortDescription, DbType.String); dbHelper.AddInParameter("@NewsDescription", news.NewsDescription, DbType.String); dbHelper.AddInParameter("@LanguageID", news.LanguageID, DbType.Int32); dbHelper.AddInParameter("@IsActive", news.IsActive, DbType.Int32); dbHelper.AddInParameter("@IsApproved", news.IsApproved, DbType.Int32); dbHelper.AddInParameter("@IsTopNews", news.IsTopNews, DbType.Int32); dbHelper.AddInParameter("@ImageUrl", image.ImageUrl, DbType.String); dbHelper.AddInParameter("@Caption", image.Caption, DbType.String); dbHelper.AddInParameter("@ImageType", image.ImageType, DbType.Int32); dbHelper.AddInParameter("@IsFirst", image.IsFirst, DbType.Int32); dbHelper.AddInParameter("@IsActieImage", image.IsActive, DbType.Int32); dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64); dbHelper.ExecuteNonQuery(ProcedureName.UpdateIntertNews, CommandType.StoredProcedure); } catch (Exception objExp) { throw objExp; } }
public void UpdateNews(ref DBHelper dbHelper, IInterNews news, IImageDetail image, IUsers user) { try { news.EditorID = news.EditorID == null ? String.Empty : news.EditorID; InterNewsDB.Instance.Update(ref dbHelper, news, image, user); } catch (Exception ex) { throw ex; } }
public void MakeActive(IInterNews news, IUsers user) { var objdbhelper = new DBHelper(); try { InterNewsDB.Instance.MakeActive(ref objdbhelper, news, user); } catch (Exception objExp) { throw objExp; } }
public void Insert(ref DBHelper objdbhelper, IInterNews objNews, IImageDetail objImageDetail, IUsers user) { try { objNews.EditorID = "1"; objNews.DisplayOrder = 1; objNews.IsActive = 0; objNews.IsApproved = 0; objNews.LanguageID = 1; objImageDetail.IsActive = 0; objImageDetail.IsFirst = 1; InterNewsDB.Instance.Insert(ref objdbhelper, objNews, objImageDetail, user); } catch (Exception objExp) { throw objExp; } }
public List <IInterNews> Search(DateTime dateFrom, DateTime dateTo, string Heading) { IDataReader objDataReader = null; List <IInterNews> objNewsList = null; IInterNews objNews = null; var dbHelper = DBHelper.Instance; try { dbHelper.AddInParameter("@DateFrom", dateFrom.ToString("yyyy-MM-dd")); dbHelper.AddInParameter("@DateTo", dateTo.ToString("yyyy-MM-dd")); dbHelper.AddInParameter("@Heading", "%" + Heading + "%", DbType.String); objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SearchInterNews, CommandType.StoredProcedure); if (objDataReader != null) { objNewsList = new List <IInterNews>(); do { while (objDataReader.Read()) { objNews = new InterNews(); 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.IsApproved = objDataReader.GetInt32(7); } if (!objDataReader.IsDBNull(8)) { objNews.IsActive = objDataReader.GetInt32(8); } if (!objDataReader.IsDBNull(9)) { objNews.IsTopNews = objDataReader.GetInt32(9); } if (!objDataReader.IsDBNull(10)) { objNews.DttmCreated = objDataReader.GetDateTime(10); } if (!objDataReader.IsDBNull(11)) { objNews.DttmModified = objDataReader.GetDateTime(11); } 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); }
internal IEnumerable <IInterNews> Select20TopNews() { IDataReader objDataReader = null; List <IInterNews> objNewsList = null; IInterNews objNews = null; var dbHelper = DBHelper.Instance; try { objDataReader = dbHelper.ExecuteDataReader(ProcedureName.Select20InterNews, CommandType.StoredProcedure); if (objDataReader != null) { objNewsList = new List <IInterNews>(); do { while (objDataReader.Read()) { objNews = new InterNews(); 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.IsApproved = objDataReader.GetInt32(7); } if (!objDataReader.IsDBNull(8)) { objNews.IsActive = objDataReader.GetInt32(8); } if (!objDataReader.IsDBNull(9)) { objNews.IsTopNews = objDataReader.GetInt32(9); } if (!objDataReader.IsDBNull(10)) { objNews.DttmCreated = objDataReader.GetDateTime(10); } if (!objDataReader.IsDBNull(11)) { objNews.DttmModified = objDataReader.GetDateTime(11); } if (!objDataReader.IsDBNull(12)) { objNews.ImageUrl = objDataReader.GetString(12); } if (!objDataReader.IsDBNull(13)) { objNews.ImageCaption = objDataReader.GetString(13); } 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.FindAll(v => v.DttmCreated.Date == DateTime.Now.Date || v.DttmCreated.Date.AddDays(-1) == DateTime.Now.Date.AddDays(-1)));; }
public List <IInterNews> SelectAllForList(Int64?NextPageValue) { IDataReader objDataReader = null; List <IInterNews> objNewsList = null; IInterNews objNews = null; DBHelper dbHelper = new DBHelper(); try { dbHelper.AddInParameter("@NextPageValue", NextPageValue, DbType.Int64); objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectAllInterForList, CommandType.StoredProcedure); if (objDataReader != null) { objNewsList = new List <IInterNews>(); do { while (objDataReader.Read()) { objNews = new InterNews(); 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.IsApproved = objDataReader.GetInt32(7); } if (!objDataReader.IsDBNull(8)) { objNews.IsActive = objDataReader.GetInt32(8); } if (!objDataReader.IsDBNull(9)) { objNews.IsTopNews = objDataReader.GetInt32(9); } if (!objDataReader.IsDBNull(10)) { objNews.DttmCreated = objDataReader.GetDateTime(10); } if (!objDataReader.IsDBNull(11)) { objNews.DttmModified = objDataReader.GetDateTime(11); } if (!objDataReader.IsDBNull(12)) { objNews.ImageUrl = objDataReader.GetString(12); } if (!objDataReader.IsDBNull(13)) { objNews.ImageCaption = objDataReader.GetString(13); } 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 IInterNews Select(string NewsID) { IInterNews objNews = null; IDataReader objDataReader = null; var dbHelper = DBHelper.Instance; try { dbHelper.AddInParameter("@NewsID", NewsID, DbType.String); objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectInterNews, CommandType.StoredProcedure); if (objDataReader != null) { while (objDataReader.Read()) { objNews = new InterNews(); 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.IsApproved = objDataReader.GetInt32(7); } if (!objDataReader.IsDBNull(8)) { objNews.IsActive = objDataReader.GetInt32(8); } if (!objDataReader.IsDBNull(9)) { objNews.IsTopNews = objDataReader.GetInt32(9); } if (!objDataReader.IsDBNull(10)) { objNews.DttmCreated = objDataReader.GetDateTime(10); } if (!objDataReader.IsDBNull(11)) { objNews.DttmModified = objDataReader.GetDateTime(11); } if (!objDataReader.IsDBNull(12)) { objNews.ImageUrl = objDataReader.GetString(12); } if (!objDataReader.IsDBNull(13)) { objNews.ImageCaption = objDataReader.GetString(13); } } } if (!objDataReader.IsClosed) { objDataReader.Close(); } } catch (Exception objExp) { throw objExp; } finally { dbHelper.ClearAllParameters(); dbHelper.CloseConnection(); dbHelper.Dispose(); } return(objNews); }