Esempio n. 1
0
        public static bool verifierUniciteNumDossier(string n)
        {
            if (n.Equals("") || n.Trim(' ').Equals(""))
            {
                MessageBox.Show("N° de dossier obligatoire !!");
                return(false);
            }
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "select * from Table_patient where num_dossier='" + n + "'";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    MessageBox.Show("N° de dossier déja existant !!");
                    return(false);
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public static void persistPatient(Patient p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            DateTime      d   = DateTime.Today;
            string        tab = "Table_patient(nom,prenom,num_dossier,cin,tel,date_naissance,adresse,prenom_mari,nom_mari,ddr,groupage,dpa,date_ajout,bilan,assurance)";
            string        v   = "values('" + p.Nom + "','" + p.Prenom + "','" + p.NumDossier + "','" + p.Cin + "','" + p.Tel + "','" + p.DateNaissance.Date + "','" + p.Adresse + "','" + p.PrenomMari + "','" + p.NomMari + "','" + p.DDR.Date + "','" + p.Groupage + "','" + p.DPA + "','" + p.DateAjoute.Date + "','" + p.Description + "','" + p.Assurance + "')";
            string        q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                Patient pa = Patient.getPatient(p.Cin);
                tab        = "dossier_patient(id_patient,nom,prenom,date_creation,date_modification,num_dossier)";
                v          = "values(" + Convert.ToInt32(pa.Id) + ",'" + pa.Nom + "','" + pa.Prenom + "','" + d.Date + "','" + d.Date + "','" + pa.NumDossier + "')";
                q          = "insert into " + tab + " " + v;
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("Ajout du patient avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
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. 4
0
        public static Echographie getEcho(string id)
        {
            Echographie   p = new Echographie();
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from echographie where id=" + Convert.ToInt32(id) + "";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        p.DateEchographie        = (DateTime)dataReader["date_echo"];
                        p.DescriptionEchographie = dataReader["Description"].ToString();
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(p);
        }
Esempio n. 5
0
        public static void ModifyEchographie(Echographie p)
        {
            DateTime      da = DateTime.Today;
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            string        q = "update echographie set date_echo='" + p.DateEchographie.Date + "',Description='" + p.DescriptionEchographie + "' where id=" + Convert.ToInt32(p.Id);

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                command.ExecuteNonQuery();
                command.Dispose();
                q       = "update dossier_patient set date_modification='" + da.Date + "' where id=" + Convert.ToInt32(p.IdDossier);
                command = new SqlCommand(q, c);
                command.ExecuteNonQuery();
                command.Dispose();
                c.Close();
                MessageBox.Show("Modification avec succès");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 6
0
        public static bool Exist(string mois, DateTime d)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "select * from RapportJournalier where mois='" + mois + "' and date_creation = '" + d.Date + "'";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        return(true);
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(false);
        }
Esempio n. 7
0
        public static string getPatientCin(string id)
        {
            string        cin;
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from Table_patient where id=" + Convert.ToInt32(id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        cin = dataReader["cin"].ToString();
                        return(cin);
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 8
0
        public static string getIdDossier(string id_patient)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from dossier_patient where id_patient=" + Convert.ToInt32(id_patient) + "";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        return(dataReader["id"].ToString());
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 9
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. 10
0
        public static void persistRDV(RDVS p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            DateTime      t = DateTime.Today.Date;

            if (p.Date.Date < t)
            {
                MessageBox.Show("Impossible de réserver dans le :" + p.Date.ToString());
                throw new Exception();
            }
            string tab = "rdv(id_patient,date,heure,duree,heure_fin,type_rdv,description,nom_patient,prenom_patient,statut)";
            string v   = "values(" + Convert.ToInt32(p.IdPatient) + ",'" + p.Date.Date + "','" + p.Heure + "','" + p.Duree + "','" + p.HeureFin + "','" + p.TypeRDV + "','" + p.Description + "','" + p.NomPatient + "','" + p.PrenomPatient + "','" + p.Statut + "')";
            string q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("RDV ajouté avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 11
0
        public static void deletePatient(Patient p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "delete from Table_patient where id=" + Convert.ToInt32(p.Id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                q          = "delete from RDV where id_patient=" + Convert.ToInt32(p.Id);
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                c.Close();
                MessageBox.Show("Patient supprimé");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 12
0
        public static void ModifyPatient(Patient p)
        {
            DateTime      da = DateTime.Today;
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            DateTime      d = p.DateNaissance;
            string        q = "update Table_patient set nom='" + p.Nom + "',prenom='" + p.Prenom + "',num_dossier='" + p.NumDossier + "',cin='" + p.Cin + "',tel='" + p.Tel + "',date_naissance='" + p.DateNaissance.Date + "',adresse='" + p.Adresse + "',prenom_mari='" + p.PrenomMari + "',nom_mari='" + p.NomMari + "',ddr='" + p.DDR.Date + "',groupage='" + p.Groupage + "',dpa='" + p.DPA.Date + "',date_ajout='" + p.DateAjoute.Date + "',bilan='" + p.Description + "',assurance='" + p.Assurance + "' 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 num_dossier='" + p.NumDossier + "',nom='" + p.Nom + "',prenom='" + p.Prenom + "',date_modification='" + da.Date + "' where id_patient=" + Convert.ToInt32(p.Id);
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                q          = "update rdv set nom_patient='" + p.Nom + "',prenom_patient='" + p.Prenom + "' where id_patient=" + Convert.ToInt32(p.Id);
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                c.Close();
                MessageBox.Show("Modification avec succès");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 13
0
        public static CPN getCPN(string id)
        {
            CPN           p = new CPN();
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from cpn where id=" + Convert.ToInt32(id) + "";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        p.Type                  = dataReader["type"].ToString();
                        p.BilanAvant            = dataReader["bilan"].ToString();
                        p.Inscription           = dataReader["inscription"].ToString();
                        p.Medicalise            = dataReader["medicalise"].ToString();
                        p.Risque                = dataReader["risque"].ToString();
                        p.Metrorragie           = dataReader["metrorragie"].ToString();
                        p.HTA                   = dataReader["hta"].ToString();
                        p.Anemie                = dataReader["anemie"].ToString();
                        p.Diabete               = dataReader["diabete"].ToString();
                        p.Cardiopathie          = dataReader["cardiopathie"].ToString();
                        p.Infection             = dataReader["infection"].ToString();
                        p.Autre                 = dataReader["autres"].ToString();
                        p.DescriptionAutre      = dataReader["description_autre"].ToString();
                        p.DescriptionGAR        = dataReader["description_referee"].ToString();
                        p.Fer                   = dataReader["fer"].ToString();
                        p.VitamineD             = dataReader["vitamine_d"].ToString();
                        p.Bilan                 = dataReader["bilan_g"].ToString();
                        p.DateCPN               = (DateTime)dataReader["date_cpn"];
                        p.CauseMedicalise       = dataReader["description_medical"].ToString();
                        p.DescriptionBilanAvant = dataReader["bilan_description"].ToString();
                        p.GestionGAR            = dataReader["gestionGAR"].ToString();
                        p.MoisPatiente          = dataReader["mois_trim"].ToString();
                        return(p);
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 14
0
        public static bool RDVIsFree(RDVS d, string idd)
        {
            RDVS p = new RDVS();
            int  t1, t2, t1comp, t2comp;

            string[] dd = d.Heure.Split(':');
            t1 = (Convert.ToInt32(dd[0]) * 60) + Convert.ToInt32(dd[1]);
            string[] hh = d.HeureFin.Split(':');
            t2 = (Convert.ToInt32(hh[0]) * 60) + Convert.ToInt32(hh[1]);
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from rdv where date='" + d.Date.Date + "' and statut='En attente' and id != " + Convert.ToInt32(idd);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        p.Heure    = dataReader["heure"].ToString();
                        p.HeureFin = dataReader["heure_fin"].ToString();
                        string[] dd1 = p.Heure.Split(':');
                        t1comp = (Convert.ToInt32(dd1[0]) * 60) + Convert.ToInt32(dd1[1]);
                        string[] hh1 = p.HeureFin.Split(':');
                        t2comp = (Convert.ToInt32(hh1[0]) * 60) + Convert.ToInt32(hh1[1]);
                        if ((t1 >= t1comp && t1 <= t2comp) || (t2 >= t1comp && t2 <= t2comp) || (t1 <= t1comp && t2 >= t2comp))
                        {
                            MessageBox.Show("Rendez-vous déjà pris !! Veuillez choisir une autre heure");
                            return(false);
                        }
                        else if (t2 >= 930)
                        {
                            MessageBox.Show("Rendez-vous dépasse le temps réglementaire !! Veuillez choisir une autre heure");
                            return(false);
                        }
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(true);
        }
Esempio n. 15
0
        public static CPoN getCPoN(string id)
        {
            CPoN          p = new CPoN();
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from cpon where id=" + Convert.ToInt32(id) + "";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        p.DateEffectiveAccouchement = (DateTime)dataReader["date_reel_accouchement"];
                        p.Deces                = dataReader["deces"].ToString();
                        p.TypeConsultation     = dataReader["type_consultation"].ToString();
                        p.Complication         = dataReader["complication"].ToString();
                        p.Hemorragie           = dataReader["hemorragie"].ToString();
                        p.Infection            = dataReader["infection"].ToString();
                        p.Eclampsie            = dataReader["eclampsie"].ToString();
                        p.Phlebite             = dataReader["phlebite"].ToString();
                        p.Mammaire             = dataReader["mammaire"].ToString();
                        p.Anemie               = dataReader["anemie"].ToString();
                        p.Autre                = dataReader["autre"].ToString();
                        p.TypeLieuAccouchement = dataReader["type_lieu_accouchement"].ToString();
                        p.Fer = dataReader["fer"].ToString();
                        p.DateConsultation = (DateTime)dataReader["date_consultation"];
                        p.BilanGeneral     = dataReader["bilan_g"].ToString();
                        p.DescriptionAutre = dataReader["description_autre"].ToString();
                        p.DescriptionGestionComplication = dataReader["description_referee"].ToString();
                        p.LieuAccouchement            = dataReader["description_lieu"].ToString();
                        p.DescriptionTypeConsultation = dataReader["description_type_autre"].ToString();
                        p.GestionComplication         = dataReader["gestion_complication"].ToString();
                        p.NomConsultation             = dataReader["nom_consulation"].ToString();
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(p);
        }
Esempio n. 16
0
        public static Patient getPatient(string n)
        {
            Patient       p = new Patient();
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "Select * from Table_patient where cin='" + n + "'";

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if (dataReader.HasRows)
                    {
                        p.Id            = dataReader["id"].ToString();
                        p.Nom           = dataReader["nom"].ToString();
                        p.Prenom        = dataReader["prenom"].ToString();
                        p.NumDossier    = dataReader["num_dossier"].ToString();
                        p.Cin           = dataReader["cin"].ToString();
                        p.Tel           = dataReader["tel"].ToString();
                        p.DateNaissance = Convert.ToDateTime(dataReader["date_naissance"].ToString());
                        p.Adresse       = dataReader["adresse"].ToString();
                        p.PrenomMari    = dataReader["prenom_mari"].ToString();
                        p.NomMari       = dataReader["nom_mari"].ToString();
                        p.DDR           = Convert.ToDateTime(dataReader["ddr"].ToString());
                        p.Groupage      = dataReader["groupage"].ToString();
                        p.DPA           = Convert.ToDateTime(dataReader["dpa"].ToString());
                        p.DateAjoute    = Convert.ToDateTime(dataReader["date_ajout"].ToString());
                        p.Description   = dataReader["bilan"].ToString();
                        p.Assurance     = dataReader["assurance"].ToString();
                        return(p);
                    }
                }
                dataReader.Close();
                command.Dispose();
                c.Close();
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 17
0
        public static Int32 NombreTotalPatientType(string type)
        {
            Int32         nbre = 0;
            SqlConnection c    = Connexion.connect();
            SqlCommand    command;
            string        q = "select count(*) from rdv where date='" + DateTime.Today.Date + "' and type_rdv like '%" + type + "%'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                nbre    = (Int32)command.ExecuteScalar();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(nbre);
        }
Esempio n. 18
0
        public static Int32 NombreCponGar(string gar, DateTime avant, DateTime apres)
        {
            Int32         nbre = 0;
            SqlConnection c    = Connexion.connect();
            SqlCommand    command;
            string        q = "select count(*) from cpon where gestion_complication='" + gar + "' and date_consultation between '" + avant.Date + "' and '" + apres.Date + "'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                nbre    = (Int32)command.ExecuteScalar();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(nbre);
        }
Esempio n. 19
0
        public static Int32 CpnGarInscription(string gar, DateTime avant, string inscription)
        {
            Int32         nbre = 0;
            SqlConnection c    = Connexion.connect();
            SqlCommand    command;
            string        q = "select count(*) from cpn where gestionGAR='" + gar + "' and date_cpn='" + avant.Date + "' and inscription='" + inscription + "' ";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                nbre    = (Int32)command.ExecuteScalar();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(nbre);
        }
Esempio n. 20
0
        public static Int32 NombreSupplement(string supp, DateTime avant, DateTime apres)
        {
            Int32         nbre = 0;
            SqlConnection c    = Connexion.connect();
            SqlCommand    command;
            string        q = "select count(*) from cpn where " + supp + "='Oui' and date_cpn between '" + avant.Date + "' and '" + apres.Date + "'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                nbre    = (Int32)command.ExecuteScalar();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(nbre);
        }
Esempio n. 21
0
        public static void deleteRapport(string id)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            DateTime      d = DateTime.Today;
            string        q = "delete from rapportJournalier where id=" + Convert.ToInt32(id);

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                command.ExecuteNonQuery();
                command.Dispose();
                MessageBox.Show("Rapport supprimé");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 22
0
        public static DataTable chercherRapportCPN(string critere, string mot)
        {
            DataTable     dt = new DataTable();
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            string        q = "Select * from rapportCPN where " + critere + " like '%" + mot + "%'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.Fill(dt);
                }
                return(dt);
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 23
0
        public static DataTable chercherCPNAvecDate(string critere, string mot, string idDossier, DateTime d)
        {
            DataTable     dt = new DataTable();
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            string        q = "Select * from cpn where " + critere + " like '%" + mot + "%' and date_cpn='" + d.Date + "'  and id_dossier=" + Convert.ToInt32(idDossier);

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.Fill(dt);
                }
                return(dt);
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 24
0
        public static void ModifyCPN(CPN p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "update cpn set type='" + p.Type + "',bilan='" + p.BilanAvant + "',inscription='" + p.Inscription + "',medicalise='" + p.Medicalise + "',risque='" + p.Risque + "',metrorragie='" + p.Metrorragie + "',hta='" + p.HTA + "',anemie='" + p.Anemie + "',diabete='" + p.Diabete + "',cardiopathie='" + p.Cardiopathie + "',infection='" + p.Infection + "',autres='" + p.Autre + "',description_autre='" + p.DescriptionAutre + "',description_referee='" + p.DescriptionGAR + "',fer='" + p.Fer + "',vitamine_d='" + p.VitamineD + "',bilan_g='" + p.Bilan + "',date_cpn='" + p.DateCPN.Date + "',description_medical='" + p.CauseMedicalise + "',bilan_description='" + p.DescriptionBilanAvant + "',gestionGAR='" + p.GestionGAR + "',mois_trim='" + p.MoisPatiente + "' where id=" + Convert.ToInt32(p.Id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("Modification avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 25
0
        public static Int32 NombreCPN3Inscription(string mois, DateTime avant, DateTime apres, string inscription)
        {
            Int32         nbre = 0;
            SqlConnection c    = Connexion.connect();
            SqlCommand    command;
            string        q = "select count(*) from cpn where type='CPN3' and date_cpn between '" + avant.Date + "' and '" + apres.Date + "' and mois_trim='" + mois + "' and inscription='" + inscription + "'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                nbre    = (Int32)command.ExecuteScalar();

                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(nbre);
        }
Esempio n. 26
0
        public static DataTable AfficherCPNDuPatient(string idDossier)
        {
            DataTable     dt = new DataTable();
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            string        q = "Select * from cpn where id_dossier= " + Convert.ToInt32(idDossier) + "";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.Fill(dt);
                }
                return(dt);
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 27
0
        public static DataTable chercherRapportJournalierAvecDate(string critere, string mot, DateTime t)
        {
            DataTable     dt = new DataTable();
            SqlConnection c  = Connexion.connect();
            SqlCommand    command;
            string        q = "Select * from rapportJournalier where " + critere + " like '%" + mot + "%' and date_creation='" + t.Date + "'";

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.Fill(dt);
                }
                return(dt);
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 28
0
        public static void ModifyCPoN(CPoN p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "update cpon set date_reel_accouchement='" + p.DateEffectiveAccouchement.Date + "',deces='" + p.Deces + "',type_consultation='" + p.TypeConsultation + "',complication='" + p.Complication + "',hemorragie='" + p.Hemorragie + "',infection='" + p.Infection + "',eclampsie='" + p.Eclampsie + "',phlebite='" + p.Phlebite + "',mammaire='" + p.Mammaire + "',anemie='" + p.Anemie + "',autre='" + p.Autre + "',type_lieu_accouchement='" + p.TypeLieuAccouchement + "',fer='" + p.Fer + "',date_consultation='" + p.DateConsultation.Date + "',bilan_g='" + p.BilanGeneral + "',description_autre='" + p.DescriptionAutre + "',description_referee='" + p.DescriptionGestionComplication + "',description_lieu='" + p.LieuAccouchement + "',description_type_autre='" + p.DescriptionTypeConsultation + "',gestion_complication='" + p.GestionComplication + "',nom_consulation='" + p.NomConsultation + "' where id=" + Convert.ToInt32(p.Id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("Modification avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 29
0
        public static void deleteAntecedent(string id)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        q = "delete from antecedent where id=" + Convert.ToInt32(id);

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                c.Close();
                MessageBox.Show("Antécédent supprimé");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 30
0
        public static void persistRapport(RapportCPN r)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            DateTime      d   = DateTime.Today;
            string        tab = "rapportCPN(Mois,date_creation,cpn1,cpn2,cpn3_8,cpn3_9,autre_cpn,cpn_medicalise,metrorragie,hta,diabete,cardiopathie,infection,autre_risque,gar_pec,gar_referee,fer,vitamine_d,anemie,cpn2_ni,cpn2_ai,cpn3_8_ni,cpn3_8_ai,cpn3_9_ni,cpn3_9_ai,autre_cpn_ni,autre_cpn_ai)";
            string        v   = "values('" + r.Mois + "','" + r.DateCreation.Date + "'," + Convert.ToInt32(r.NbreCPN1) + "," + Convert.ToInt32(r.NbreCPN2) + "," + Convert.ToInt32(r.NbreCPN3_8) + "," + Convert.ToInt32(r.NbreCPN3_9) + "," + Convert.ToInt32(r.NbreAutreCPN) + "," + Convert.ToInt32(r.NbreCPNMedicalise) + "," + Convert.ToInt32(r.NbreMetrorragie) + "," + Convert.ToInt32(r.NbreHTA) + "," + Convert.ToInt32(r.NbreDiabete) + "," + Convert.ToInt32(r.NbreCardiopathie) + "," + Convert.ToInt32(r.NbreInfection) + "," + Convert.ToInt32(r.NbreAutreRisque) + "," + Convert.ToInt32(r.NbreGarPec) + "," + Convert.ToInt32(r.NbreGarReferee) + "," + Convert.ToInt32(r.NbreFer) + "," + Convert.ToInt32(r.NbreVitamineD) + "," + Convert.ToInt32(r.NbreAnemie) + "," + Convert.ToInt32(r.NbreCpn2Ni) + "," + Convert.ToInt32(r.NbreCpn2Ai) + "," + Convert.ToInt32(r.NbreCPN3_8NI) + "," + Convert.ToInt32(r.NbreCPN3_8AI) + "," + Convert.ToInt32(r.NbreCPN3_9NI) + "," + Convert.ToInt32(r.NbreCPN3_9AI) + "," + Convert.ToInt32(r.NbreAutreCPNNI) + "," + Convert.ToInt32(r.NbreAutreCPNAI) + ")";
            string        q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                command.ExecuteNonQuery();
                command.Dispose();
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }