Exemplo n.º 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());
        }
Exemplo n.º 2
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());
            }
        }