Example #1
0
        public void MenuEdit_Single(MenusModels MData)
        {
            ViewBag.HasChildren = false;
            var childList = MenusDAO.GetChildren(MData.ID);

            if (childList != null && childList.Count() > 0)
            {
                ViewBag.HasChildren = true;
            }
            MenusDAO.Save_Single(MData);
            SysLog.SaveLog(SysActions.Edit, SysMgrNo.Menu, MData.Title, MData.SiteID, MData.ID);
            TempData["refreshData"] = SysActions.Edit;
            Response.Redirect(Request.RawUrl);
        }
Example #2
0
        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());
        }
Example #3
0
        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);
        }