Esempio n. 1
0
        public Mandant GetCurrentMandant()
        {
            var currentApplicationMode = GetCurrentApplicationModeInternal();

            if (currentApplicationMode != ApplicationMode.Mandant)
            {
                throw new InvalidOperationException("ApplicationMode ist nich Mandant!");
            }

            if (SelectedMandantId.HasValue)
            {
                var mandant = mandantenService.GetMandantById(SelectedMandantId.Value);
                if (mandant != null)
                {
                    var mandantRoles = identityCacheService.GetRoleMandator(mandant.MandantName, ActiveUserName);
                    if (mandantRoles.Any())
                    {
                        return(mandant);
                    }
                }
            }

            var currentMandant = GetCurrentUserMandanten().First();

            SetCurrentMandant(currentMandant.Id);

            return(currentMandant);
        }
Esempio n. 2
0
 public List <UserRole> GetRoleMandator(string mandantname, string username)
 {
     return(GetCached(string.Format("GetRoleMandator_{0}_{1}", mandantname, username), () => roleService.GetRoleMandator(mandantname, username)));
 }