Exemple #1
0
        public ActionResult SiderBar()
        {
            List <Menu> backendMenu = new List <Menu>();

            if ((Session[WebInfo.SysMemSkey] == null ? null : (Request.Cookies["sessionId"] != null ? MemberDAO.Current(Request.Cookies["sessionId"].Value) : null)) == null)
            {
                ViewBag.BackendMenu = backendMenu;
                return(HttpNotFound());

                //return View();
            }
            if (MemberDAO.SysCurrent != null)
            {
                if (PageCache.SiteID == 0)
                {
                    backendMenu         = BackendMenuDAO.GetManagerRoots().ToList();
                    ViewBag.BackendMenu = backendMenu;
                    return(View("Backend/SiderBar"));
                }
                else
                {
                    long               SiteID = PageCache.SiteID;
                    MemberModels       mem    = MemberDAO.SysCurrent;
                    List <MenusModels> mm     = MenusDAO.GetData(SiteID);
                    backendMenu         = BackendMenuDAO.GetRoots(SiteID).ToList();
                    ViewBag.SiteID      = SiteID;
                    ViewBag.MenuList    = mm;
                    ViewBag.BackendMenu = backendMenu;

                    return(View("Backend/SiderBar", new { SiteId = SiteID }));
                }
            }
            ViewBag.BackendMenu = backendMenu;
            return(View());
        }
        public ActionResult PermissionSetting(long ID)
        {
            IEnumerable <WorkV3.Models.SitesModels>    sites        = WorkV3.Models.DataAccess.SitesDAO.GetDatas();
            List <ViewModels.GroupPermissionViewModel> siteMenuList = new List <ViewModels.GroupPermissionViewModel>();

            foreach (WorkV3.Models.SitesModels site in sites)
            {
                siteMenuList.Add(new ViewModels.GroupPermissionViewModel {
                    SiteID = site.Id, menus = BackendMenuDAO.GetRoots(site.Id)
                });
            }

            long siteId = PageCache.SiteID;
            //IEnumerable<BackendMenuModel> rootMenu = BackendMenuDAO.GetRoots();
            //string jsonResult = JsonConvert.SerializeObject(siteMenuList);
            GroupModels group = GroupDAO.GetItem(ID, siteId);

            ViewBag.BodyClass = "body-admin-main";
            ViewBag.Group     = group;
            ViewBag.RootMenu  = siteMenuList;
            ViewBag.SiteID    = siteId;
            //ViewBag.RootMenuJson = jsonResult;
            ViewBag.WebUrl = System.Configuration.ConfigurationManager.AppSettings["WebUrl"].TrimEnd('/');

            return(View());
        }
Exemple #3
0
        // GET: BackEnd
        public ActionResult Index(string SiteSN)
        {
            ViewBag.Member    = Session[WebInfo.SysMemSkey] == null ?null:(Request.Cookies["sessionId"] != null? MemberDAO.Current(Request.Cookies["sessionId"].Value): null);
            ViewBag.UploadUrl = uploadUrl;
            if (ViewBag.Member != null)
            {
                WorkV3.Models.SitesModels SiteItem = WorkV3.Models.DataAccess.SitesDAO.GetSiteInfo(SiteSN);
                if (SiteItem != null)
                {
                    MemberModels mem = MemberDAO.SysCurrent;

                    PageCache.SiteID   = SiteItem.Id;
                    PageCache.SiteName = SiteItem.Title;
                    ViewBag.SiteSN     = SiteSN;
                    ViewBag.SiteID     = PageCache.SiteID;
                    ViewBag.SiteName   = PageCache.SiteName;
                    List <MenusModels> mm = MenusDAO.GetData(PageCache.SiteID);

                    long                  siteId      = PageCache.SiteID;
                    List <Menu>           backendMenu = BackendMenuDAO.GetRoots(siteId).ToList();
                    List <CardsViewModel> cards       = CardsDAO.GetBySiteID(PageCache.SiteID);
                    MemberModels          curUser     = ViewBag.Member;
                    GroupModels           group       = ViewBag.Member == null ? new GroupModels() : GroupDAO.GetItem(curUser.GroupId, siteId);

                    ViewBag.MenuList    = mm;
                    ViewBag.Cards       = cards;
                    ViewBag.CardTypes   = CardsTypeDAO.GetData();
                    ViewBag.BackendMenu = backendMenu;
                    ViewBag.Permissions = group.GetPermissions(siteId);
                }
                else
                {
                    Response.Redirect(Url.Action("Sites"));
                }
                return(View());
            }
            else
            {
                Response.Redirect(Url.Action("Login"));
                return(View());
            }
        }