public Inschrijf(entiteiten.Les les) { Title = les.naam; voornaam = new Entry(); voornaam.HorizontalTextAlignment = TextAlignment.Start; voornaam.PlaceholderColor = Color.Gray; voornaam.TextColor = Color.Black; voornaam.Placeholder = "Voornaam"; achternaam = new Entry(); achternaam.HorizontalTextAlignment = TextAlignment.Start; achternaam.PlaceholderColor = Color.Gray; achternaam.TextColor = Color.Black; achternaam.Placeholder = "Achternaam"; straatnaam = new Entry(); straatnaam.HorizontalTextAlignment = TextAlignment.Start; straatnaam.PlaceholderColor = Color.Gray; straatnaam.TextColor = Color.Black; straatnaam.Placeholder = "Straatnaam"; huisnummer = new Entry(); huisnummer.HorizontalTextAlignment = TextAlignment.Start; huisnummer.PlaceholderColor = Color.Gray; huisnummer.TextColor = Color.Black; huisnummer.Keyboard = Keyboard.Numeric; huisnummer.Placeholder = "Huisnr"; geboortedatum_dag = new Entry(); geboortedatum_dag.HorizontalTextAlignment = TextAlignment.Center; geboortedatum_dag.PlaceholderColor = Color.Gray; geboortedatum_dag.TextColor = Color.Black; geboortedatum_dag.Keyboard = Keyboard.Numeric; geboortedatum_dag.Placeholder = "DD"; geboortedatum_maand = new Entry(); geboortedatum_maand.HorizontalTextAlignment = TextAlignment.Center; geboortedatum_maand.PlaceholderColor = Color.Gray; geboortedatum_maand.TextColor = Color.Black; geboortedatum_maand.Keyboard = Keyboard.Numeric; geboortedatum_maand.Placeholder = "MM"; geboortedatum_jaar = new Entry(); geboortedatum_jaar.HorizontalTextAlignment = TextAlignment.Center; geboortedatum_jaar.PlaceholderColor = Color.Gray; geboortedatum_jaar.TextColor = Color.Black; geboortedatum_jaar.Keyboard = Keyboard.Numeric; geboortedatum_jaar.Placeholder = "JJJJ"; postcode = new Entry(); postcode.HorizontalTextAlignment = TextAlignment.Start; postcode.PlaceholderColor = Color.Gray; postcode.TextColor = Color.Black; postcode.Placeholder = "Postcode"; woonplaats = new Entry(); woonplaats.HorizontalTextAlignment = TextAlignment.Start; woonplaats.PlaceholderColor = Color.Gray; woonplaats.TextColor = Color.Black; woonplaats.Placeholder = "Woonplaats"; telefoonnummer = new Entry(); telefoonnummer.HorizontalTextAlignment = TextAlignment.Start; telefoonnummer.PlaceholderColor = Color.Gray; telefoonnummer.TextColor = Color.Black; telefoonnummer.Placeholder = "Telefoonnummer (optioneel)"; telefoonnummer.Keyboard = Keyboard.Numeric; emailadres = new Entry(); emailadres.HorizontalTextAlignment = TextAlignment.Start; emailadres.PlaceholderColor = Color.Gray; emailadres.TextColor = Color.Black; emailadres.Placeholder = "Emailadres"; rekeningnummer = new Entry(); rekeningnummer.HorizontalTextAlignment = TextAlignment.Start; rekeningnummer.PlaceholderColor = Color.Gray; rekeningnummer.TextColor = Color.Black; rekeningnummer.Placeholder = "Rekeningnummer (IBAN)"; rekeninghouder = new Entry(); rekeninghouder.HorizontalTextAlignment = TextAlignment.Start; rekeninghouder.PlaceholderColor = Color.Gray; rekeninghouder.TextColor = Color.Black; rekeninghouder.Placeholder = "Naam rekeninghouder"; geboortedatum = new Label(); geboortedatum.Text = "Geboortedatum"; geboortedatum.HorizontalOptions = LayoutOptions.Start; geboortedatum.TextColor = Color.Black; geboortedatum.VerticalOptions = LayoutOptions.Center; geboortedatum.TextColor = Color.Gray; geboortedatum.FontSize = 17.5; controls.CheckBox machtiging_checkbox = new controls.CheckBox(); machtiging_checkbox.IsChecked = false; machtiging_checkbox.CheckedBackgroundImageSource = "checkbox_background"; machtiging_checkbox.CheckmarkImageSource = "checkbox_check"; machtiging_checkbox.BorderImageSource = "checkbox_border"; machtiging_checkbox.Title = "Hiermee machtig ik L-Joy Dancefactory om per kwartaal automatisch de contributie af te laten schrijven."; controls.CheckBox algemenevoorwaarden_checkbox = new controls.CheckBox(); algemenevoorwaarden_checkbox.IsChecked = false; algemenevoorwaarden_checkbox.CheckedBackgroundImageSource = "checkbox_background"; algemenevoorwaarden_checkbox.CheckmarkImageSource = "checkbox_check"; algemenevoorwaarden_checkbox.BorderImageSource = "checkbox_border"; algemenevoorwaarden_checkbox.Title = "Hiermee verklaar ik akkoord te gaan met de Algemene Voorwaarden van L-Joy dancefactory.*"; controls.CheckBox nieuwsbrief_checkbox = new controls.CheckBox(); nieuwsbrief_checkbox.IsChecked = false; nieuwsbrief_checkbox.CheckedBackgroundImageSource = "checkbox_background"; nieuwsbrief_checkbox.CheckmarkImageSource = "checkbox_check"; nieuwsbrief_checkbox.BorderImageSource = "checkbox_border"; nieuwsbrief_checkbox.Title = "Ik wil de nieuwsbrief en info per email ontvangen."; controls.CheckBox fotofilmmateriaal_checkbox = new controls.CheckBox(); fotofilmmateriaal_checkbox.IsChecked = false; fotofilmmateriaal_checkbox.CheckedBackgroundImageSource = "checkbox_background"; fotofilmmateriaal_checkbox.CheckmarkImageSource = "checkbox_check"; fotofilmmateriaal_checkbox.BorderImageSource = "checkbox_border"; fotofilmmateriaal_checkbox.Title = "Ik geef toestemming voor het maken van foto en filmmateriaal."; btn1 = new Button { Margin = new Thickness(0, 0, 0, 7.5), Text = "Schrijf je in", HorizontalOptions = LayoutOptions.FillAndExpand, FontAttributes = FontAttributes.Bold, FontSize = 14, BackgroundColor = Color.FromHex("#FF4081"), TextColor = Color.White }; btn1.Clicked += async(object sender, EventArgs e) => { if (voornaam.Text == null || achternaam.Text == null || straatnaam.Text == null || huisnummer.Text == null || geboortedatum_dag.Text == null || geboortedatum_maand.Text == null || geboortedatum_jaar.Text == null || postcode.Text == null || woonplaats.Text == null || telefoonnummer.Text == null || emailadres.Text == null || rekeningnummer.Text == null || rekeninghouder.Text == null || "".Equals(voornaam.Text) || "".Equals(achternaam.Text) || "".Equals(straatnaam.Text) || "".Equals(huisnummer.Text) || "".Equals(geboortedatum_dag.Text) || "".Equals(geboortedatum_maand.Text) || "".Equals(geboortedatum_jaar.Text) || "".Equals(postcode.Text) || "".Equals(woonplaats.Text) || "".Equals(telefoonnummer.Text) || "".Equals(emailadres.Text) || "".Equals(rekeningnummer.Text) || "".Equals(rekeninghouder.Text)) { await DisplayAlert("Mislukt!", "Niet alle velden zijn ingevuld.", "Ok"); } else if (!algemenevoorwaarden_checkbox.IsChecked) { await DisplayAlert("Mislukt!", "Om in te schrijven moet u akkoord gaan met de algemene voorwaarden.", "Ok"); } else { popups.laadscherm scherm = new popups.laadscherm(); await Navigation.PushPopupAsync(scherm); await Task.Run(async() => // by putting this Task.Run only the Activity Indicator is shown otherwise its not shown. So we have added this. { RestService con = new RestService(); result = await con.lesToevoegen(helper.Settings.IdSettings, les.lesid); }); if ("0".Equals(result)) { await Task.Run(() => // by putting this Task.Run only the Activity Indicator is shown otherwise its not shown. So we have added this. { email.SendMail email = new email.SendMail(); //Email naar de gebruiker email.EmailVerzenden("U heeft zich ingeschreven!", "U heeft zich succesvol ingeschreven voor " + les.naam + " op " + les.dag + "." + "\r\n" + "Wij verwachten u om " + les.tijdstip + " in de les." + "\r\n" + "\r\n" + "Met vriendelijke groet," + "\r\n" + "L-Joy Dancefactory", emailadres.Text, voornaam.Text); //Email naar l-joy email.EmailVerzenden("Inschrijving", "Voornaam: " + voornaam.Text + "\r\n" + "Achternaam: " + achternaam.Text + "\r\n" + "Straatnaam: " + straatnaam.Text + "\r\n" + "Huisnummer: " + huisnummer.Text + "\r\n" + "Geboortedatum: " + geboortedatum_dag.Text + " - " + geboortedatum_maand.Text + " - " + geboortedatum_jaar.Text + "\r\n" + "Postcode: " + postcode.Text + "\r\n" + "Woonplaats: " + woonplaats.Text + "\r\n" + "Telefoonnummer: " + telefoonnummer.Text + "\r\n" + "Email: " + emailadres.Text + "\r\n" + "Rekeningnummer: " + rekeningnummer.Text + "\r\n" + "Rekeninghouder: " + rekeninghouder.Text + "\r\n" + "Les: " + les.naam + "\r\n" + "Docent: " + les.docent + "\r\n" + "Dag: " + les.dag + "\r\n" + "Tijdstip: " + les.tijdstip + "\r\n" + "Machtiging: " + machtiging_checkbox.IsChecked + "\r\n" + "Info en nieuwsbrief: " + nieuwsbrief_checkbox.IsChecked + "\r\n" + "Fotomateriaal: " + fotofilmmateriaal_checkbox.IsChecked); }); await Navigation.RemovePopupPageAsync(scherm); await DisplayAlert("Gelukt!", "Je hebt je succesvol ingeschreven.", "Ok"); } else { await Navigation.RemovePopupPageAsync(scherm); await DisplayAlert("Mislukt!", "Er is iets fout gegaan, probeer het nog eens.", "Ok"); } } }; algemenevoorwaarden_link.Clicked += (object sender, EventArgs e) => { Navigation.PushPopupAsync(new popups.algemenevoorwaarden()); }; Grid sGrid = new Grid(); sGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(240) }); sGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); sGrid.Children.Add(straatnaam, 0, 0); sGrid.Children.Add(huisnummer, 1, 0); Grid gGrid = new Grid(); gGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(150) }); gGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); gGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); gGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); gGrid.Children.Add(geboortedatum, 0, 0); gGrid.Children.Add(geboortedatum_dag, 1, 0); gGrid.Children.Add(geboortedatum_maand, 2, 0); gGrid.Children.Add(geboortedatum_jaar, 3, 0); Content = new ScrollView { Content = new StackLayout { Margin = new Thickness(10, 10, 10, 10), Children = { new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.FromHex("#FF4081"), Content = new StackLayout{ Children = { new Label { Text = "Persoonlijke gegevens", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.White, FontSize = 18, FontAttributes = FontAttributes.Bold }, new BoxView() { Color = Color.White, HeightRequest = 1 }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { voornaam } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { achternaam } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { sGrid } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { postcode } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { woonplaats } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { telefoonnummer } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { emailadres } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { gGrid } }, HasShadow = true, } } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.FromHex("#FF4081"), Content = new StackLayout{ Children = { new Label { Text = "Bankgegevens", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.White, FontSize = 18, FontAttributes = FontAttributes.Bold }, new BoxView() { Color = Color.White, HeightRequest = 1 }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { rekeningnummer } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { rekeninghouder } }, HasShadow = true, } } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.FromHex("#FF4081"), Content = new StackLayout{ Children = { new Label { Text = "Toestemmingen", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.White, FontSize = 18, FontAttributes = FontAttributes.Bold }, new BoxView() { Color = Color.White, HeightRequest = 1 }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { machtiging_checkbox } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { algemenevoorwaarden_checkbox } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { nieuwsbrief_checkbox } }, HasShadow = true, }, new Frame { Padding = 7.5, CornerRadius = 5, BackgroundColor = Color.White, Content = new StackLayout{ Children = { fotofilmmateriaal_checkbox } }, HasShadow = true, }, new Label { Text = "* verplichte velden ", TextColor = Color.White } } }, HasShadow = true, }, algemenevoorwaarden_link, btn1 } } }; }
private async void formulierMaken() { List <entiteiten.Les> lessen = new List <entiteiten.Les>(); List <controls.CheckBox> checkboxes = new List <controls.CheckBox>(); popups.laadscherm scherm = new popups.laadscherm(); await Navigation.PushPopupAsync(scherm); await Task.Run(async() => { RestService con = new RestService(); lessen = await con.VerkrijgLessen(); }); await Navigation.RemovePopupPageAsync(scherm); Grid grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(60) }); for (int i = 0; i < lessen.Count; i++) { grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(30) }); Label label = new Label { Text = lessen[i].naam + " " + lessen[i].dag + " " + lessen[i].tijdstip, VerticalOptions = LayoutOptions.Center }; controls.CheckBox checkbox = new controls.CheckBox(); checkbox.IsChecked = false; checkbox.CheckedBackgroundImageSource = "checkbox_background"; checkbox.CheckmarkImageSource = "checkbox_check"; checkbox.BorderImageSource = "checkbox_border"; checkbox.Title = ""; checkboxes.Add(checkbox); grid.Children.Add(checkbox, 1, i); grid.Children.Add(label, 0, i); } Content = new StackLayout { Children = { new ScrollView { Content = new StackLayout { Children = { gebruikersnaamLabel, gebruikersnaamEntry, emailLabel, emailEntry, grid, opslaanButton } } } } }; opslaanButton.Clicked += async(object sender, EventArgs e) => { if (!gebruikersnaamEntry.Text.Equals("") || !emailEntry.Text.Equals("")) { scherm = new popups.laadscherm(); await Navigation.PushPopupAsync(scherm); await Task.Run(async() => { RestService restService = new RestService(); var wachtwoord = genereerWachtwoord(); var response = await restService.gebruikerToevoegen(gebruikersnaamEntry.Text, emailEntry.Text, wachtwoord); var id = await restService.VerkrijgId(gebruikersnaamEntry.Text); for (int i = 0; i < lessen.Count; i++) { if (checkboxes[i].IsChecked) { await restService.lesToevoegen(id, lessen[i].lesid); } } if ("Gelukt!".Equals(response)) { email.SendMail email = new email.SendMail(); email.EmailVerzenden("Uw L-Joy account is aangemaakt", "Bedankt voor het aanmelden bij de app van L-Joy Dancefactory! " + "\r\n" + "Wij hebben een account voor u aangemaakt:" + "\r\n" + "\r\n" + "Gebruikersnaam: " + gebruikersnaamEntry.Text + "\r\n" + "Wachtwoord: " + wachtwoord + "\r\n" + "\r\n" + "Wij adviseren om meteen in te loggen met uw wachtwoord. U wordt meteen gevraagd om uw wachtwoord aan te passen." + "\r\n" + "\r\n" + "Met vriendelijke groet," + "\r\n" + "L-Joy Dancefactory", emailEntry.Text, gebruikersnaamEntry.Text); } }); await Navigation.RemovePopupPageAsync(scherm); await DisplayAlert("Gelukt!", "Gebruiker aangemaakt!", "Ok"); } else { await DisplayAlert("Gebruiker toevoegen", "Gebruikersnaam of email is niet ingevuld", "Ok"); } }; }