public ServiceResult <object> GetAllMenu(Clause clause)
        {
            var userInfo = _userSessionManager.GetUserInfo(clause.Ticket, Request);

            if (userInfo == null)
            {
                return(new ServiceResult <object>(Enumerator.ErrorCode.UserExpired,
                                                  "زمان استفاده از حساب کاربری به پایان رسیده است"));
            }
            var bp   = new BusinessParam(userInfo, clause);
            var data = new List <MenuDto>();

            if (_memoryCache.TryGetValue("Menu_" + bp.UserInfo.RoleId, out data))
            {
                return(new ServiceResult <object>(data, data.Count));
            }

            var myServiceData = MenuFacade.GetInstance().GetAllMenu(bp);

            if (myServiceData.Done)
            {
                data = (List <MenuDto>)myServiceData.Result;
                _memoryCache.Set("Menu_" + bp.UserInfo.RoleId, data,
                                 TimeSpan.FromMinutes(DataLayer.Tools.SystemConfig.MenuCacheTimeMinute));
            }

            return(myServiceData);
        }
        public ServiceResult <object> AutocompleteView(Clause clause)
        {
            var userInfo    = _userSessionManager.GetUserInfo(clause.Ticket, Request);
            var bp          = new BusinessParam(userInfo, clause);
            var checkAccess = _userSessionManager.CheckAccess(bp, ClassDetails[0].Clazz, "autocomplete");

            return(checkAccess.Done
                ? MenuFacade.GetInstance().AutocompleteView(bp)
                : checkAccess);
        }
        public ServiceResult <object> Save()
        {
            var dtoFromRequest = MenuFacade.GetInstance().GetDtoFromRequest(HttpContext.Request);

            if (!dtoFromRequest.Done)
            {
                return(dtoFromRequest);
            }
            var dto         = (MenuDto)dtoFromRequest.Result;
            var userInfo    = _userSessionManager.GetUserInfo(dto.Ticket, Request);
            var bp          = new BusinessParam(userInfo);
            var checkAccess = _userSessionManager.CheckAccess(bp, ClassDetails[0].Clazz,
                                                              dto.EntityId == 0 ? "insert" : "update");

            return(checkAccess.Done ? MenuFacade.GetInstance().Save(bp, dto) : checkAccess);
        }