Esempio n. 1
0
 private async Task <IEnumerable <ExclusionDetails> > GetExclusionListAsync(int TeacherId)
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.FetchRecordSetAsync(PrivilegeSQL.SelectExclusion(TeacherId, UserSession.User.Settings.SchoolYear), ExclusionDetails.CreateExclusionDetails));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
        private static async Task <IEnumerable <Exclusion> > LoadUserExclusionsAsync(AppUser user)
        {
            if (user.Role > User.UserRole.Operator)
            {
                return(null);
            }
            Task <IEnumerable <Exclusion> > e = 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;
                    }
                    e = dbs.FetchRecordSetAsync(PrivilegeSQL.SelectExclusion(s.UserID, UserSession.User.Settings.SchoolYear), Exclusion.CreateExclusion);
                }
            }
            return(await e);
        }