public void StartDatabindingAbout(int menuId) { string tag = __tag + "[StartDatabindingAbout]"; if (menuId <= 0) { return; } try { var result = NewsDAL.GetAll(menuId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; //-- LogHelpers.WriteError(tag, result.ErrorMessage); return; } lvAbout.DataSource = result.Data; lvAbout.DataBind(); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); //--- lbError.InnerText = ex.Message; lbError.Visible = true; } }
public void StartBindingData(int menuId, string navigationUrl) { try { var result = NewsDAL.GetAll(menuId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = false; return; } _menuId = menuId; _navigationUrl = navigationUrl; _dataSource = result.Data.Tables[0]; grvIntroItems.DataSource = result.Data; grvIntroItems.DataKeyNames = new string[] { "Id" }; grvIntroItems.DataBind(); } catch (Exception ex) { LogHelpers.WriteError("[ucNewsItems][StartBindingData] Exception: " + ex.ToString()); } }
public void StartBindingData(int menuId) { _navigationUrl = "GalleryDetail.aspx"; _menuId = menuId; try { var result = NewsDAL.GetAll(__type, menuId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; _dataSource = result.Data.Tables[0]; grvProjectItems.DataSource = result.Data; grvProjectItems.DataKeyNames = new string[] { "Id" }; grvProjectItems.DataBind(); } catch (Exception ex) { LogHelpers.WriteError("[ucProjectItems][StartBindingData] Exception: " + ex.ToString()); } }
public void StartBindingData(int menuId, string navigationUrl) { string tag = __tag + "[StartBindingData]"; //-- LogHelpers.WriteStatus(tag, "MenuId = " + menuId.ToString(), "Start."); _navigationUrl = navigationUrl; try { var result = NewsDAL.GetAll(menuId); if (result.Code < 0) { return; } //--- lvNews.DataSource = result.Data; lvNews.DataKeyNames = new string[] { "Id" }; lvNews.DataBind(); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); } LogHelpers.WriteStatus(tag, "MenuId = " + menuId.ToString(), "End."); }
public ActionResult Index(int?menuId) { Session["SelectedMenuId"] = menuId; var result = NewsDAL.GetAll(menuId == null || !menuId.HasValue ? 0 : menuId.Value); if (result.Code < 0) { LogHelpers.LogHandler.Error(result.ErrorMessage); throw new HttpException(result.ErrorMessage); } return(View(result.Data)); }
public void StartBindingDataNews(int menuId, int id, string navigationUrl, string header) { string tag = __tag + "[StartBindingDataNews]"; //-- lbHeader.InnerText = header; if (menuId <= 0) { return; } try { var result = NewsDAL.GetAll(menuId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; //--- LogHelpers.WriteError(tag, result.ErrorMessage); return; } if (result.Data.Tables.Count == 0 || result.Data.Tables[0].Rows.Count == 0) { return; } ucNewsList.StartBindingData(result.Data, menuId, navigationUrl); //-- if (id <= 0) { NewsBOL news = new NewsBOL(result.Data.Tables[0].Rows[0]); lbHeader.InnerText = Utilities.IsLangueEN() ? news.Name_EN : news.Name_VN; //-- ucNewsDetail.StartShowNewsDetail(news); } else { StartLoadNewsDetail(id); } } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); //-- lbError.InnerText = ex.Message; lbError.Visible = true; } }
private void StartAddSubItemAbout(HtmlGenericControl li, int menuId) { string tag = __tag + "[StartAddSubItemAbout]"; if (menuId <= 0) { return; } var result = NewsDAL.GetAll(menuId); if (result.Code < 0) { LogHelpers.WriteError(tag, result.ErrorMessage); return; } if (result.Data.Tables.Count == 0 || result.Data.Tables[0].Rows.Count < 0) { return; } HtmlGenericControl ul = new HtmlGenericControl("ul"); foreach (DataRow row in result.Data.Tables[0].Rows) { try { NewsBOL news = new NewsBOL(row); //--- HtmlGenericControl subLi = new HtmlGenericControl("li"); subLi.InnerHtml = string.Format("<a href='{0}#{1}'>{2}</a>", Utilities.GetNavigationUrl("AboutPage"), news.Id, Utilities.IsLangueEN() ? news.Name_EN : news.Name_VN); //---- ul.Controls.Add(subLi); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); } } if (ul.Controls.Count > 0) { li.Controls.Add(ul); } }
// // GET: /News/ public ActionResult Index(int?id) { if (!Utilities.IsLoggedUser()) { return(RedirectToAction("Login", "Home")); } if (id != null && !id.HasValue && id.Value > 0) { return(RedirectToAction("Edit/" + id.Value.ToString())); } var result = NewsDAL.GetAll(0); if (result.Code < 0) { throw new HttpException(result.ErrorMessage); } return(View(result.Data)); }
/// <summary> /// 获取全部数据 /// </summary> /// <returns></returns> public List <News> GetAll() { return(dal.GetAll()); }
// // GET: /News/ public ActionResult Index(int?id) { List <NewsBOL> lst = NewsDAL.GetAll(id.HasValue ? id.Value : 0); return(View(lst)); }