예제 #1
0
 private async Task <IEnumerable <Privilege> > GetPrivilegeListAsync(int TeacherId)
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.FetchRecordSetAsync(PrivilegeSQL.SelectPrivilege(TeacherId, UserSession.User.Settings.SchoolYear), Privilege.CreatePrivilege));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        private static async Task <IEnumerable <Privilege> > LoadUserPrivilegesAsync(AppUser user)
        {
            if (user.Role > User.UserRole.Operator)
            {
                return(null);
            }
            Task <IEnumerable <Privilege> > p = default;

            using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
            {
                var dbs = scope.Resolve <IDataBaseService>();
                foreach (var s in user.SchoolTokenList)
                {
                    if (s.UserRole == User.UserRole.Operator)
                    {
                        continue;
                    }
                    p = dbs.FetchRecordSetAsync(PrivilegeSQL.SelectPrivilege(s.UserID, UserSession.User.Settings.SchoolYear), Privilege.CreatePrivilege);
                }
            }
            return(await p);
        }