Ejemplo n.º 1
0
        //
        // GET: /Detail/
        public ActionResult News(int? id)
        {
            News dal = new News();
            Ba_News model = dal.GetSingleNewsById(id.HasValue ? (int)id : 1);

            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult List(int? newstype, int? id)
        {
            int _newstype = newstype.HasValue ? newstype.Value : 1;
            var newsTypes = new NewsType();
            ViewBag.newstypes = newsTypes.GetList();

            ViewBag.newstype = _newstype;

            var news = new News();
            IList<Ba_News> baNewses = news.GetNews(_newstype, id.HasValue ? id.Value : 1);
            ViewBag.baNewses = baNewses;

            //page info
            int pagecount = 1;
            int pagestep = 5;
            int objectcount = news.GetCount(_newstype);
            if (objectcount % pagestep == 0)
                pagecount = objectcount / pagestep;
            else
                pagecount = objectcount / pagestep + 1;
            //////
            //pagecount = 13;
            int currentpage = id.HasValue ? (int)id : 1;
            Common.HtmlPagerControl page = new Common.HtmlPagerControl(pagecount, 7, objectcount);
            page.CurrentPage = currentpage;
            page.HrefPage = "/news/list/" + newstype + "/";
            page.SimpleTheme = true;
            page.NavigateNext = "&gt;";
            page.NavigatePrevious = "&lt;";
            ViewBag.pageinfo = page.Render();

            return View();
        }
Ejemplo n.º 3
0
        //
        // GET: /SuperAdmin/NewsList/
        public ActionResult Page(int? id)
        {
            ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsList");

            var newstype = new NewsType();
            ViewBag.newstype = newstype.GetList();

            News dal = new News();
            IList<Ba_News> news = dal.GetNews(id.HasValue ? (int)id : 1);

            int pagecount = 1;
            int pagestep = 18;
            int objectcount = dal.GetCount();
            if (objectcount % pagestep == 0)
                pagecount = objectcount / pagestep;
            else
                pagecount = objectcount / pagestep + 1;
            //////
            /////pagecount = 13;
            int currentpage = id.HasValue ? (int)id : 1;
            Common.HtmlPagerControl page = new Common.HtmlPagerControl(pagecount, 3, objectcount);
            page.CurrentPage = currentpage;
            page.HrefPage = "/superadmin/NewsList/page/";
            ViewBag.pageinfo = page.Render();

            return View(news);
        }
Ejemplo n.º 4
0
        public string Submit(NewsOperate_Form form)
        {
            string result = string.Empty;
            News dal = new News();
            var model = dal.GetSingleById(form.news_id);
            if (model == null)
                model = new Ba_News();
            model.Ns_Title = form.news_title;
            model.Ns_Type = form.news_type;
            model.Ns_Content = form.news_description;
            model.Ns_ImagePath = form.news_imageurl;
            model.Ns_PostTime = DateTime.Now;
            model.Ns_State = true;
            try
            {
                dal.Save(model);
                result = "1";
            }
            catch (System.Exception ex)
            {
                result = ex.ToString();
            }

            return result;
        }
Ejemplo n.º 5
0
        //
        // GET: /SuperAdmin/NewsOperate/
        public ActionResult Index(int? id)
        {
            ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsOperate");

            var newstype = new NewsType();
            ViewBag.newstype = newstype.GetList();

            var model = new Ba_News();
            if (id != null)
            {
                News dal = new News();
                model = dal.GetSingleById((int)id);
            }
            if (model == null)
                model = new Ba_News();

            ViewBag.model = model;

            if (model.Ns_ID.Equals(0))
                ViewBag.Title = "新增最新情報";
            else
                ViewBag.Title = "更新最新情報";

            return View();
        }
Ejemplo n.º 6
0
        //
        // GET: /SuperAdmin/NewsList/
        public ActionResult Index()
        {
            ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsList");

            News dal = new News();
            IList<Ba_News> news = dal.GetNews();
            ViewBag.news = news;

            return View(news);
        }
Ejemplo n.º 7
0
        //
        // GET: /News/
        public ActionResult Index(int? id)
        {
            var newstype = new NewsType();
            ViewBag.newstype = newstype.GetList();

            News dal = new News();
            var model = dal.GetSingleById(id.HasValue ? id.Value : 0);

            return View(model);
        }
Ejemplo n.º 8
0
        public string Delete(int id)
        {
            string result = "0";
            News dal = new News();
            var model = dal.GetSingleNewsById(id);
            if (model != null)
            {
                model.Ns_State = false;
                dal.Update(model);
                result = "1";
            }

            return result;
        }