Beispiel #1
0
    protected void SaveBtn_Click(object sender, ImageClickEventArgs e)
    {
        DAL.TKIN kind;
        DAL.TKIN Kindtoupdate = new DAL.TKIN();
        Guid     kindid       = new Guid(Request.QueryString["id"]);

        if (Kind.GetCompleteKind(out kind, kindid))
        {
            Kindtoupdate.Naam     = NaamTxt.Text;
            Kindtoupdate.Voornaam = VoornaamTxt.Text;

            Kindtoupdate.GebDate        = DateTime.Parse(GebDatTxt.Text);
            Kindtoupdate.FkBloedGroepId = kind.FkBloedGroepId;
            Kind.updatebloedgroep(Convert.ToInt32(kind.FkBloedGroepId), Convert.ToString(BloedgroepTxt.Text));
            Kindtoupdate.Adres = AdresTxt.Text;

            Kind.updateKind(kindid, Kindtoupdate);

            // Response.AppendHeader("Refresh", "0;URL=Kindprofiel.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;

        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;
    }
    public void updateKind(Guid Kindid, DAL.TKIN O)
    {
        var recordToUpdate = (from C in dc.TKINs where Kindid == C.KindId select C).Single();

        recordToUpdate.Naam     = O.Naam;
        recordToUpdate.Voornaam = O.Voornaam;
        // recordToUpdate.TelefoonNr = O.TelefoonNr;
        //recordToUpdate.MutualiteitsNr = O.MutualiteitsNr;
        recordToUpdate.GebDate        = O.GebDate;
        recordToUpdate.FkBloedGroepId = O.FkBloedGroepId;
        recordToUpdate.Adres          = O.Adres;
        dc.SubmitChanges();
    }
    public bool GetCompleteKind(out DAL.TKIN kind, Guid KindId)
    {
        kind = new DAL.TKIN();

        try
        {
            dc.TKINs.SingleOrDefault(t => t.KindId == KindId);
            kind = (from TKIN in dc.TKINs where TKIN.KindId.Equals(KindId) select TKIN).Single();
            return(true);
        }
        catch
        {
            return(false);
        }
    }