Esempio n. 1
0
        public static void ModifyAntecedent(Antecedent p)
        {
            DateTime      da = DateTime.Today;
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "update antecedent set g=" + Convert.ToInt32(p.G) + ",description='" + p.DescriptionAntecedent + "',p=" + Convert.ToInt32(p.P) + ",type_accouchement='" + p.TypeAccouchement + "',cause='" + p.Cause + "',medicaux='" + p.Medicaux + "',chirurgicaux='" + p.Chirurgicaux + "',obstetricaux='" + p.Obstetricaux + "' where id=" + Convert.ToInt32(p.Id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                q          = "update dossier_patient set date_modification='" + da.Date + "' where id=" + Convert.ToInt32(p.IdDossier);
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public static void persistAntecedent(Antecedent p)
        {
            DateTime      da = DateTime.Today;
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        tab = "antecedent(id_dossier,g,p,type_accouchement,cause,description,medicaux,chirurgicaux,obstetricaux)";
            string        v   = "values(" + Convert.ToInt32(p.idDossier) + "," + Convert.ToInt32(p.G) + "," + Convert.ToInt32(p.P) + ",'" + p.typeAccouchement + "','" + p.Cause + "','" + p.DescriptionAntecedent + "','" + p.Medicaux + "','" + p.Chirurgicaux + "','" + p.Obstetricaux + "')";
            string        q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                q          = "update dossier_patient set date_modification = '" + da.Date + "' where id = " + Convert.ToInt32(p.IdDossier);
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("Ajout d'antécédent avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        public static Antecedent getAntecedent(string id)
        {
            Antecedent    a = new Antecedent();
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from antecedent where id=" + Convert.ToInt32(id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        a.G = dataReader["g"].ToString();
                        a.P = dataReader["p"].ToString();
                        a.TypeAccouchement      = dataReader["type_accouchement"].ToString();
                        a.Cause                 = dataReader["cause"].ToString();
                        a.Medicaux              = dataReader["medicaux"].ToString();
                        a.Chirurgicaux          = dataReader["chirurgicaux"].ToString();
                        a.Obstetricaux          = dataReader["obstetricaux"].ToString();
                        a.DescriptionAntecedent = dataReader["description"].ToString();
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(a);
        }