Пример #1
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);
        }
Пример #2
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);
            }
        }
Пример #3
0
        public static void persistCPN(CPN p)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            SqlDataReader dataReader;
            string        tab = "cpn(id_dossier,type,bilan,inscription,medicalise,risque,metrorragie,hta,anemie,diabete,cardiopathie,infection,autres,description_autre,description_referee,fer,vitamine_d,bilan_g,date_cpn,description_medical,bilan_description,gestionGAR,mois_trim)";
            string        v   = "values(" + Convert.ToInt32(p.IdDossier) + ",'" + p.Type + "','" + p.BilanAvant + "','" + p.Inscription + "','" + p.Medicalise + "','" + p.Risque + "','" + p.Metrorragie + "','" + p.HTA + "','" + p.Anemie + "','" + p.Diabete + "','" + p.Cardiopathie + "','" + p.Infection + "','" + p.Autre + "','" + p.DescriptionAutre + "','" + p.DescriptionGAR + "','" + p.Fer + "','" + p.VitamineD + "','" + p.Bilan + "','" + p.DateCPN.Date + "','" + p.CauseMedicalise + "','" + p.DescriptionBilanAvant + "','" + p.GestionGAR + "','" + p.MoisPatiente + "')";
            string        q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command    = new SqlCommand(q, c);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                MessageBox.Show("Ajout de CPN avec succès");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }