예제 #1
0
        private void Butt_Validating_Click(object sender, EventArgs e)
        {
            if (ShareData.modif)
            {
                int id = ShareData.id;


                nom    = TB_Name.Text.Trim();
                prenom = TB_Firstname.Text.Trim();
                age    = Convert.ToInt32(NUD_Age.Value);
                if (date.Date == DateTime.Now.Date)
                {
                    date = DateTime.Now;
                }
                else
                {
                    date = DTP_Naissance.Value;
                }
                email = TB_Email.Text.Trim();
                if (TB_N_National.Text.Trim() == "")
                {
                    N_national = 101;
                }
                else
                {
                    N_national = Convert.ToInt32(TB_N_National.Text.Trim());
                }
                adresse     = TB_Adresse.Text.Trim();
                mc          = CB_MC.Checked;
                bim         = CB_BIM.Checked;
                Fiche_Sante = CB_Fiche_Sante.Checked;
                Allergies   = TB_Allergies.Text.Trim();
                Remarque    = TB_Remarques.Text.Trim();


                _Manager.updateChildren(id, nom, prenom, age, date, email, N_national, adresse, mc, bim, Fiche_Sante, Allergies, Remarque);
            }
            else
            {
                nom    = TB_Name.Text.Trim();
                prenom = TB_Firstname.Text.Trim();
                age    = Convert.ToInt32(NUD_Age.Value);
                if (date.Date == DateTime.Now.Date)
                {
                    date = DateTime.Now;
                }
                else
                {
                    date = DTP_Naissance.Value;
                }
                email = TB_Email.Text.Trim();
                if (TB_N_National.Text.Trim() == "")
                {
                    N_national = 101;
                }
                else
                {
                    N_national = Convert.ToInt32(TB_N_National.Text.Trim());
                }
                adresse     = TB_Adresse.Text.Trim();
                mc          = CB_MC.Checked;
                bim         = CB_BIM.Checked;
                Fiche_Sante = CB_Fiche_Sante.Checked;
                Allergies   = TB_Allergies.Text.Trim();
                Remarque    = TB_Remarques.Text.Trim();

                _Manager.addChildren(nom, prenom, age, date, email, N_national, adresse, mc, bim, Fiche_Sante, Allergies, Remarque);
            }

            ShareData.modif = false;
            this.Close();
        }