public ResultModel CreateNews(NewsCreateRequestModel param) { ResultModel result = new ResultModel(); try { NewsBL bl = new NewsBL(); bl.CreateNews(1, param); result.Status = true; result.Message = "News created"; } catch (OrgException oex) { result.Status = false; result.Message = oex.Message; } catch (Exception ex) { result.Status = false; result.Message = AppConfigs.InternalErrorMessage; if (AppConfigs.DebugInternalMessage) { result.InternalMessage = ex.Message; } } return(result); }
public ActionResult DelNewsArticles(decimal pIDArticles) { try { decimal preturn = 0; if (SessionData.CurrentUser == null) { return(Redirect("/")); } var objNewsBL = new NewsBL(); ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); string language = AppsCommon.GetCurrentLang(); NewsInfo pNewsInfo = new NewsInfo(); var ModifiedBy = SessionData.CurrentUser.Username; var ModifiedDate = SessionData.CurrentUser.CurrentDate; pNewsInfo.Id = pIDArticles; pNewsInfo.Languagecode = language; pNewsInfo.Modifiedby = ModifiedBy; pNewsInfo.Modifieddate = ModifiedDate; preturn = objNewsBL.ArticlesDeleted(pNewsInfo); return(Json(new { status = preturn })); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult GetNewsHomePage() { try { decimal pStatus = Status.XuatBan; decimal _total_record = 0; NewsBL objBL = new NewsBL(); //string _status = "ALL"; string language = AppsCommon.GetCurrentLang(); string _category = "ALL"; string _title = "ALL"; //string _username = SessionData.CurrentUser == null ? "" : SessionData.CurrentUser.Username; string _username = ""; string _keySearch = pStatus.ToString() + "|ALL|" + language + "|" + _category + "|" + _title + "|" + _username; List <NewsInfo> _lst = objBL.ArticleHomeSearch(_keySearch, ref _total_record, "1", "10"); string htmlPaging = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <NewsInfo>((int)_total_record, 1, "Tin"); ViewBag.listArticles = _lst; ViewBag.Paging = htmlPaging; ViewBag.SumRecord = _total_record; return(View("~/Areas/Articles/Views/ArticlesNews/_HomeArticles.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public FileResult Image(Models.News.NewsRequesetModel param) { try { if (param == null || !param.Id.HasValue) { throw new OrgException("Invalid News Id"); } NewsBL bl = new NewsBL(); var image = bl.GetImageNewsContentById(param.Id.Value); return(this.CreateImageFileResult(image)); } catch (OrgException oex) { throw new HttpException((int)System.Net.HttpStatusCode.NotFound, oex.Message); } catch (Exception ex) { if (AppConfigs.DebugInternalMessage) { throw new HttpException((int)System.Net.HttpStatusCode.InternalServerError, ex.Message); } else { throw new HttpException((int)System.Net.HttpStatusCode.NotFound, AppConfigs.InternalErrorMessage); } } }
public ActionResult GetNextPage(string pCategory, int pPage) { try { ViewBag.Status = Status.XuatBan; int from = (pPage - 1) * (Common.Common.RecordOnpage); int to = (pPage) * (Common.Common.RecordOnpage); decimal _total_record = 0; NewsBL objBL = new NewsBL(); string language = AppsCommon.GetCurrentLang(); string _title = "ALL"; string _keySearch = Status.XuatBan.ToString() + "|ALL|" + language + "|" + pCategory + "|" + _title + "|" + SessionData.CurrentUser.Username; List <NewsInfo> _lst = objBL.ArticleHomeSearch(_keySearch, ref _total_record, from.ToString(), to.ToString()); string htmlPaging = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <NewsInfo>((int)_total_record, pPage, "Tin"); ViewBag.listArticles = _lst; ViewBag.Paging = htmlPaging; ViewBag.SumRecord = _total_record; //ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); return(View("~/Areas/Articles/Views/ArticlesNews/_HomePartialViewNews.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult SearchArticles(string pCategory, string pTitile, int pPage, string pStatus) { try { ViewBag.Status = pStatus; //Nếu bài chờ xử lý thì lấy danh sách các bài đã gửi //if (pStatus == Status.ChoXuly.ToString()) //{ // pStatus = Status.VietBai.ToString(); //} int from = (pPage - 1) * (Common.Common.RecordOnpage); int to = (pPage) * (Common.Common.RecordOnpage); decimal _total_record = 0; NewsBL objBL = new NewsBL(); string language = AppsCommon.GetCurrentLang(); string _keySearch = pStatus.ToString() + "|ALL|" + language + "|" + pCategory + "|" + (pTitile == "" ? "ALL" : pTitile) + "|" + SessionData.CurrentUser.Username; List <NewsInfo> _lst = objBL.ArticleHomeSearch(_keySearch, ref _total_record, from.ToString(), to.ToString()); string htmlPaging = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <NewsInfo>((int)_total_record, pPage, "Tin"); ViewBag.listArticles = _lst; ViewBag.Paging = htmlPaging; ViewBag.SumRecord = _total_record; ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); return(View("~/Areas/Articles/Views/ArticlesNews/_PartialViewTable.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult ExecuteNewsArticles(NewsInfo pNewsInfo) { try { if (SessionData.CurrentUser == null) { return(Redirect("/")); } decimal preturn = 0; if (pNewsInfo == null) { return(Json(new { status = -99 })); } string language = AppsCommon.GetCurrentLang(); var ModifiedBy = SessionData.CurrentUser == null ? "" : SessionData.CurrentUser.Username; var ModifiedDate = CommonFuc.CurrentDate(); if (pNewsInfo.pfileLogo != null) { pNewsInfo.Imageheader = AppLoadHelpers.PushFileToServer(pNewsInfo.pfileLogo, AppUpload.Logo); } pNewsInfo.Languagecode = language; pNewsInfo.Modifiedby = ModifiedBy; pNewsInfo.Modifieddate = ModifiedDate; var objNewsBL = new NewsBL(); preturn = objNewsBL.ArticlesUpdate(pNewsInfo); return(Json(new { status = preturn })); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public NewsCommentResultModel GetCommentByNewsId(NewsCommentByCriteriaRequestModel param) { NewsCommentResultModel result = new NewsCommentResultModel(); try { NewsBL bl = new NewsBL(); var comments = bl.GetCommentsByNewsId(param); result.Status = true; result.Message = "Got " + comments.Count.ToString() + " comments"; result.Comments = comments; } catch (OrgException oex) { result.Status = false; result.Message = oex.Message; } catch (Exception ex) { result.Status = false; result.Message = AppConfigs.InternalErrorMessage; if (AppConfigs.DebugInternalMessage) { result.InternalMessage = ex.Message; } } return(result); }
public ActionResult DetailNewsArticles() { try { if (SessionData.CurrentUser == null) { return(Redirect("/")); } decimal pIDArticles = 0; int Status = 0; if (RouteData.Values.ContainsKey("id")) { pIDArticles = CommonFuc.ConvertToDecimal(RouteData.Values["id"]); } if (RouteData.Values.ContainsKey("id2")) { Status = CommonFuc.ConvertToInt(RouteData.Values["id2"]); } ViewBag.Status = Status; var objNewsBL = new NewsBL(); ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); string language = AppsCommon.GetCurrentLang(); var objNewInfo = objNewsBL.ArticlesGetById(pIDArticles, language); return(View("~/Areas/Articles/Views/ArticlesNews/_PartialviewView.cshtml", objNewInfo)); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult FindUpdateNews(string keysSearch, string _sortype, int _reconpage, int p_CurrentPage) { decimal _total_record = 0; string p_to = ""; string p_from = CommonFuc.Get_From_To_Page(p_CurrentPage, ref p_to, _reconpage); _sortype = " ORDER BY " + _sortype; if (string.IsNullOrEmpty(_sortype) || _sortype.Trim() == "ORDER BY") { _sortype = "ALL"; } string htmlPaging = ""; try { NewsBL _obj_bl = new NewsBL(); // keysSearch = "7|" + "1|" + SessionData.CurrentUser.Language; keysSearch = "7|" + "ALL|" + SessionData.CurrentUser.Language + "|TIN_TUC"; List <NewsInfo> _lst = _obj_bl.ArticleHomeSearch(keysSearch, ref _total_record, p_from, p_to, _sortype); htmlPaging = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <B_Remind_Info>((int)_total_record, p_CurrentPage, "Tin", _reconpage, "UpdatenewsjsPaging"); ViewBag.Paging = htmlPaging; ViewBag.Obj = _lst; ViewBag.SumRecord = _total_record; return(PartialView("~/Areas/Home/Views/Shared/_UpdatenewsData.cshtml")); } catch (Exception ex) { Logger.LogException(ex); } return(null); }
public ReturnListModel <News> Get(SearchModel searchModel) { //ReturnListModel<News> returnList = new ReturnListModel<News>(); NewsBL newBL = new NewsBL(); //returnList.Items = newBL.GetAll(searchModel); //returnList.Total = returnList.Items == null ? 0 : returnList.Items.Count(); return(new ReturnListModel <News>(newBL.GetAll(searchModel))); }
public void BroadcastNews(News news, bool isNew) { string message = news.Minute + "' " + news.Message; Clients.All.displayText(message); if (isNew) { var instanceBL = new NewsBL(); instanceBL.RegisterNews(news); } }
public ActionResult Approve_Reject(string p_case_code, decimal p_status, string p_note) { decimal _result = 0; var _NewsBL = new NewsBL(); try { _result = _NewsBL.Update_Status(p_case_code, p_status, p_note, SessionData.CurrentUser.Username); } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { result = _result })); }
public ActionResult EditNewsArticles() { try { if (SessionData.CurrentUser == null) { return(Redirect("/")); } decimal pIDArticles = 0; int Status = 0; if (RouteData.Values.ContainsKey("id")) { pIDArticles = CommonFuc.ConvertToDecimal(RouteData.Values["id"]); } if (RouteData.Values.ContainsKey("id2")) { Status = CommonFuc.ConvertToInt(RouteData.Values["id2"]); } ViewBag.Status = Status; var objNewsBL = new NewsBL(); ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); string language = AppsCommon.GetCurrentLang(); var objNewInfo = objNewsBL.ArticlesGetById(pIDArticles, language); if (SessionData.CurrentUser != null && SessionData.CurrentUser.Type != (decimal)CommonEnums.UserType.Customer) { B_Todos_BL _B_Todos_BL = new B_Todos_BL(); B_Todos_Info _B_Todos_Info = _B_Todos_BL.Todo_GetByCaseCode(objNewInfo.Case_Code, SessionData.CurrentUser.Username); if (_B_Todos_Info != null) { ViewBag.B_Todos_Info = _B_Todos_Info; } } return(View("~/Areas/Articles/Views/ArticlesNews/_PartialviewEdit.cshtml", objNewInfo)); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult TodoNews() { try { if (SessionData.CurrentUser == null) { return(Redirect("/")); } string _casecode = ""; if (RouteData.Values.ContainsKey("id")) { _casecode = RouteData.Values["id"].ToString(); } if (SessionData.CurrentUser != null && SessionData.CurrentUser.Type != (decimal)CommonEnums.UserType.Customer) { B_Todos_BL _B_Todos_BL = new B_Todos_BL(); B_Todos_Info _B_Todos_Info = _B_Todos_BL.Todo_GetByCaseCode(_casecode, SessionData.CurrentUser.Username); if (_B_Todos_Info != null) { ViewBag.B_Todos_Info = _B_Todos_Info; } } var objNewsBL = new NewsBL(); ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); string language = AppsCommon.GetCurrentLang(); var objNewInfo = objNewsBL.ArticlesGetByCaseCode(_casecode, language); if (objNewInfo != null) { ViewBag.Status = objNewInfo.Status; } return(View("~/Areas/Articles/Views/ArticlesNews/_Partial_Approve.cshtml", objNewInfo)); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult NewsDetailPortal() { try { decimal pIDArticles = 0; //int Status = 7; if (RouteData.Values.ContainsKey("id")) { pIDArticles = CommonFuc.ConvertToDecimal(RouteData.Values["id"]); } var objNewsBL = new NewsBL(); string language = AppsCommon.GetCurrentLang(); var objNewInfo = objNewsBL.ArticlesGetById(pIDArticles, language); ViewBag.objNewInfo = objNewInfo; return(View("~/Areas/Articles/Views/ArticlesNews/_HomeDetailNews.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public ActionResult GetListArticles() { try { decimal pStatus = 0; if (SessionData.CurrentUser == null) { return(Redirect("/")); } if (RouteData.Values.ContainsKey("id")) { pStatus = CommonFuc.ConvertToDecimal(RouteData.Values["id"]); } ViewBag.Status = pStatus; decimal _total_record = 0; NewsBL objBL = new NewsBL(); string _status = "ALL"; string language = AppsCommon.GetCurrentLang(); string _category = "ALL"; string _title = "ALL"; string _keySearch = _status + "|ALL|" + language + "|" + _category + "|" + _title + "|" + SessionData.CurrentUser.Username; List <NewsInfo> _lst = objBL.ArticleHomeSearch(_keySearch, ref _total_record); string htmlPaging = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <NewsInfo>((int)_total_record, 1, "Tin"); ViewBag.listArticles = _lst; ViewBag.Paging = htmlPaging; ViewBag.Status = pStatus; ViewBag.SumRecord = _total_record; ViewBag.lstCategory = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("ARTICLES", "CATEGORIES"); return(View("~/Areas/Articles/Views/ArticlesNews/GetListArticles.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View()); } }
public NewsResultModel GetNews(NewsByCriteriaRequestModel param) { NewsResultModel result = new NewsResultModel(); try { int?memberId = IdentityHelper.GetMemberId(); if (!memberId.HasValue) { throw new OrgException("Invalid MemberId"); } NewsBL bl = new NewsBL(); var news = bl.GetNewsByMember(memberId.Value, param); result.Status = true; result.Message = "Got " + news.Count.ToString() + " news"; result.News = news; } catch (OrgException oex) { result.Status = false; result.Message = oex.Message; } catch (Exception ex) { result.Status = false; result.Message = AppConfigs.InternalErrorMessage; if (AppConfigs.DebugInternalMessage) { result.InternalMessage = ex.Message; } } return(result); }
public ResultModel CreateComment(NewsCommentCreateRequesetModel param) { ResultModel result = new ResultModel(); try { int?memberId = IdentityHelper.GetMemberId(); if (!memberId.HasValue) { throw new OrgException("Invalid MemberId"); } NewsBL bl = new NewsBL(); bl.CreateComment(memberId.Value, param); result.Status = true; result.Message = "Comment created"; } catch (OrgException oex) { result.Status = false; result.Message = oex.Message; } catch (Exception ex) { result.Status = false; result.Message = AppConfigs.InternalErrorMessage; if (AppConfigs.DebugInternalMessage) { result.InternalMessage = ex.Message; } } return(result); }
public HomeController() { _entities = new KSULaxEntities(); _newsBL = new NewsBL(_entities); _gameBL = new GameBL(_entities); }
public NewsController() { _entities = new KSULaxEntities(); _newsBL = new NewsBL(_entities); }
private IEnumerable <News> GetAllNews() { var instanceBL = new NewsBL(); return(instanceBL.GetNews()); }
public News Get(int id) { NewsBL newBL = new NewsBL(); return(newBL.GetById(id)); }