コード例 #1
0
 public QrCodeController(QrCodeService qrCodeservice, BusService busService, UserService userService, RidesService ridesService)
 {
     this.qrCodeService = qrCodeservice;
     this.busService    = busService;
     this.userService   = userService;
     this.ridesService  = ridesService;
 }
コード例 #2
0
        public ActionResult Generate(string message)
        {
            var qrService = new QrCodeService();
            var qrCode    = qrService.CreateQrCode(message);
            var byteArray = ImageToByteArray(qrCode);

            return(File(byteArray, "image/jpeg"));
        }
コード例 #3
0
 public void SetUp()
 {
     productService     = new DefaultProductService();
     distributorService = new DefaultDistributorService();
     qrcodeService      = new DefaultQrCodeService();
     bindingService     = new DefaultBindingService();
     applicationContext = new ApplicationContext();
     applicationContext.ConfigureHibernateMapping();
 }
コード例 #4
0
    public async Task <IActionResult> Add([FromBody] PersonCreationBindingModel bm)
    {
        var person = await _personsRepo.Create(bm.FirstName, bm.LastName, bm.Phone);

        var response = Mapper.Map <PersonViewModel>(person);

        response.QrUrl = QrCodeService.GenerateQrCode(person.Id.ToString());

        return(Created(response));
    }
コード例 #5
0
    public async Task <IActionResult> CheckPerson(string phoneNumber = null)
    {
        var person = await _personsRepo.GetByPhone(phoneNumber);

        if (person == null)
        {
            return(NotFound());
        }

        var response = Mapper.Map <PersonViewModel>(person);

        response.QrUrl = QrCodeService.GenerateQrCode(person.Id.ToString());

        return(Ok(response));
    }
コード例 #6
0
 public RecipesController(IRecipeRepository recipeRepository, QrCodeService qrCodeService)
 {
     this._recipeRepository = recipeRepository;
     this._qrCodeService    = qrCodeService;
 }
コード例 #7
0
 public RecipeQrCodesController(QrMailSender qrMailSender, QrCodeService qrCodeService)
 {
     this._qrMailSender  = qrMailSender;
     this._qrCodeService = qrCodeService;
 }
コード例 #8
0
 public void InitializationQrCodeService()
 {
     _qrCodeService  = new QrCodeService();
     _productBuilder = new ProductBuilder();
 }
コード例 #9
0
    public static void ConfigureMappings(TypeAdapterConfig config)
    {
        config.NewConfig <Seat, SeatViewModel>();

        config.NewConfig <Admin, AdminViewModel>()
        .Map(x => x.Id, y => y.Id.ToString());

        config.NewConfig <Newcomer, NewcomerViewModel>()
        .Map(x => x.Id, y => y.Id.ToString());

        config.NewConfig <Attendee, AttendeeViewModel>()
        .Map(x => x.Id, y => y.Id.ToString())
        .Map(x => x.SeatAssigned, y => y.SeatNumber.HasValue ? y.SeatNumber.Value.ToString() : y.SeatAssigned);

        config.NewConfig <DateSummaryDto, DateSummaryViewModel>()
        .AfterMapping((x, y) => { y.HumanReadableDate = y.Date.ToString("ddd, dd MMM yyyy"); });

        config.NewConfig <Person, BasePersonViewModel>()
        .Map(x => x.Id, y => y.Id.ToString());

        config.NewConfig <Person, PersonViewModel>()
        .Inherits <Person, BasePersonViewModel>()
        .Ignore(x => x.QrUrl)
        .Map(x => x.FullName, y => $"{y.FirstName} {y.LastName}".Trim());

        config.NewConfig <Venue, BaseVenueViewModel>()
        .Map(x => x.Id, y => y.Id.ToString())
        .Map(x => x.NumOfSeats, y => y.Seats.Count);

        config.NewConfig <Venue, VenueViewModel>()
        .Inherits <Venue, BaseVenueViewModel>();

        config.NewConfig <EventSeat, EventSeatViewModel>()
        .Map(x => x.VenueId, y => y.VenueId.ToString());

        config.NewConfig <Event, BaseEventViewModel>()
        .Map(x => x.Id, y => y.Id.ToString())
        .AfterMapping((model, vm) =>
        {
            var sum = model.OnlineAttendance.Count();
            sum    += model.AssignedSeats
                      .Count(x => x.Category == SeatCategory.Single);
            sum += model.AssignedSeats
                   .Count(x => x.Category == SeatCategory.Couples);

            vm.NumOfAttendees = sum;
        });

        config.NewConfig <Event, EventViewModel>()
        .Inherits <Event, BaseEventViewModel>()
        .Map(x => x.DurationInMinutes, y => Convert.ToInt32((y.EndsAt - y.StartsAt).TotalMinutes))
        .Map(x => x.IsRegistrationClosed, y => y.IsRegistrationClosed())
        .AfterMapping((model, vm) =>
        {
            vm.RegistrationUrlQrCode = QrCodeService.GenerateQrCode(model.RegistrationUrl);

            // map seats
            vm.AvailableSeats = model.AvailableSeats
                                .GroupBy(x => x.VenueId)
                                .Select(x =>
            {
                var venueId   = x.Key;
                var venueName = x.First().VenueName;
                var seats     = x.Select(y => new SeatViewModel
                {
                    Category         = y.Category,
                    AssociatedNumber = y.AssociatedNumber,
                    Number           = y.Number
                }).ToList();

                return(new VenueViewModel
                {
                    Id = venueId.ToString(),
                    Name = venueName,
                    NumOfSeats = seats.Count,
                    Seats = seats
                });
            })
                                .ToList();
        });

        config.NewConfig <EventAttendeeDto, EventAttendeeViewModel>();
    }
コード例 #10
0
 public DefaultBindingService()
 {
     productService     = new DefaultProductService();
     distributorService = new DefaultDistributorService();
     qrCodeService      = new DefaultQrCodeService();
 }
コード例 #11
0
 public QrCodeSynchronizer()
 {
     qrCodeService = new DefaultQrCodeService();
 }