Пример #1
0
        /// <summary>
        /// Ajoute un nouveau Patient
        /// </summary>
        /// <param name="patient"></param>
        /// <returns></returns>
        public Patient AjoutPatient(Patient patient)
        {
            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                //DateTime Maintenant = DateTime.Now;
                int retour = entity.AjoutPatient(patient.Identifiant, ServiceSecurite.HashMotDePass(patient.MotDePass), patient.Nom, patient.Prenom, patient.DateCreation, patient.DernierModif, 0, patient.AdresseMail, "", ConvertionDate.ConvertionDateTimeVersString(patient.DateNaissance), patient.TelephonePortable, patient.Telephone, patient.Sexe);
                if (retour == -1)
                {
                    throw new CompteException("Le compte exite déjà");
                }
                //Rafraichir();

                //Patient RetourPatient = (from elt in _ListPatient where (elt.IDPatient == retour) select elt).SingleOrDefault();
                //Patient RetourPatient = _ListPatient.SingleOrDefault(p => p.IDPatient == retour);
                Patient RetourPatient = this.VoirPatient(retour);
                RetourPatient.Adresse = new AdresseDAO().AjoutAdresse(RetourPatient.ID, patient);
                return(RetourPatient);
            }
        }