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()); }
public void MenuEdit_Folder(MenusModels MData) { ViewBag.HasChildren = false; var childList = MenusDAO.GetChildren(MData.ID); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } MenusDAO.Save_Folder(MData); SysLog.SaveLog(SysActions.Edit, SysMgrNo.Menu, MData.Title, MData.SiteID, MData.ID); TempData["refreshData"] = SysActions.Edit; Response.Redirect(Request.RawUrl); }
public ActionResult MenuEdit_Folder(long?id) { ViewBag.HasChildren = false; if (uCheck.IsNumeric(id)) { MenusModels mm = MenusDAO.GetInfo(GetItem.SiteID(), (long)id); var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } return(View(mm)); } return(View()); }
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 void MenuEdit_Link(MenusModels MData, string Sites, string[] Pages, string PageDetailID) { ViewBag.HasChildren = false; var childList = MenusDAO.GetChildren(MData.ID); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } MenusDAO.Save_Single(MData); ResourceLinksModels newLink = new ResourceLinksModels(); newLink.Id = 1; newLink.SiteID = MData.SiteID; newLink.SourceNo = MData.ID; newLink.SourceType = (byte)SourceType.Menu; newLink.Ver = 1; newLink.AreaID = 1; bool isOpenNewWin = Request["OpenNewWin"].Contains("true"); if (isOpenNewWin) { newLink.ClickType = (byte)ClickType.OpenNewWin; } else { newLink.ClickType = (byte)ClickType.PageOpen; } //WorkLib.WriteLog.Write(true, Request["inLink"]); if (Request["inLink"].Contains("true")) { newLink.LinkInfo = Request["LinkInfo"].ToString(); newLink.LinkType = ResourceLinkType.inLink; if (!string.IsNullOrEmpty(PageDetailID)) { newLink.Detail = PageDetailID; var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(PageDetailID)); if (pageInfo != null) { var siteInfo = WorkV3.Models.DataAccess.SitesDAO.GetInfo(pageInfo.SiteID); newLink.LinkInfo = Url.RouteUrl("FrontSitePage", new { SiteSN = siteInfo.SN, PageSN = pageInfo.SN }); } } else if (Pages != null) { for (int i = 0; i < Pages.Length; i++) { if (!string.IsNullOrEmpty(Pages[i])) { newLink.Detail = Pages[i]; } } if (!string.IsNullOrEmpty(newLink.Detail)) { var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(newLink.Detail)); if (pageInfo != null) { var siteInfo = WorkV3.Models.DataAccess.SitesDAO.GetInfo(pageInfo.SiteID); newLink.LinkInfo = Url.RouteUrl("FrontSitePage", new { SiteSN = siteInfo.SN, PageSN = pageInfo.SN }); } } } } else { newLink.LinkType = ResourceLinkType.outLink; newLink.LinkInfo = Request["LinkInfo"].ToString(); } ResourceLinksDAO.Save_Menu(newLink); SysLog.SaveLog(SysActions.Edit, SysMgrNo.Menu, MData.Title, MData.SiteID, MData.ID); TempData["refreshData"] = SysActions.Edit; Response.Redirect(Request.RawUrl); }
public ActionResult MenuEdit_Link(long?id) { ViewBag.HasChildren = false; List <long> MenuIDs = new List <long>(); Dictionary <int, WorkV3.Models.MenusModels> MenuList = new Dictionary <int, WorkV3.Models.MenusModels>(); if (uCheck.IsNumeric(id)) { long SiteID = GetItem.SiteID(); MenusModels mm = MenusDAO.GetInfo(GetItem.SiteID(), (long)id); ResourceLinksModels newLink = ResourceLinksDAO.GetInfo(SiteID, (long)id, (byte)SourceType.Menu, 1, 1, 1); ViewBag.LinkInfo = newLink; var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } int menuLev = 0; if (!string.IsNullOrEmpty(newLink.Detail)) { var menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(long.Parse(newLink.Detail)); if (menuInfo != null && !string.IsNullOrEmpty(menuInfo.Title)) { ViewBag.DefaultSiteID = menuInfo.SiteID; menuLev++; MenuList.Add(menuLev, menuInfo); while (menuInfo.ParentID != 0) { menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(menuInfo.ParentID); if (menuInfo != null && !string.IsNullOrEmpty(menuInfo.Title)) { menuLev++; MenuList.Add(menuLev, menuInfo); } else { break; } } } else { var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(newLink.Detail)); if (pageInfo != null && !string.IsNullOrEmpty(pageInfo.Title)) { ViewBag.DefaultSiteID = pageInfo.SiteID; ViewBag.DefaultPageTitle = pageInfo.Title; var page_menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(pageInfo.MenuID); if (page_menuInfo != null) { menuLev++; MenuList.Add(menuLev, page_menuInfo); while (page_menuInfo.ParentID != 0) { page_menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(page_menuInfo.ParentID); if (page_menuInfo != null && !string.IsNullOrEmpty(page_menuInfo.Title)) { menuLev++; MenuList.Add(menuLev, page_menuInfo); } else { break; } } } } } if (MenuList != null && MenuList.Count > 0) { var orderMenus = MenuList.OrderByDescending(p => p.Key).Select(p => p.Value.Id); MenuIDs = orderMenus.ToList(); } ViewBag.DefaultMenus = MenuIDs; } return(View(mm)); } return(View()); }