public ActionResult ClickPreview(long SiteID, long MenuID, int clickType, string data) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); var model = new object(); switch (clickType) { case 1: model = JsonConvert.DeserializeObject <List <ClickImgModel> >(data); return(View("ImgPreview", model)); case 2: model = JsonConvert.DeserializeObject <ClickVideoModel>(data); return(View("VideoPreview", model)); case 3: model = JsonConvert.DeserializeObject <ClickVoiceModel>(data); return(View("VoicePreview", model)); case 4: model = JsonConvert.DeserializeObject <ClickFileModel>(data); return(View("FilePreview", model)); case 5: model = JsonConvert.DeserializeObject <ClickLinkModel>(data); return(View("LinkPreview", model)); } return(null); }
public string FileUploadCustom(long SiteID, string CustomFolder) { if (Request.Files == null || Request.Files.Count == 0) { return(null); } string base64 = "", base64_Resize = ""; if (!string.IsNullOrEmpty(Request.Form["Base64"])) { base64 = Request.Form["Base64"]; } if (!string.IsNullOrEmpty(Request.Form["Base64_Resize"])) { base64_Resize = Request.Form["Base64_Resize"]; } HttpPostedFileBase file = Request.Files[0]; if (file.ContentLength == 0) { return(null); } return(JsonConvert.SerializeObject(new { Name = UpdFileInfo.SaveFilesBySiteID(file, SiteID, CustomFolder, base64, base64_Resize), FileSize = file.ContentLength.ToString() })); }
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)); }
private void RecommendHandler2(long id, ArticleSettingModels setting, string uploadUrl, IEnumerable <ArticleTypesModels> types) { if (setting.ExtendReadOpen2) { IEnumerable <ArticleModels> recommends = ArticleDAO.GetRecommendItems2(setting, id, types.Select(t => t.ID)); Dictionary <long, SitePage> recommendSitePages = CardsDAO.GetPages(recommends.Select(r => r.CardNo)); Dictionary <long, dynamic> imgPathInfo = new Dictionary <long, dynamic>(); imgPathInfo.Add(setting.MenuID, new { Setting = setting, UploadUrl = uploadUrl }); foreach (ArticleModels item in recommends) { SitePage page = recommendSitePages[item.CardNo]; dynamic pathInfo; if (!imgPathInfo.TryGetValue(page.MenuID, out pathInfo)) { ArticleSettingModels newSetting = ArticleSettingDAO.GetItem(page.MenuID); string newUploadUrl = UpdFileInfo.GetVPathByMenuID(page.SiteID, page.MenuID).TrimEnd('/') + "/"; pathInfo = new { Setting = newSetting, UploadUrl = newUploadUrl }; imgPathInfo.Add(page.MenuID, pathInfo); } string img = item.GetFirstImg(pathInfo.Setting); item.Icon = string.IsNullOrWhiteSpace(img) ? string.Empty : pathInfo.UploadUrl + img; } ViewBag.Recommends2 = recommends; ViewBag.RecommendSitePages2 = recommendSitePages; } }
public ActionResult FavorityEdit(long SiteID, long MenuID, CategoryModels model, HttpPostedFileBase fIcon, string fIconBase64) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); if (string.IsNullOrEmpty(model.Icon)) { model.Icon = string.Empty; } else { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.Icon); if (imgModel.ID == 0) { if (fIcon == null || fIcon.ContentLength == 0) { model.Icon = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fIcon, SiteID, MenuID, fIconBase64); imgModel.ID = 1; imgModel.Img = fileName; model.Icon = JsonConvert.SerializeObject(imgModel); } } } CategoryDAO.SetItem(model); ViewBag.Exit = true; return(View(model)); }
public ActionResult MenuEdit_File(long?id) { ViewBag.HasChildren = false; //檔案上限 ViewBag.FileLimit = 1; ViewBag.FileExtensions = UpdFileInfo.FileExtensionsType.Custom;//Joe 20190925 問題單:後台單一檔案允許格式 if (uCheck.IsNumeric(id)) { long SiteId = GetItem.SiteID(); string vPath = UpdFileInfo.GetVPathBySiteID(SiteId, "Menus"); MenusModels mm = MenusDAO.GetInfo(SiteId, (long)id); ResourceFilesModels newFile = ResourceFilesDAO.GetInfo(SiteId, (long)id, (byte)SourceType.Menu, 1, 1, 1); if (newFile != null) { ViewBag.FileExists = new HtmlString(ResourceFilesDAO.fileuploader(newFile, vPath)); } var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } return(View(mm)); } return(View()); }
// GET: Backend/MemberShipSetting public ActionResult List(long SiteID, long MenuID) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); List <CategoryModels> identity_items = CategoryDAO.GetItems(IdentityType); if (identity_items != null && identity_items.Count() > 0) { ViewBag.ListIdentity = identity_items; } else { //20181025 nina 身分沒有資料時,新增一般會員 CategoryModels category = new CategoryModels() { Type = IdentityType, Title = "一般會員", ShowStatus = true, MemberSession = (int)MemberSession.限制, PresetIdentity = (int)PresetIdentity.一般會員 }; CategoryDAO.SetItem(category); ViewBag.ListIdentity = CategoryDAO.GetItems(IdentityType); } List <CategoryModels> favority_items = CategoryDAO.GetItems(FavorityType); ViewBag.ListFavoity = favority_items; return(View()); }
public ActionResult Edit(long SiteID, long MenuID, CategoryModels model) { if (!string.IsNullOrWhiteSpace(model.Image)) { WorkV3.Models.ResourceImagesModels imgModel = JsonConvert.DeserializeObject <WorkV3.Models.ResourceImagesModels>(model.Image); if (imgModel.ID == 0) { // 新上傳的圖片 HttpPostedFileBase postedFile = Request.Files["fImage"]; if (postedFile == null || postedFile.ContentLength == 0) { model.Image = string.Empty; } else { model.Image = Golbal.UpdFileInfo.SaveFilesByMenuID(postedFile, SiteID, MenuID); } } else { model.Image = imgModel.Img; } } if (model.PresetIdentity == (int)PresetIdentity.一般會員) { model.MemberSession = (int)MemberSession.限制; } ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); CategoryDAO.SetItem(model); ViewBag.Exit = true; return(View(model)); }
public ActionResult SeriesEdit(long siteId, long menuId, ArticleSeriesModels item, HttpPostedFileBase fIcon, string fIconBase64, string fIconBase64_Resize) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(siteId, menuId); ViewBag.Exit = true; if (string.IsNullOrEmpty(item.Icon)) { item.Icon = string.Empty; } else { WorkV3.Models.ImageModel imgModel = JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(item.Icon); if (imgModel.ID == 0) { if (fIcon == null || fIcon.ContentLength == 0) { item.Icon = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fIcon, siteId, menuId, fIconBase64, fIconBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; item.Icon = JsonConvert.SerializeObject(imgModel); } } } ArticleSeriesDAO.SetItem(item); return(View(item)); }
public ActionResult VideoEdit(long SiteID, long MenuID) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); return(View()); }
public ActionResult VoiceEdit(long SiteID, long MenuID, ClickVideoModel model, string customVideo) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); return(View()); }
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)); }
public ActionResult List(long SiteID, long MenuID, long CardNo) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); ViewBag.CardNo = CardNo; var model = MainVisionDAO.Get(CardNo); return(View(model)); }
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 = ParallaxDAO.Get(CardNo, Search: Search); return(View(model)); }
public ActionResult Index(CardsModels model) { WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.SitePage = curPage; var data = MainVisionDAO.Get(model.No, true); if (data.Count == 0) { return(null); } return(View("Style" + model.StylesID, data)); }
public ActionResult Index(CardsModels model) { var datas = ParallaxDAO.Get(model.No, true); if (datas.Count == 0) { return(null); } int index = new Random().Next(datas.Count); var data = datas[index]; WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.ImgSrc = JsonConvert.DeserializeObject <ImageModel>(data.Img).Img; return(View(data)); }
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)); }
public ActionResult Edit(long SiteID, long MenuID, long?ID) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); CategoryModels m = new CategoryModels(); m.Type = IdentityType; if (ID.HasValue) { m = CategoryDAO.GetItem((long)ID); ViewBag.IsNew = false; } else { ViewBag.IsNew = true; } ViewBag.ID = ID ?? 0; return(View(m)); }
public ActionResult SeriesEdit(long siteId, long menuId, long?id) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(siteId, menuId); ArticleSeriesModels Series = null; if (id != null) { Series = ArticleSeriesDAO.GetItem((long)id); } if (Series == null) { Series = new ArticleSeriesModels { ID = WorkLib.GetItem.NewSN(), IsIssue = true, Sort = int.MaxValue } } ; return(View(Series)); }
public ActionResult Edit(long SiteID, long MenuID, long CardNo, long?ID = null) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); ParallaxModel model = new ParallaxModel(); model.CardNo = CardNo; if (ID.HasValue) { model.ID = ID.Value; var query = new Query(); query.Where.Add(new QWhere("ID", COperator.Equal, model.ID)); model = ParallaxDAO.Instance.Get(query).FirstOrDefault(); } return(View(model)); }
public ActionResult Content(CardsModels model) { long menuId = CardsDAO.GetMenuID(model.No); ArticleSettingModels setting = ArticleSettingDAO.GetItem(menuId); ViewBag.Setting = setting; ArticleModels item = ArticleDAO.GetItemByCard(model.No); item.ReplyCommentSetting = setting; IEnumerable <ArticleTypesModels> types = item.GetTypes(); ViewBag.Types = types; IEnumerable <ArticleSeriesModels> series = item.GetSeries(); ViewBag.Series = series; IEnumerable <ArticleCategoryModels> readModeCategories = item.GetCategories(IdentityType); ViewBag.ReadModeCategories = readModeCategories; string uploadUrl = UpdFileInfo.GetVPathByMenuID(model.SiteID, menuId).TrimEnd('/') + "/"; RecommendHandler(item.ID, setting, uploadUrl, types); RecommendHandler2(item.ID, setting, uploadUrl, types); //string key = "AllArticleID_" + menuId; //long[] allArticleIds = HttpRuntime.Cache[key] as long[]; //if(allArticleIds == null) { // allArticleIds = ArticleDAO.GetAllIDs(menuId).ToArray(); // HttpRuntime.Cache.Add(key, allArticleIds, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0), System.Web.Caching.CacheItemPriority.Normal, null); //} long[] allArticleIds = ArticleDAO.GetAllIDs(setting).ToArray(); int index = Array.IndexOf(allArticleIds, item.ID); ViewBag.ListSitePageIndex = (index / setting.PageSize) + 1; if (index <= 0) { ViewBag.Prev = null; } else { ArticleModels prev = ArticleDAO.GetItem(allArticleIds[index - 1]); ViewBag.Prev = prev; ViewBag.PrevSitePage = CardsDAO.GetPage(prev.CardNo); } ViewBag.ListSitePage = MenusDAO.GetListPage(menuId); if (index == allArticleIds.Length - 1) { ViewBag.Next = null; } else { ArticleModels next = ArticleDAO.GetItem(allArticleIds[index + 1]); ViewBag.Next = next; ViewBag.NextSitePage = CardsDAO.GetPage(next.CardNo); } SitePage page = CardsDAO.GetPage(model.No); long pageID = page.PageNo; ViewBag.UploadUrl = uploadUrl; ViewBag.SiteID = model.SiteID; ViewBag.SiteSN = page.SiteSN; ViewBag.MenuID = menuId; ViewBag.PageID = pageID; ViewBag.CollectionResult = MemberShipDAO.CheckMemberCollectionExist(pageID); ViewBag.CollectionCount = MemberShipDAO.GetPageCollectionCount(pageID); ViewBag.Style = model.StylesID == 0 ? 1 : model.StylesID; ArticleDAO.AddItemClicks(item.ID); int style = model.StylesID == 0 ? 1 : model.StylesID; string ViewFileName = string.Format("~/Views/Article/ContentStyle{0}.cshtml", style); if (!System.IO.File.Exists(Server.MapPath(ViewFileName))) { style = 1; } ViewFileName = string.Format("~/Views/Article/ContentStyle{0}.cshtml", style); return(View(ViewFileName, item)); }
public ActionResult MenuEdit_File(MenusModels MData, HttpPostedFileBase updFiles) { ViewBag.HasChildren = false; var childList = MenusDAO.GetChildren(MData.ID); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } MenusDAO.Save_Single(MData); //單檔 if (updFiles != null) { if (updFiles.ContentLength > 0) { string uPath = UpdFileInfo.GetUPathBySiteID(MData.SiteID, "Menus"); string fileName = UpdFileInfo.SaveFiles(updFiles, uPath); ResourceFilesModels newFile = new ResourceFilesModels(); newFile.Id = 1; newFile.SiteID = MData.SiteID; newFile.SourceNo = MData.ID; newFile.SourceType = (byte)SourceType.Menu; newFile.Ver = 1; newFile.AreaID = 1; newFile.FileInfo = fileName; newFile.FileType = ResourceFileType.inFile; newFile.ClickType = (byte)ClickType.OpenNewWin; newFile.FileSize = newFile.GetSize(uPath); newFile.FileMimeType = newFile.GetMimeType(); ResourceFilesDAO.Save_Menu(newFile); } else { ResourceFilesDAO.DelAll(MData.SiteID, MData.ID, (byte)SourceType.Menu, 1, 1); } } //多檔 //List<ResourceFilesModels> newFileList = new List<ResourceFilesModels>(); //int Count = 0; //foreach (var ff in updFiles) //{ // if (ff != null) // { // if (ff.ContentLength > 0) // { // Count += 1; // var fileName = Path.GetFileName(ff.FileName); // var path = Path.Combine(GetItem.UpdPath(GetItem.SiteID() + "\\Menus"), fileName); // ff.SaveAs(path); // } // } //} SysLog.SaveLog(SysActions.Edit, SysMgrNo.Menu, MData.Title, MData.SiteID, MData.ID); TempData["refreshData"] = SysActions.Edit; Response.Redirect(Request.RawUrl); return(View()); }
public ActionResult Edit(long SiteID, long MenuID, ParallaxModel model, HttpPostedFileBase ImgFile, string ImgFileBase64, string ImgFileBase64_Resize) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); if (!ModelState.IsValid) { ViewBag.IsValid = false; return(View(model)); } #region 圖片 if (!string.IsNullOrWhiteSpace(model.Img)) { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.Img); if (imgModel.ID == 0) { if (ImgFile == null || ImgFile.ContentLength == 0) { model.Img = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(ImgFile, SiteID, MenuID, ImgFileBase64, ImgFileBase64_Resize); imgModel.ID = GetItem.NewSN(); imgModel.Img = fileName; model.Img = JsonConvert.SerializeObject(imgModel); } } } #endregion #region 儲存資料 if (model.Description == null) { model.Description = ""; } DateTime now = DateTime.Now; if (model.ID == 0) { model.ID = GetItem.NewSN(); model.Creator = MemberDAO.SysCurrent.Id; model.CreateTime = now; } model.Modifier = MemberDAO.SysCurrent.Id; model.ModifyTime = now; int result = ParallaxDAO.Instance.Update(model); if (result == 0) { ViewBag.EditResult = "儲存發生錯誤"; } else { ViewBag.EditResult = "儲存成功"; } return(View(model)); #endregion }
public ActionResult Index(CardsModels model) { WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); return(View(model)); }
public ActionResult Edit(long SiteID, long MenuID, MainVisionModel model, HttpPostedFileBase ImgFile, HttpPostedFileBase ImgMFile, HttpPostedFileBase fVideoImg, HttpPostedFileBase fVideoImgM, HttpPostedFileBase fIcon, HttpPostedFileBase fHoverIcon, string ImgFileBase64, string ImgMFileBase64, string fVideoImgBase64, string fVideoImgMBase64, string fIconBase64, string fHoverIconBase64, string ImgFileBase64_Resize, string ImgMFileBase64_Resize, string fVideoImgBase64_Resize, string fVideoImgMBase64_Resize, string fIconBase64_Resize, string fHoverIconBase64_Resize) { ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID); if (!ModelState.IsValid) { ViewBag.IsValid = false; return(View(model)); } #region 電腦版圖片 if (!string.IsNullOrWhiteSpace(model.Img)) { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.Img); if (imgModel.ID == 0) { if (ImgFile == null || ImgFile.ContentLength == 0) { model.Img = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(ImgFile, SiteID, MenuID, ImgFileBase64, ImgFileBase64_Resize); imgModel.ID = GetItem.NewSN(); imgModel.Img = fileName; model.Img = JsonConvert.SerializeObject(imgModel); } } } #endregion #region 手機版圖片 if (!string.IsNullOrWhiteSpace(model.ImgM)) { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.ImgM); if (imgModel.ID == 0) { if (ImgMFile == null || ImgMFile.ContentLength == 0) { model.ImgM = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(ImgMFile, SiteID, MenuID, ImgMFileBase64, ImgMFileBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; model.ImgM = JsonConvert.SerializeObject(imgModel); } } } #endregion #region 影片截圖 if (model.VideoImgIsCustom) { if (!string.IsNullOrWhiteSpace(model.VideoImg)) { if (model.VideoImg[0] == '{') { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.VideoImg); if (imgModel.ID == 0) { if (fVideoImg == null || fVideoImg.ContentLength == 0) { model.VideoImg = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fVideoImg, SiteID, MenuID, fVideoImgBase64, fVideoImgBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; model.VideoImg = JsonConvert.SerializeObject(imgModel); } } } else { model.VideoImg = string.Empty; } } if (!string.IsNullOrWhiteSpace(model.VideoImgM)) { if (model.VideoImgM[0] == '{') { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.VideoImgM); if (imgModel.ID == 0) { if (fVideoImgM == null || fVideoImgM.ContentLength == 0) { model.VideoImgM = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fVideoImgM, SiteID, MenuID, fVideoImgMBase64, fVideoImgMBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; model.VideoImgM = JsonConvert.SerializeObject(imgModel); } } } else { model.VideoImgM = string.Empty; } } } #endregion #region Icon if (!string.IsNullOrWhiteSpace(model.Icon)) { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.Icon); if (imgModel.ID == 0) { if (fIcon == null || fIcon.ContentLength == 0) { model.Icon = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fIcon, SiteID, MenuID, fIconBase64, fIconBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; model.Icon = JsonConvert.SerializeObject(imgModel); } } } #endregion #region HoverIcon if (!string.IsNullOrWhiteSpace(model.HoverIcon)) { ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.HoverIcon); if (imgModel.ID == 0) { if (fHoverIcon == null || fHoverIcon.ContentLength == 0) { model.HoverIcon = string.Empty; } else { string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fHoverIcon, SiteID, MenuID, fHoverIconBase64, fHoverIconBase64_Resize); imgModel.ID = 1; imgModel.Img = fileName; model.HoverIcon = JsonConvert.SerializeObject(imgModel); } } } #endregion if (!ModelState.IsValid) { ViewBag.IsValid = false; return(View(model)); } #region 儲存資料 DateTime now = DateTime.Now; if (model.ID == 0) { model.ID = GetItem.NewSN(); model.Creator = MemberDAO.SysCurrent.Id; model.CreateTime = now; } model.Modifier = MemberDAO.SysCurrent.Id; model.ModifyTime = now; int result = MainVisionDAO.Instance.Update(model); if (result == 0) { ViewBag.EditResult = "儲存發生錯誤"; } else { ViewBag.EditResult = "儲存成功"; } return(View(model)); #endregion }
public ActionResult Index(string SiteSN, string PageSN, long?id) { bool PageisExist = false; byte ShowStatus = 3; SitesModels mSites = SitesDAO.GetSiteInfo(SiteSN); PageCache pageCache = new PageCache(); if (mSites != null) { if (mSites.IsDelete || !mSites.Issue) { var member = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent; if (member == null) { return(HttpNotFound()); } } ViewBag.SiteID = mSites.Id; Areas.Backend.Models.SiteSeoSettingModels siteSeoSetting = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mSites.Id); if (siteSeoSetting != null) { if (!siteSeoSetting.Robot) { ViewBag.NoRobot = true; } ViewBag.GoogleSearchCode = siteSeoSetting.GoogleSearch; ViewBag.BaidoSearchCode = siteSeoSetting.BaiduMA; ViewBag.BingSearchCode = siteSeoSetting.Bing; if (!string.IsNullOrEmpty(siteSeoSetting.GA)) { ViewBag.GACode = "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" + siteSeoSetting.GA + "\"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '" + siteSeoSetting.GA + "');</script>"; } if (!string.IsNullOrEmpty(siteSeoSetting.Baidu)) { ViewBag.Baidu = @"<script> var _hmt = _hmt || []; (function() { var hm = document.createElement('script'); hm.src = 'https://hm.baidu.com/hm.js?" + siteSeoSetting.Baidu + @"'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(hm, s); })(); </script> "; } if (!string.IsNullOrEmpty(siteSeoSetting.GTM)) { ViewBag.GTM_Head = @"<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','" + siteSeoSetting.GTM + @"');</script> <!-- End Google Tag Manager -->"; ViewBag.GTM_Body = "<noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=" + siteSeoSetting.GTM + "\" height=\"0\" width=\"0\" style = \"display:none;visibility:hidden\"></iframe></noscript>"; } if (siteSeoSetting.IsExtraCode) { ViewBag.ExtraCode = siteSeoSetting.ExtraCode; } } pageCache.SiteID = mSites.Id; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; PagesModels mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { pageCache.SiteID = mPages.SiteID; pageCache.MenuID = mPages.MenuID; pageCache.PageNO = mPages.No; pageCache.PageSN = mPages.SN; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; MenusModels mMenus = MenusDAO.GetInfo(mPages.SiteID, mPages.MenuID); if (mMenus != null) { ShowStatus = mMenus.ShowStatus; } if (ShowStatus != 3) { ShowStatus = mPages.ShowStatus; } PageisExist = true; ViewBag.PageNo = mPages.No; ViewBag.Title = mPages.Title; ViewBag.MenuID = mPages.MenuID; ViewBag.SiteName = mSites.Title; ViewBag.FaviconPath = $"{WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(mSites.Id, "Header")}/{mSites.Favicon}"; #region 網頁SEO if (mPages != null) { string imgUrl = "", description = "", author = "", Title = ""; SEOModels pageSEO = null; if (PageSN == "RecruitDetail") //20190516 Nina 徵才需用ID取得SEO { long Id = 0; bool result = long.TryParse(Request.QueryString["ID"], out Id); if (result) { pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title, Id); } } else { pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title); } var siteSEO = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mPages.SiteID); var contentSEO = PagesDAO.GetContentSEO(mPages.SiteID, mPages.MenuID, mPages.No); string typeKeywords = contentSEO.Keywords;//PagesDAO.GetContentTypeKeyword(mPages.SiteID, mPages.MenuID, mPages.No); if (!string.IsNullOrEmpty(mPages.Title)) { ViewBag.SEO_Title = mPages.Title; // 以單頁的先給值 } //先設定頁面的 SEO //若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (pageSEO != null) { string UploadUrl = UpdFileInfo.GetVPathByMenuID(mPages.SiteID, mPages.MenuID).TrimEnd('/') + "/"; if (!string.IsNullOrEmpty(pageSEO.Title)) { ViewBag.SEO_Title = pageSEO.Title; } if (!string.IsNullOrEmpty(pageSEO.Description)) { ViewBag.SEO_Description = pageSEO.Description; } if (!string.IsNullOrEmpty(pageSEO.Author)) { author = pageSEO.Author; } if (!string.IsNullOrEmpty(pageSEO.Copyright)) { ViewBag.SEO_Copyright = pageSEO.Copyright; } if (!string.IsNullOrEmpty(pageSEO.Keywords)) { ViewBag.SEO_Keywords = pageSEO.Keywords; } if (!string.IsNullOrEmpty(pageSEO.Image)) { ViewBag.SEO_Image = UploadUrl + pageSEO.Image; } description = ViewBag.SEO_Description; Title = ViewBag.SEO_Title; } if (contentSEO != null) { if (!string.IsNullOrEmpty(contentSEO.SocialImage)) { ViewBag.SEO_Image = contentSEO.SocialImage; } if (string.IsNullOrEmpty(description) && !string.IsNullOrEmpty(contentSEO.Description)) { ViewBag.SEO_Description = contentSEO.Description; } if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(contentSEO.Title)) { ViewBag.SEO_Title = contentSEO.Title; } if (contentSEO != null && !string.IsNullOrEmpty(contentSEO.Author)) { author = author.Trim(';') + ";" + contentSEO.Author; } } imgUrl = ViewBag.SEO_Image; ViewBag.SEO_Keywords = typeKeywords; //以SITE SEO 先給值, 若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (siteSEO != null) { if (!string.IsNullOrEmpty(siteSEO.Title) && string.IsNullOrEmpty(ViewBag.SEO_Title)) { ViewBag.SEO_Title = siteSEO.Title; } if (!string.IsNullOrEmpty(siteSEO.Description) && string.IsNullOrEmpty(ViewBag.SEO_Description)) { ViewBag.SEO_Description = siteSEO.Description; } if (!string.IsNullOrEmpty(siteSEO.Author)) { author = author.Trim(';') + ";" + siteSEO.Author; } if (!string.IsNullOrEmpty(siteSEO.Copyright) && string.IsNullOrEmpty(ViewBag.SEO_Copyright)) { ViewBag.SEO_Copyright = siteSEO.Copyright; } if (!string.IsNullOrEmpty(siteSEO.Keywords)) { ViewBag.SEO_Keywords += (string.IsNullOrEmpty(ViewBag.SEO_Keywords) ? "" : ";") + siteSEO.Keywords; } WorkV3.Areas.Backend.Models.SocialSettingModels siteSocialSetting = WorkV3.Areas.Backend.Models.DataAccess.SocialSettingDAO.GetItem(mPages.SiteID); if (siteSocialSetting != null && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { if (string.IsNullOrEmpty(imgUrl) && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { string customImageFolder = "SocialImage"; WorkV3.Models.ImageModel imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(siteSocialSetting.SocialDefaultImage); string UploadUrl = UpdFileInfo.GetVPathBySiteID(mPages.SiteID, customImageFolder).TrimEnd('/') + "/"; ViewBag.SEO_Image = UploadUrl + imgModel.Img; } } } ViewBag.SEO_Author = author.Trim(';'); } #endregion } #region GA List <SitesModels.GAInfoCont> GA = new List <SitesModels.GAInfoCont>(); if (!string.IsNullOrEmpty(mSites.GAInfo)) { GA = JsonConvert.DeserializeObject <List <SitesModels.GAInfoCont> >(mSites.GAInfo); } ViewBag.GA = GA; #endregion } ViewBag.SiteSN = SiteSN; ViewBag.PageSN = PageSN; ViewBag.Id = id; PageCache.SetTempDataPageCache(TempData, pageCache); ViewBag.CustomCont = LoadCustomCont(pageCache); if (PageisExist == true) { if (ShowStatus == 3) { Response.Redirect(Url.Action("PageNotFound", "ErrorPages")); } else { #region 網頁點擊LOG long?memberID = null; WorkV3.Common.Member curUser = WorkV3.Common.Member.Current; if (curUser != null) { memberID = curUser.ID; } string referUrl = "", referUrlTitle = "", referrerUrlPageNo = ""; if (Request.UrlReferrer != null) { referUrl = Request.UrlReferrer.AbsoluteUri; if (referUrl.StartsWith(WorkLib.uUrl.GetURL())) { if (referUrl.Split('/').Length > 0) { string pageSN = referUrl.Split('/')[referUrl.Split('/').Length - 1]; Models.PagesModels pageInfo = Models.DataAccess.PagesDAO.GetPageInfo(pageCache.SiteID, pageSN); if (pageInfo != null) { referUrlTitle = pageInfo.Title; referrerUrlPageNo = pageInfo.No.ToString(); } else { Models.MenusModels menuInfo = Models.DataAccess.MenusDAO.GetInfo(pageCache.SiteID, pageSN); if (menuInfo != null) { referUrlTitle = menuInfo.Title; referrerUrlPageNo = menuInfo.Id.ToString(); } } } } } AddPageLog((long)pageCache.PageNO, mSites.Lang, 3, mSites.Id, getSessionID(), memberID, referUrl, referUrlTitle, referrerUrlPageNo); #endregion return(View()); } } else { //客製start string DefaultWebSite = Request.Url.AbsoluteUri; if (DefaultWebSite.Contains("webdemo") || DefaultWebSite.Contains("localhost")) { string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != null) { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } } else { DefaultWebSite = DefaultWebSite.Replace("www.", "").Replace("http://", "").Replace(".com.tw/", ""); if (DefaultWebSite == "nhmc") { DefaultWebSite = "NewHopeMarketing"; } else if (DefaultWebSite == "edec") { DefaultWebSite = "ELITEDREAM"; } Response.Redirect("~/w/" + DefaultWebSite + "/index"); } //客製end } return(View("EmptyPage")); }
public ActionResult IndexWithoutLayout(string SiteSN, string PageSN, long?id, string lay = "") { PageCache pageCache = new PageCache(); bool PageisExist = false; byte ShowStatus = 3; SitesModels mSites = SitesDAO.GetSiteInfo(SiteSN); if (mSites != null) { ViewBag.SiteID = mSites.Id; PagesModels mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { pageCache.SiteID = mPages.SiteID; pageCache.MenuID = mPages.MenuID; pageCache.PageNO = mPages.No; pageCache.PageSN = mPages.SN; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; MenusModels mMenus = MenusDAO.GetInfo(mPages.SiteID, mPages.MenuID); if (mMenus != null) { ShowStatus = mMenus.ShowStatus; } if (ShowStatus != 3) { ShowStatus = mPages.ShowStatus; } PageisExist = true; ViewBag.PageNo = mPages.No; ViewBag.Title = mPages.Title; ViewBag.SiteName = mSites.Title; #region 網頁SEO wei 20180914 對集點 if (mPages != null) { string imgUrl = "", description = "", author = "", Title = ""; var pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title); var siteSEO = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mPages.SiteID); var contentSEO = PagesDAO.GetContentSEO(mPages.SiteID, mPages.MenuID, mPages.No); string typeKeywords = contentSEO.Keywords;//PagesDAO.GetContentTypeKeyword(mPages.SiteID, mPages.MenuID, mPages.No); if (!string.IsNullOrEmpty(mPages.Title)) { ViewBag.SEO_Title = mPages.Title; // 以單頁的先給值 } //先設定頁面的 SEO //若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (pageSEO != null) { string UploadUrl = UpdFileInfo.GetVPathByMenuID(mPages.SiteID, mPages.MenuID).TrimEnd('/') + "/"; if (!string.IsNullOrEmpty(pageSEO.Title)) { ViewBag.SEO_Title = pageSEO.Title; } if (!string.IsNullOrEmpty(pageSEO.Description)) { ViewBag.SEO_Description = pageSEO.Description; } if (!string.IsNullOrEmpty(pageSEO.Author)) { author = pageSEO.Author; } if (!string.IsNullOrEmpty(pageSEO.Copyright)) { ViewBag.SEO_Copyright = pageSEO.Copyright; } if (!string.IsNullOrEmpty(pageSEO.Keywords)) { ViewBag.SEO_Keywords = pageSEO.Keywords; } if (!string.IsNullOrEmpty(pageSEO.Image)) { ViewBag.SEO_Image = UploadUrl + pageSEO.Image; } description = ViewBag.SEO_Description; Title = ViewBag.SEO_Title; } if (contentSEO != null) { if (!string.IsNullOrEmpty(contentSEO.SocialImage)) { ViewBag.SEO_Image = contentSEO.SocialImage; } if (string.IsNullOrEmpty(description) && !string.IsNullOrEmpty(contentSEO.Description)) { ViewBag.SEO_Description = contentSEO.Description; } if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(contentSEO.Title)) { ViewBag.SEO_Title = contentSEO.Title; } if (contentSEO != null && !string.IsNullOrEmpty(contentSEO.Author)) { author = author.Trim(';') + ";" + contentSEO.Author; } } imgUrl = ViewBag.SEO_Image; ViewBag.SEO_Keywords = typeKeywords; //以SITE SEO 先給值, 若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (siteSEO != null) { if (!string.IsNullOrEmpty(siteSEO.Title) && string.IsNullOrEmpty(ViewBag.SEO_Title)) { ViewBag.SEO_Title = siteSEO.Title; } if (!string.IsNullOrEmpty(siteSEO.Description) && string.IsNullOrEmpty(ViewBag.SEO_Description)) { ViewBag.SEO_Description = siteSEO.Description; } if (!string.IsNullOrEmpty(siteSEO.Author)) { author = author.Trim(';') + ";" + siteSEO.Author; } if (!string.IsNullOrEmpty(siteSEO.Copyright) && string.IsNullOrEmpty(ViewBag.SEO_Copyright)) { ViewBag.SEO_Copyright = siteSEO.Copyright; } if (!string.IsNullOrEmpty(siteSEO.Keywords)) { ViewBag.SEO_Keywords += (string.IsNullOrEmpty(ViewBag.SEO_Keywords) ? "" : ";") + siteSEO.Keywords; } WorkV3.Areas.Backend.Models.SocialSettingModels siteSocialSetting = WorkV3.Areas.Backend.Models.DataAccess.SocialSettingDAO.GetItem(mPages.SiteID); if (siteSocialSetting != null && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { if (string.IsNullOrEmpty(imgUrl) && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { string customImageFolder = "SocialImage"; WorkV3.Models.ImageModel imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(siteSocialSetting.SocialDefaultImage); string UploadUrl = UpdFileInfo.GetVPathBySiteID(mPages.SiteID, customImageFolder).TrimEnd('/') + "/"; ViewBag.SEO_Image = UploadUrl + imgModel.Img; } } } ViewBag.SEO_Author = author.Trim(';'); } #endregion } #region GA List <SitesModels.GAInfoCont> GA = new List <SitesModels.GAInfoCont>(); if (!string.IsNullOrEmpty(mSites.GAInfo)) { GA = JsonConvert.DeserializeObject <List <SitesModels.GAInfoCont> >(mSites.GAInfo); } ViewBag.GA = GA; #endregion } PageCache.SetTempDataPageCache(TempData, pageCache); ViewBag.SiteSN = SiteSN; ViewBag.PageSN = PageSN; ViewBag.Id = id; ViewBag.CustomCont = LoadCustomCont(pageCache); if (PageisExist == true) { if (ShowStatus == 3) { Response.Redirect(Url.Action("PageNotFound", "ErrorPages")); } else { #region 網頁點擊LOG long?memberID = null; WorkV3.Common.Member curUser = WorkV3.Common.Member.Current; if (curUser != null) { memberID = curUser.ID; } string referUrl = "", referUrlTitle = "", referrerUrlPageNo = ""; if (Request.UrlReferrer != null) { referUrl = Request.UrlReferrer.AbsoluteUri; if (referUrl.StartsWith(WorkLib.uUrl.GetURL())) { if (referUrl.Split('/').Length > 0) { string pageSN = referUrl.Split('/')[referUrl.Split('/').Length - 1]; Models.PagesModels pageInfo = Models.DataAccess.PagesDAO.GetPageInfo(pageCache.SiteID, pageSN); if (pageInfo != null) { referUrlTitle = pageInfo.Title; referrerUrlPageNo = pageInfo.No.ToString(); } else { Models.MenusModels menuInfo = Models.DataAccess.MenusDAO.GetInfo(pageCache.SiteID, pageSN); if (menuInfo != null) { referUrlTitle = menuInfo.Title; referrerUrlPageNo = menuInfo.Id.ToString(); } } } } } AddPageLog((long)pageCache.PageNO, mSites.Lang, 3, mSites.Id, getSessionID(), memberID, referUrl, referUrlTitle, referrerUrlPageNo); #endregion ViewBag.lay = null; if (lay != "") { ViewBag.lay = lay; } return(View()); } } else { string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != "") { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } } return(View("EmptyPage")); }
public ActionResult Index(CardsModels model, string key, string type, long?typeId, int?index) { ViewBag.SiteID = model.SiteID; long menuId = CardsDAO.GetMenuID(model.No); ViewBag.Menu = MenusDAO.GetInfo(model.SiteID, menuId); ViewBag.SitePage = CardsDAO.GetPage((long)MenusDAO.GetFirstCardNo(menuId, "Article")); SitePage page = CardsDAO.GetPage(model.No); ArticleSettingModels setting = ArticleSettingDAO.GetItem(menuId); #region 文章列表是否限制會員觀看 if (setting.ReadMode == 1 && !string.IsNullOrWhiteSpace(setting.ReadModeSet)) { Member curUser = Member.Current; string IdentityName = ""; //限制身分的名稱 IEnumerable <Areas.Backend.Models.CategoryModels> listReadModeCategorie = Areas.Backend.Models.DataAccess.CategoryDAO.GetItems(IdentityType, setting.ReadModeSet); foreach (var readModeList in listReadModeCategorie) { IdentityName += readModeList.Title + "、"; } IdentityName = IdentityName.TrimEnd('、'); ViewBag.IdentityName = IdentityName; if (curUser == null) { ViewBag.CheckReadMode = false; ViewBag.IsLogin = false; } else { bool checkReadMode = ArticleDAO.ListCheckReadMode(curUser.ID, IdentityType, listReadModeCategorie); if (!checkReadMode) { ViewBag.CheckReadMode = false; } } } #endregion if (setting.PagingMode == "不分頁") { setting.PageSize = int.MaxValue; } IEnumerable <ArticleTypesModels> types = ArticleTypesDAO.GetItems(menuId); if (setting.Types != "all") { IEnumerable <long> allowTypeIds = setting.GetTypes(); types = types.Where(t => allowTypeIds.Contains(t.ID)); setting.Types = string.Join(",", types.Select(t => t.ID)); } ViewBag.Types = types; int pageIndex = index ?? 1; int totalRecord; IEnumerable <ArticleModels> items = ArticleDAO.GetItems(setting, key, type, typeId, pageIndex, out totalRecord); ViewBag.ItemTypes = ArticleDAO.GetItemTypes(items.Select(item => item.ID)); ViewBag.ItemPages = CardsDAO.GetPages(items.Select(item => item.CardNo)); ViewBag.UploadUrl = UpdFileInfo.GetVPathByMenuID(model.SiteID, menuId).TrimEnd('/') + "/"; ViewBag.Pagination = new Pagination { PageSize = setting.PageSize, PageIndex = pageIndex, TotalRecord = totalRecord }; ViewBag.Setting = setting; ViewBag.Type = type; int style = model.StylesID == 0 ? 1 : model.StylesID; // style = 6; return(View("ListStyle" + style, items)); }