Exemple #1
0
        public void SetUp()
        {
            this.completePaymentHandler = new CompletePaymentHandler();
            this.cancelPaymentHandler   = new CancelPaymentHandler();

            IntegrationSeed.Method = this.Seed;
            this.Init();

            this.registrationDbContext = Startup.ServiceProvider.GetService(typeof(RegistrationDbContext)) as RegistrationDbContext;
        }
Exemple #2
0
        public static bool IsSuper(string token)
        {
            bool b = false;

            using (var db = new RegistrationDbContext())
            {
                var teacher = db.Teachers.SingleOrDefault(t => t.LoginName == token);
                if (teacher != null)
                {
                    b = teacher.IsSuper;
                }
            }
            return(b);
        }
Exemple #3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            bool   b            = false;
            string currentAdmin = filterContext.HttpContext.Session["admin"] as string;

            using (var db = new RegistrationDbContext())
            {
                var teacher = db.Teachers.SingleOrDefault(t => t.LoginName == currentAdmin);
                if (teacher != null)
                {
                    b = teacher.IsSuper;
                }
            }

            if (!b)
            {
                filterContext.Result = new RedirectResult("~/Home/Quit");
            }
        }
        public static async Task DispatchDomainEventsAsync(this IMediator mediator, RegistrationDbContext ctx)
        {
            var domainEntities = ctx.ChangeTracker
                                 .Entries <Entity <Guid> >() //entity base
                                 .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any());

            var domainEvents = domainEntities
                               .SelectMany(x => x.Entity.DomainEvents)
                               .ToList();

            domainEntities.ToList()
            .ForEach(entity => entity.Entity.ClearDomainEvents());

            var tasks = domainEvents
                        .Select(async(domainEvent) => {
                await mediator.Publish(domainEvent);
            });

            await Task.WhenAll(tasks);
        }
Exemple #5
0
 public CatalogController(RegistrationDbContext ctx)
 {
     context = ctx;
 }
 public GetAccountByLoginHandler(RegistrationDbContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
Exemple #7
0
 public VariantRepository(RegistrationDbContext context)
 {
     _context = context;
 }
 public BrowseScoresEntryTasksQueryHandler(RegistrationDbContext db, IMapper mapper)
 => (_db, _mapper) = (db, mapper);
 public VariantsController(RegistrationDbContext context)
 {
     _variantRepository = new VariantRepository(context);
 }
Exemple #10
0
 public TeacherRepository(RegistrationDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
 public RfidController(RegistrationDbContext context)
 {
     _studentRepository = new StudentRepository(context);
     _variantRepository = new VariantRepository(context);
 }
 public CreateAccountHandler(RegistrationDbContext dbContext, IMapper mapper, IPasswordEncrypter passwordEncrypter) : base(dbContext, mapper)
 {
     PasswordEncrypter = passwordEncrypter ?? throw new ArgumentNullException(nameof(passwordEncrypter));
 }
 public OrganizationRepository(RegistrationDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public DeleteSchoolCommandHandler(IBusPublisher busPublisher, ILogger <DeleteSchoolCommandHandler> logger, RegistrationDbContext db)
 => (_busPublisher, _logger, _db) = (busPublisher, logger, db);
Exemple #15
0
 public UpdateScoresEntryTaskCommandHandler(IBusPublisher busPublisher, ILogger <UpdateScoresEntryTaskCommandHandler> logger, RegistrationDbContext db)
 => (_busPublisher, _logger, _db) = (busPublisher, logger, db);
Exemple #16
0
 public StudentsController(RegistrationDbContext context)
 {
     _context = context;
 }
Exemple #17
0
 public RegistrationRepository(RegistrationDbContext dbContext)
 {
     this._dbContext = dbContext;
 }
 public RegistrationsController(RegistrationDbContext context)
 {
     _context = context;
 }
 public GetSchoolQueryHandler(RegistrationDbContext db, IMapper mapper)
 => (_db, _mapper) = (db, mapper);
 public UserRolesUpdatedEventHandler(RegistrationDbContext db, ILogger <UserRolesUpdatedEventHandler> logger)
 => (_db, _logger) = (db, logger);
Exemple #21
0
 public SignUpRemovedEventHandler(RegistrationDbContext db, ILogger <SignUpRemovedEventHandler> logger)
 => (_db, _logger) = (db, logger);
 private static void SeedData(RegistrationDbContext context)
 {
 }
 public GetCountriesListHandler(RegistrationDbContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
Exemple #24
0
 public CreateParentCommandHandler(IBusPublisher busPublisher, ILogger <CreateParentCommandHandler> logger, RegistrationDbContext db)
 => (_busPublisher, _logger, _db) = (busPublisher, logger, db);
Exemple #25
0
 public BrowseClassesQueryHandler(RegistrationDbContext db, IMapper mapper)
 => (_db, _mapper) = (db, mapper);
 public EventService(RegistrationDbContext context)
 {
     this.context = context;
 }
Exemple #27
0
        public static async Task <Person> FindAsync(List <string> roles, Guid userId, RegistrationDbContext db)
        {
            Person person = null !;

            if (roles.Contains("School Admin") || roles.Contains("Assistant School Admin") ||
                roles.Contains("Teacher"))
            {
                person = await db.Teachers.FirstOrDefaultAsync(x => x.Id == userId);
            }

            if ((person is null) && roles.Contains("Parent"))
            {
                person = await db.Parents.FirstOrDefaultAsync(x => x.Id == userId);
            }

            if ((person is null) && roles.Contains("Student"))
            {
                person = await db.Students.FirstOrDefaultAsync(x => x.Id == userId);
            }

            return(person);
        }
 public GetProvinceListHandler(RegistrationDbContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
 public UpdateStudentCommandHandler(IBusPublisher busPublisher, ILogger <UpdateStudentCommandHandler> logger, RegistrationDbContext db)
 => (_busPublisher, _logger, _db) = (busPublisher, logger, db);
 protected AbsIRequestHandler(RegistrationDbContext dbContext, IMapper mapper)
 {
     DbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     Mapper    = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }