private void StartLoadNewsInfo(int id) { string tag = _tag + "[StartLoadNewsInfo]"; var result = NewsDAL.Get(id); if (result.Code < 0) { LogHelpers.WriteError(tag, result.ErrorMessage); lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; if (result.Data.Tables[0].Rows.Count == 0) { return; } NewsBOL BOL = new NewsBOL(result.Data.Tables[0].Rows[0]); StartShowData(BOL); }
public ActionResult Details(int?id) { if (!id.HasValue || id.Value <= 0) { return(RedirectToAction("Index")); } NewsBOL news = NewsDAL.Get(id.Value); return(View(news)); }
// // GET: /News/ public ActionResult Index(int?id) { if (id == null || !id.HasValue || id.Value <= 0) { return(RedirectToAction("Index", "Home")); } var result = NewsDAL.Get(id.Value); if (result.Code < 0) { return(RedirectToAction("Index", "Home")); } return(View(result.Data)); }
public void StartShowNewsDetail(int newsId) { string tag = "[ucNewsDetail][StartShowNewsDetail]"; if (newsId <= 0) { return; } var result = NewsDAL.Get(newsId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; try { bool langueEn = Utilities.IsLangueEN(); //-- NewsBOL news = new NewsBOL(result.Data.Tables[0].Rows[0]); lbUpdatedDate.InnerText = news.UpdatedDate.ToString("MM/dd/yyyy HH:mm zzz"); lbTitle.InnerText = langueEn ? news.Name_EN : news.Name_VN; ltrContent.Text = Utilities.SetFullLinkImage(langueEn ? news.Content_EN : news.Content_VN, Utilities.GetDirectory("ImageNewsDir")); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } }
private void StartLoadNewsDetail(int id) { string tag = __tag + "[StartShowNewsDetail]"; if (id <= 0) { return; } var result = NewsDAL.Get(id); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; try { bool langueEn = Utilities.IsLangueEN(); //-- NewsBOL news = new NewsBOL(result.Data.Tables[0].Rows[0]); lbHeader.InnerText = langueEn ? news.Name_EN : news.Name_VN; //-- ucNewsDetail.StartShowNewsDetail(news); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } }
public ActionResult Edit(int?id) { if (!Utilities.IsLoggedUser()) { return(RedirectToAction("Login", "Home")); } LogHelpers.LogHandler.Info("Start"); ViewData["ListMenu"] = MenuDAL.GetSelectList(); if (id == null || !id.HasValue || id.Value <= 0) { return(RedirectToAction("Index")); } var result = NewsDAL.Get(id.Value); if (result.Code < 0) { return(RedirectToAction("Index")); } return(View("AddOrEdit", result.Data)); }
/// <summary> /// 获取一条实体数据 /// </summary> /// <returns></returns> public News Get(string colName, object value) { return(dal.Get(colName, value)); }