public void UpdateKlant(Klant klant) { try { conn.Open(); string insertString = @"update Klant set naam=@klant_naam, adres=@klant_adres, woonplaats=@klant_woonplaats, telefoonnummer=@klant_telefoon, email=@klant_email where klantcode=@klant_id"; MySqlCommand cmd = new MySqlCommand(insertString, conn); MySqlParameter klantNaamParam = new MySqlParameter("@klant_naam", MySqlDbType.VarChar); MySqlParameter klantAdresParam = new MySqlParameter("@klant_adres", MySqlDbType.VarChar); MySqlParameter klantWoonplaatsParam = new MySqlParameter("@klant_woonplaats", MySqlDbType.VarChar); MySqlParameter klantTelefoonParam = new MySqlParameter("@klant_telefoon", MySqlDbType.VarChar); MySqlParameter klantEmailParam = new MySqlParameter("@klant_email", MySqlDbType.VarChar); MySqlParameter klantIdParam = new MySqlParameter("@klant_id", MySqlDbType.VarChar); klantNaamParam.Value = klant.Naam; klantAdresParam.Value = klant.Adres; klantWoonplaatsParam.Value = klant.Woonplaats; klantTelefoonParam.Value = klant.Telefoonnummer; klantEmailParam.Value = klant.Email; klantIdParam.Value = klant.Id; cmd.Parameters.Add(klantNaamParam); cmd.Parameters.Add(klantAdresParam); cmd.Parameters.Add(klantWoonplaatsParam); cmd.Parameters.Add(klantTelefoonParam); cmd.Parameters.Add(klantEmailParam); cmd.Parameters.Add(klantIdParam); cmd.Prepare(); cmd.ExecuteNonQuery(); } catch (Exception e) { Console.Write("Updaten game niet gelukt: " + e); throw e; } finally { conn.Close(); } }
public void InsertCursusInstanties(Klant klant) { throw new NotImplementedException(); }
public ActionResult EIDTest() { Klant klant = new Klant(); if (Request.Form["nl"] == null) { OpenIdRelyingParty openid = new OpenIdRelyingParty(); openid.SecuritySettings.AllowDualPurposeIdentifiers = true; IAuthenticationResponse response = openid.GetResponse(); if (null != response) { if (response.Status == AuthenticationStatus.Authenticated) { ViewBag.Name = "Data Request Complete"; FetchResponse fetchResponse = response.GetExtension<FetchResponse>(); klant.Voornaam = fetchResponse.Attributes["http://axschema.org/namePerson/first"].Values[0]; klant.Naam = fetchResponse.Attributes["http://axschema.org/namePerson/last"].Values[0]; klant.Geslacht = new Geslacht() { Naam = fetchResponse.Attributes["http://axschema.org/person/gender"].Values[0] }; //ID uit DB Halen string input = fetchResponse.Attributes["http://axschema.org/contact/postalAddress/home"].Values[0] ; Match match = Regex.Match(input, @"^(.+)\s(\d+(\s*[^\d\s]+)*)$", RegexOptions.IgnoreCase); if (match.Success) { string[] straat = match.Groups[1].Value.Split('('); klant.Adres = new Adres() { Straat = straat[0], Nummer = match.Groups[2].Value, Postbus = match.Groups[3].Value, Postcode = fetchResponse.Attributes["http://axschema.org/contact/postalCode/home"].Values[0]/*, Gemeente = fetchResponse.Attributes["http://axschema.org/contact/city/home"].Values[0]*/ }; } string birthYear = fetchResponse.Attributes["http://openid.net/schema/birthDate/birthYear"].Values[0]; string birthMonth = fetchResponse.Attributes["http://openid.net/schema/birthDate/birthMonth"].Values[0]; string birthday = fetchResponse.Attributes["http://openid.net/schema/birthDate/birthday"].Values[0]; klant.Geboortedatum = Convert.ToDateTime(birthday + "/" + birthMonth + "/" + birthYear); //////// string base64PhotoSafe = fetchResponse.Attributes["http://axschema.org/eid/photo"].Values[0]; string base64Photo = base64PhotoSafe.Replace('-', '+').Replace('_', '/'); if (base64Photo.Length % 4 > 0) base64Photo = base64Photo.PadRight(base64Photo.Length + 4 - base64Photo.Length % 4, '='); TempData["PhotoURL"] = base64Photo; TempData["Local"] = klant.Adres; klant.Foto = base64Photo; } else { ViewBag.Name = "Autentication failed"; } } else { if (Request.Form["maps"] != null) { Adres add = (Adres)TempData["Local"]; if(add != null) Response.Redirect("http://maps.google.com/maps?q=" + add.Straat + " " + add.Nummer + " " + add.Postcode); } ViewBag.Name = "Not logged in yet."; } } else { OpenIdRelyingParty openid = new OpenIdRelyingParty(); IAuthenticationRequest request = openid.CreateRequest("https://www.e-contract.be/eid-idp/endpoints/openid/ident"); // attribute query FetchRequest fetchRequest = new FetchRequest(); fetchRequest.Attributes.AddRequired("http://axschema.org/namePerson/first"); fetchRequest.Attributes.AddRequired("http://axschema.org/namePerson/last"); fetchRequest.Attributes.AddRequired("http://openid.net/schema/birthDate/birthYear"); fetchRequest.Attributes.AddRequired("http://openid.net/schema/birthDate/birthMonth"); fetchRequest.Attributes.AddRequired("http://openid.net/schema/birthDate/birthday"); fetchRequest.Attributes.AddRequired("http://axschema.org/person/gender"); fetchRequest.Attributes.AddRequired("http://axschema.org/contact/postalAddress/home"); fetchRequest.Attributes.AddRequired("http://axschema.org/contact/postalCode/home"); fetchRequest.Attributes.AddRequired("http://axschema.org/contact/city/home"); fetchRequest.Attributes.AddRequired("http://axschema.org/eid/photo"); request.AddExtension(fetchRequest); // request.RedirectToProvider(); } return View(klant); }