예제 #1
0
        public PartialViewResult TenantCustomCss()
        {
            var tenancyName = _tenancyNameFinder.GetCurrentTenancyNameOrNull();

            if (string.IsNullOrEmpty(tenancyName))
            {
                if (AbpSession.UserId.HasValue)
                {
                    var sessionInfo = AsyncHelper.RunSync(() => _sessionCache.GetCurrentLoginInformationsAsync());
                    return(PartialView("_TenantCustomCss", new TenantCustomCssViewModel
                    {
                        CustomCssId = sessionInfo.Tenant?.CustomCssId
                    }));
                }

                return(PartialView("_TenantCustomCss", new TenantCustomCssViewModel
                {
                    CustomCssId = null
                }));
            }

            using (_unitOfWorkManager.Begin())
            {
                using (_unitOfWorkManager.Current.SetTenantId(null))
                {
                    var tenant = _tenantManager.FindByTenancyName(tenancyName);
                    return(PartialView("_TenantCustomCss", new TenantCustomCssViewModel
                    {
                        CustomCssId = tenant?.CustomCssId
                    }));
                }
            }
        }
예제 #2
0
        public PartialViewResult TenantCustomCss()
        {
            var tenancyName = _tenancyNameFinder.GetCurrentTenancyNameOrNull();

            if (string.IsNullOrEmpty(tenancyName))
            {
                return(PartialView("_TenantCustomCss", new TenantCustomCssViewModel
                {
                    CustomCssId = null
                }));
            }

            using (_unitOfWorkManager.Begin())
            {
                using (_unitOfWorkManager.Current.SetTenantId(null))
                {
                    var tenant = _tenantManager.FindByTenancyName(tenancyName);
                    return(PartialView("_TenantCustomCss", new TenantCustomCssViewModel
                    {
                        CustomCssId = tenant?.CustomCssId
                    }));
                }
            }
        }
예제 #3
0
        public PartialViewResult AppLogo(string appPath, int width = 168, int height = 33)
        {
            ViewBag.TenantCustomLogoWidth  = width;
            ViewBag.TenantCustomLogoHeight = height;

            var tenancyName = _tenancyNameFinder.GetCurrentTenancyNameOrNull();

            if (string.IsNullOrEmpty(tenancyName))
            {
                if (AbpSession.TenantId.HasValue)
                {
                    using (_unitOfWorkManager.Begin())
                    {
                        using (_unitOfWorkManager.Current.SetTenantId(null))
                        {
                            var tenant = _tenantManager.FindById(AbpSession.GetTenantId());
                            SetLogoUrlForTenant(appPath, tenant);
                        }
                    }
                }
                else
                {
                    ViewBag.TenantCustomLogoUrl = appPath + "Common/Images/app-logo-on-light.png";
                }
            }
            else
            {
                using (_unitOfWorkManager.Begin())
                {
                    using (_unitOfWorkManager.Current.SetTenantId(null))
                    {
                        var tenant = _tenantManager.FindByTenancyName(tenancyName);
                        SetLogoUrlForTenant(appPath, tenant);
                    }
                }
            }

            return(PartialView("~/Views/Account/_AppLogo.cshtml"));
        }