public void updateOuder(int id, DAL.TOUD O) { var recordToUpdate = (from C in dc.TOUDs where id == C.Ouderid select C).Single(); recordToUpdate.Naam = O.Naam; recordToUpdate.Voornaam = O.Voornaam; recordToUpdate.TelefoonNr = O.TelefoonNr; recordToUpdate.MutualiteitsNr = O.MutualiteitsNr; recordToUpdate.GebDate = O.GebDate; recordToUpdate.Bloedgroep = O.Bloedgroep; recordToUpdate.Adres = O.Adres; dc.SubmitChanges(); }
public bool GetCompleteOuder(out DAL.TOUD user, string p) { user = new DAL.TOUD(); try { dc.TOUDs.SingleOrDefault(t => t.Voornaam == p); user = (from TOUD in dc.TOUDs where TOUD.Voornaam.Equals(p) select TOUD).Single(); return(true); } catch { return(false); } }
protected void SaveBtn_Click(object sender, ImageClickEventArgs e) { string naam = User.Identity.Name; DAL.TOUD user; DAL.TOUD usertoupdate = new DAL.TOUD(); if (Ouder.GetCompleteOuder(out user, naam)) { usertoupdate.Naam = NaamTxt.Text; usertoupdate.Voornaam = VoornaamTxt.Text; usertoupdate.TelefoonNr = TelTxt.Text; usertoupdate.MutualiteitsNr = int.Parse(MutTxt.Text); usertoupdate.GebDate = DateTime.Parse(GebDatTxt.Text); usertoupdate.Bloedgroep = user.Bloedgroep; Ouder.updatebloedgroep(Convert.ToInt32(user.Bloedgroep), Convert.ToString(BloedgroepTxt.Text)); usertoupdate.Adres = AdresTxt.Text; Ouder.updateOuder(user.Ouderid, usertoupdate); // Response.AppendHeader("Refresh", "0;URL=profiel.aspx"); } /*het onediteerbaar maken van de velden voor deze gebruiker*/ NaamTxt.ReadOnly = true; NaamTxt.BackColor = System.Drawing.SystemColors.GrayText; VoornaamTxt.ReadOnly = true; VoornaamTxt.BackColor = System.Drawing.SystemColors.GrayText; TelTxt.ReadOnly = true; TelTxt.BackColor = System.Drawing.SystemColors.GrayText; MutTxt.ReadOnly = true; MutTxt.BackColor = System.Drawing.SystemColors.GrayText; GebDatTxt.ReadOnly = true; GebDatTxt.BackColor = System.Drawing.SystemColors.GrayText; BloedgroepTxt.ReadOnly = true; BloedgroepTxt.BackColor = System.Drawing.SystemColors.GrayText; GebDatTxt.ReadOnly = true; GebDatTxt.BackColor = System.Drawing.SystemColors.GrayText; AdresTxt.ReadOnly = true; AdresTxt.BackColor = System.Drawing.SystemColors.GrayText; }
protected void SaveBtn_Click(object sender, ImageClickEventArgs e) { string naam = User.Identity.Name; DAL.TOUD user; DAL.TOUD usertoupdate = new DAL.TOUD(); if (Ouder.GetCompleteOuder(out user, naam)) { usertoupdate.Naam = NaamTxt.Text; usertoupdate.Voornaam = VoornaamTxt.Text; usertoupdate.TelefoonNr = TelTxt.Text; usertoupdate.MutualiteitsNr = int.Parse(MutTxt.Text); usertoupdate.GebDate = DateTime.Parse(GebDatTxt.Text); usertoupdate.Bloedgroep = user.Bloedgroep; Ouder.updatebloedgroep(Convert.ToInt32(user.Bloedgroep), Convert.ToString(BloedgroepTxt.Text)); usertoupdate.Adres = AdresTxt.Text; Ouder.updateOuder(user.Ouderid, usertoupdate); Response.AppendHeader("Refresh", "0;URL=profiel.aspx"); } }