Esempio n. 1
0
        public PartialViewResult Header()
        {
            long?userId;
            TenantLogosEditDto tenantLogosEditDto = AsyncHelper.RunSync <TenantLogosEditDto>(() => this.GetCurrentTenantLogos());
            long value = (long)0;

            if (base.AbpSession.UserId.HasValue)
            {
                userId = base.AbpSession.UserId;
                value  = userId.Value;
            }
            GetQuickMenuItemsInput getQuickMenuItemsInput = new GetQuickMenuItemsInput()
            {
                OwnerId = new long?(value)
            };
            List <QuickMenuItemListDto> quickMenuItemListDtos = AsyncHelper.RunSync <List <QuickMenuItemListDto> >(() => this._genericAppService.GetQuickMenuItems(getQuickMenuItemsInput));
            HeaderViewModel             headerViewModel       = new HeaderViewModel()
            {
                LoginInformations     = AsyncHelper.RunSync <GetCurrentLoginInformationsOutput>(() => this._sessionAppService.GetCurrentLoginInformations()),
                Languages             = base.LocalizationManager.GetAllLanguages(),
                CurrentLanguage       = base.LocalizationManager.CurrentLanguage,
                IsMultiTenancyEnabled = this._multiTenancyConfig.IsEnabled
            };

            userId = base.AbpSession.ImpersonatorUserId;
            headerViewModel.IsImpersonatedLogin             = userId.HasValue;
            headerViewModel.CurrentTenantHeaderLogoId       = new Guid?((tenantLogosEditDto.HeaderImageId.HasValue ? tenantLogosEditDto.HeaderImageId.Value : Guid.Empty));
            headerViewModel.CurrentTenantHeaderMobileLogoId = new Guid?((tenantLogosEditDto.HeaderMobileImageId.HasValue ? tenantLogosEditDto.HeaderMobileImageId.Value : Guid.Empty));
            headerViewModel.QuickMenuItems = quickMenuItemListDtos;
            return(this.PartialView("_Header", headerViewModel));
        }
Esempio n. 2
0
        public PartialViewResult QuickMenuReload()
        {
            GetQuickMenuItemsInput getQuickMenuItemsInput = new GetQuickMenuItemsInput()
            {
                OwnerId = new long?(base.AbpSession.UserId.Value)
            };
            List <QuickMenuItemListDto> quickMenuItemListDtos = AsyncHelper.RunSync <List <QuickMenuItemListDto> >(() => this._genericAppService.GetQuickMenuItems(getQuickMenuItemsInput));

            return(this.PartialView("_QuickMenu", quickMenuItemListDtos));
        }
Esempio n. 3
0
        public async Task <List <QuickMenuItemListDto> > GetQuickMenuItems(GetQuickMenuItemsInput input)
        {
            long?userId;
            bool value;
            bool flag;
            long?ownerId = input.OwnerId;

            if (ownerId.HasValue)
            {
                ownerId = input.OwnerId;
                if (ownerId.HasValue)
                {
                    ownerId = input.OwnerId;
                    userId  = this.AbpSession.UserId;
                    flag    = (ownerId.GetValueOrDefault() == userId.GetValueOrDefault() ? ownerId.HasValue != userId.HasValue : true);
                    if (!flag)
                    {
                        goto Label0;
                    }
                }
                else
                {
                    goto Label0;
                }
            }
            input.OwnerId = this.AbpSession.UserId;
Label0:
            IQueryable <QuickMenuItem> all = this._quickMenuItemRepository.GetAll();

            userId = input.OwnerId;
            if (!userId.HasValue)
            {
                value = false;
            }
            else
            {
                userId = input.OwnerId;
                value  = userId.Value > (long)0;
            }
            IQueryable <QuickMenuItem> quickMenuItems = all.WhereIf <QuickMenuItem>(value, (QuickMenuItem p) => p.OwnerId == input.OwnerId.Value);
            await quickMenuItems.CountAsync <QuickMenuItem>();

            IQueryable <QuickMenuItem> quickMenuItems1 = quickMenuItems;
            List <QuickMenuItem>       listAsync       = await(
                from o in quickMenuItems1
                orderby o.Label
                select o).ToListAsync <QuickMenuItem>();

            return(new List <QuickMenuItemListDto>(listAsync.MapTo <List <QuickMenuItemListDto> >()));
        }