Beispiel #1
0
        public void LoadLeftRight(ref NModel.NewsPager model_pager)
        {
            IList <NModel.DB_News> model_news_left  = null;
            IList <NModel.DB_News> model_news_right = null;

            BLL.DB_News bll_news = new BLL.DB_News();

            model_news_left  = bll_news.GetNewListByWhereAndTop(" News_IsHot=1 ", 6);
            model_news_right = bll_news.GetNewListByWhereAndTop(" News_IsRecommend=1 ", 6);
            model_pager.IDctNewsList.Add("left", model_news_left != null ? model_news_left : new List <NModel.DB_News>());
            model_pager.IDctNewsList.Add("right", model_news_right != null ? model_news_right : new List <NModel.DB_News>());

            bll_news.Close();
        }
Beispiel #2
0
        public ActionResult Index()
        {
            NModel.NewsPager model_pager = LoadConfig("Index");

            BLL.DB_News bll_news = new BLL.DB_News();

            model_pager.IDctNewsList = new Dictionary <string, IList <NModel.DB_News> >();

            LoadLeftRight(ref model_pager);

            IList <NModel.DB_News> model_news_num = null;
            IList <string>         numList        = new List <string>();

            numList.Add("0101");
            numList.Add("0102");
            numList.Add("0103");
            numList.Add("0201");
            numList.Add("0202");
            numList.Add("0203");
            numList.Add("0301");
            numList.Add("0302");
            numList.Add("0303");
            numList.Add("0401");
            numList.Add("0402");
            numList.Add("0403");
            numList.Add("0501");
            numList.Add("0502");
            numList.Add("0503");
            numList.Add("0504");
            numList.Add("0601");
            numList.Add("0602");
            numList.Add("0603");

            foreach (string val in numList)
            {
                model_news_num = bll_news.GetNewListByWhereAndTop(string.Format(" news_num=''{0}''and  News_IsIndex=1", val), 6);

                model_pager.IDctNewsList.Add(val, model_news_num != null ? model_news_num : new List <NModel.DB_News>());
            }

            model_pager.IDictListAd = new Dictionary <string, IList <NModel.DB_AD> >();
            BLL.DB_AD            bll_ad        = new BLL.DB_AD();
            string               sql_ad        = string.Format(" ''01'' ");
            IList <NModel.DB_AD> model_ad_list = bll_ad.GetListByNumAndTop(sql_ad, 8);

            model_pager.IDictListAd.Add("中间广告", model_ad_list != null ? model_ad_list : new List <NModel.DB_AD>());

            bll_ad.Close();
            bll_news.Close();
            return(View(model_pager));
        }