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)); }
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)); }
public ActionResult Index(string SiteSN, string PageSN, string type) { var mSites = SitesDAO.GetSiteInfo(SiteSN); if (mSites != null) { var mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { //取得該Page底下的Zone集合 var zones = ZonesDAO.GetPageData(mPages.SiteID, mPages.No); foreach (var zone in zones) { var cards = CardsDAO.GetZoneData(zone.SiteID, zone.No); var card = cards.Where(x => x.CardsType != "Header" && x.CardsType != "BreadCrumbs" && x.CardsType != "Footer").FirstOrDefault(); if (card != null) { ViewBag.Type = type; ViewBag.Title = mPages.Title; ViewBag.SiteName = mSites.Title; return(View(card)); } } } } string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != "") { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } return(RedirectToAction("EmptyPage", "Home")); }