Example #1
0
        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());
        }
Example #2
0
 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());
 }
Example #3
0
        public void CheckMenuSNisExist()
        {
            long   SiteID    = GetItem.SiteID();
            string SN        = Request["VSN"];
            bool   isExistSN = MenusDAO.isExistSN(SiteID, SN);

            if (isExistSN)
            {
                Response.Write("NO");
            }
            else
            {
                Response.Write("OK");
            }
        }
Example #4
0
        public void MenuEdit_Sort()
        {
            string items = Request.Form["items"];

            if (string.IsNullOrWhiteSpace(items))
            {
                return;
            }
            long SiteID = GetItem.SiteID();
            JavaScriptSerializer json     = new JavaScriptSerializer();
            List <MenusModels>   menuList = json.Deserialize <List <MenusModels> >(items);

            MenusDAO.UpdateSort(menuList);
            SysLog.SaveLog(SysActions.Sort, SysMgrNo.Menu, "", SiteID, null, null);
        }
Example #5
0
        public ActionResult MenuAdd()
        {
            ViewBag.SiteID = GetItem.SiteID();
            int AreaID = 1;

            if (uCheck.IsNumeric(Request["AreaID"]))
            {
                AreaID = int.Parse(Request["AreaID"].ToString());
            }
            ViewBag.AreaID = AreaID;


            List <CardsTypeModels> CList = CardsTypeDAO.GetData();

            ViewBag.CardsTypeList   = CList.Where(dr => dr.isOpenCreate == true).ToList();
            ViewBag.CardsTypeListD1 = CList.Where(dr => (dr.Types == (int)CardType.Card || dr.Types == (int)CardType.CardSet) && dr.isOpenCreate == true).ToList();
            ViewBag.CardsTypeListD2 = CList.Where(dr => (dr.Types == (int)CardType.ClassMenu) && dr.isOpenCreate == true).ToList();

            return(View());
        }
Example #6
0
        public void GetAddMenuTag(long?id)
        {
            long SiteID = GetItem.SiteID();

            if (uCheck.IsNumeric(id))
            {
                MenusModels mm  = MenusDAO.GetInfo(SiteID, (long)id);
                string      Fmt =
                    "<li class=\"dd-item\" data-id=\"" + mm.ID + "\">" +
                    "<div class=\"dd-handle\">" +
                    "    <i class=\"\"></i>" +
                    "    <span class=\"menu-title\">" + mm.Title + "</span>" +
                    "    <span class=\"icons-box\">" +
                    "	 <i class=\""+ mm.GetShowStatusClass() + "\"></i>" +
                    "	 <a class=\"openEdit\" href=\""+ Url.Action(mm.MenuURLAction, "Menus", new { id = mm.ID, SiteID = mm.SiteID }) + "\" data-height=\"" + mm.MenuiFrameH + "\" data-width=\"" + mm.MenuiFrameW + "\"><i class=\"cc cc-settings\"></i></a>" +
                    "    </span>" +
                    "</div>" +
                    "</li>";
                Response.Write(Fmt);
            }
        }
Example #7
0
        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());
        }