Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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());
            }
        }
Esempio n. 3
0
        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());
            }
        }
Esempio n. 4
0
        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.");
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
        //
        // 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));
        }
Esempio n. 9
0
 /// <summary>
 /// 获取全部数据
 /// </summary>
 /// <returns></returns>
 public List <News> GetAll()
 {
     return(dal.GetAll());
 }
Esempio n. 10
0
        //
        // GET: /News/

        public ActionResult Index(int?id)
        {
            List <NewsBOL> lst = NewsDAL.GetAll(id.HasValue ? id.Value : 0);

            return(View(lst));
        }