Example #1
0
        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);
        }
Example #2
0
        public ActionResult Details(int?id)
        {
            if (!id.HasValue || id.Value <= 0)
            {
                return(RedirectToAction("Index"));
            }

            NewsBOL news = NewsDAL.Get(id.Value);

            return(View(news));
        }
Example #3
0
        //
        // 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));
        }
Example #4
0
        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;
            }
        }
Example #5
0
        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;
            }
        }
Example #6
0
        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));
        }
Example #7
0
 /// <summary>
 /// 获取一条实体数据
 /// </summary>
 /// <returns></returns>
 public News Get(string colName, object value)
 {
     return(dal.Get(colName, value));
 }