public ActionResult Submit()
        {
            if (Session["event"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ReserveringViewModel  reservering = (ReserveringViewModel)Session["reservering"];
            ReserveringRepository repo        = new ReserveringRepository(new ReserveringContext());
            AccountRepository     arepo       = new AccountRepository(new AccountContext());
            List <int>            plekids     = reservering.Staanplaatsen.Select(x => x.Id).ToList();

            repo.PlaatsReservering(reservering.Voornaam, reservering.Tussenvoegsel, reservering.Achternaam,
                                   reservering.Straat, reservering.Huisnummer, reservering.Woonplaats, reservering.DatumStart,
                                   reservering.DatumEind, reservering.Evenement.ID1, plekids, reservering.Accounts,
                                   reservering.Exemplaren);

            // Email
            foreach (AccountViewModel account in reservering.Accounts)
            {
                string message = "Beste " + account.Gebruikersnaam + ",<br><br>" +
                                 "Bedankt voor het reserveren bij " + reservering.Evenement.Naam + "<br>" +
                                 "Om uw account te activeren gaat u naar deze link: http://eyectc.com/reserveer/activeer?activatiehash=" + arepo.GetAllAccounts().First(x => x.Gebruikersnaam == account.Gebruikersnaam).Activatiehash + "<br><br>" +
                                 "Groeten,<br><br>" + "Het EyeCT4Events Team";
                SendMail(account.Email, message);
            }

            return(Redirect("/reserveer/success"));
        }
Beispiel #2
0
        private async Task LoadAppResources()
        {
            try
            {
                LocationServiceProxy locationService = (LocationServiceProxy)_container.Resolve <ILocationService>();
                //CardReaderService cardReaderService = (CardReaderService)_container.Resolve<ICardReaderService>();

                //List<MSRReader> readers = await cardReaderService.Connect();

                //string result = string.Empty;

                //foreach (MSRReader reader in readers)
                //{
                //    result += await cardReaderService.ListenForInput(reader);
                //    result += Environment.NewLine;
                //}

                //int length = result.Length;

                //await Task.Delay(2000);
                if (locationService.GetIsInternetConnected())
                {
                    await Task.Delay(2000);

                    Vereniging           vereniging = null;
                    object               VerenigingsId;
                    VerenigingRepository verenigingRepository = (VerenigingRepository)_container.Resolve <IVerenigingRepository>();
                    if (ApplicationData.Current.LocalSettings.Values.TryGetValue("VerenigingsId", out VerenigingsId))
                    {
                        vereniging = await verenigingRepository.GetVerenigingByNummerAsync(VerenigingsId.ToString());
                    }
                    else
                    {
                        Geoposition position = await locationService.GetLocationAsync();

                        vereniging = await verenigingRepository.GetVerenigingByLocatieAsync(position.Coordinate.Point.Position.Longitude, position.Coordinate.Point.Position.Latitude);
                    }

                    while (vereniging == null)
                    {
                    }
                    ;

                    BaanRepository baanRepository = (BaanRepository)_container.Resolve <IBaanRepository>();
                    await baanRepository.GetBanenAsync(vereniging.Id, vereniging.AccommodatieId);

                    ReserveringRepository reserveringRepository = (ReserveringRepository)_container.Resolve <IReserveringRepository>();
                    await reserveringRepository.GetReserveringenAsync();

                    SponsorRepository sponsorRepository = (SponsorRepository)_container.Resolve <ISponsorRepository>();
                    await sponsorRepository.GetSponsorsAsync(vereniging.Id);

                    try
                    {
                        verenigingRepository.UpdateStoreAgentAsync();
                    }
                    catch { }
                }

                await Task.Delay(2000);
            }
            catch (Exception ex)
            {
                string messsage = ex.Message;
                //throw;
            }
        }
Beispiel #3
0
 //Constructor
 public ReserveringController(IConfiguration config)
 {
     context         = new ReserveringMSSQLContext(config.GetConnectionString("DefaultConnection"));
     ReserveringRepo = new ReserveringRepository(context);
 }