コード例 #1
0
        public ActionResult Render(long SiteID, long ZoneNo)
        {
            List <ImageTextModel> imageTextList = new List <ImageTextModel>();
            var Zone  = CardsDAO.GetZoneInfo(ZoneNo);
            var Cards = CardsDAO.GetZoneData(SiteID, ZoneNo);

            string RenderViewFileName = "~/Views/Article/ImageTextListStyleDefault.cshtml";

            if (Cards != null && Cards.Count > 0)
            {
                foreach (CardsModels Card in Cards)
                {
                    if (Card.CardsType == "Article")
                    {
                        WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(Card.No);
                        ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID);
                        var article = ArticleDAO.GetItemByCard(Card.No);
                        if (article != null)
                        {
                            imageTextList = ImageTextDAO.Get(article.ID, true, null);
                            string ViewFileName = string.Format("~/Views/Article/ImageTextListStyle{0}.cshtml", Card.StylesID.ToString());
                            if (System.IO.File.Exists(Server.MapPath(ViewFileName)))
                            {
                                RenderViewFileName = ViewFileName;
                            }
                        }
                    }
                }
            }
            return(View(RenderViewFileName, imageTextList));
        }
コード例 #2
0
        public ActionResult Index(CardsModels model)
        {
            PageCache pageCache = PageCache.GetTempDataPageCache(TempData);
            var       datas     = ImageTextDAO.Get(model.No, true);

            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(pageCache.SiteID, pageCache.MenuID);

            int styleId = model.StylesID;

            return(View("Style" + styleId, datas));
        }
コード例 #3
0
        public ActionResult List(long SiteID, long MenuID, long CardNo, SearchModel Search)
        {
            ViewBag.SiteID      = SiteID;
            ViewBag.MenuID      = MenuID;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID);

            ViewBag.CardNo = CardNo;
            ViewBag.Search = Search;

            var model = ImageTextDAO.Get(CardNo, Search: Search);

            return(View(model));
        }
コード例 #4
0
        public ActionResult Edit(long SiteID, long MenuID, long CardNo)
        {
            ViewBag.SiteID      = SiteID;
            ViewBag.MenuID      = MenuID;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID);

            ImageTextModel model = new ImageTextModel();

            model.CardNo = CardNo;

            var temp = ImageTextDAO.Get(CardNo).FirstOrDefault();

            if (temp != null)
            {
                model = temp;
            }

            return(View(model));
        }
コード例 #5
0
ファイル: PagesController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Zone(ZonesModels Zone)
        {
            List <CardsModels> Cards;

            ViewBag.ZoneNo = Zone.No;

            //取得該Zone底下的Card集合
            if (Zone.AreaSetID == null)
            {
                Cards = CardsDAO.GetZoneData(Zone.SiteID, Zone.No);
                if (Cards != null && Zone.CardsModels != null)
                {
                    //Zone.CardsModels 有資料時代表有右側廣告
                    List <CardsModels> RightSideAd = Zone.CardsModels.OrderBy(m => m.TempSort).ToList();
                    foreach (CardsModels card in Cards)
                    {
                        RightSideAd.Insert(0, card);
                    }
                    Cards = RightSideAd;
                }
            }
            else
            {
                Cards = AdvertisementRenderTools.GenCard(Zone); //AreaSetID不為Null代表為廣告
            }
            var articleCars = Cards.Where(card => card.CardsType == "Article");

            if (articleCars != null && articleCars.Count() > 0)
            {
                WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(articleCars.First().No);
                var article = ArticleDAO.GetItemByCard(articleCars.First().No);
                if (article != null)
                {
                    var imageTextList = ImageTextDAO.Get(article.ID, true, null);
                    if (imageTextList != null && imageTextList.Count() > 0)
                    {
                        Zone.StyleID = 9;
                    }
                }
            }
            return(PartialView("Zones/_Style" + Zone.StyleID, Cards));
        }