Exemple #1
0
        public static Baremes GetOne(Baremes pBareme)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                SqlDataAdapter monAdapter = new SqlDataAdapter();
                DataTable      resultat   = new DataTable();
                SqlParameter   monParametre;

                SqlCommand cmd = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText = " SELECT * " +
                                  " FROM Baremes " +
                                  " WHERE CodeGroupement = @CodeGroupement " +
                                  " AND DateVigueur = @DateVigueur ";

                monParametre = new SqlParameter("@CodeGroupement", pBareme.CodeGroupement);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@DateVigueur", pBareme.DateVigueur);
                cmd.Parameters.Add(monParametre);

                monAdapter.SelectCommand = cmd;
                monAdapter.Fill(resultat);

                return(new Baremes(resultat.Rows[0]));
            }
        }
Exemple #2
0
        public static void AddBareme(Baremes pBareme)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                SqlParameter monParametre;
                string       pNomVaccin  = ADO_Vaccins.getListeVaccins().Find(x => x.CodeVaccin == pBareme.CodeVaccin).NomVaccin;
                string       dateVigueur = DateTime.Now.ToString("dd/MM/yy");
                SqlCommand   cmd         = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText = " exec ajout_bareme @codeGroupement, @dateVigueur, @typeActe, " +
                                  "@libelle, @tarifFixe, @tarifMini, @tarifMaxi, @nomVaccin;";
                monParametre = new SqlParameter("@codeGroupement", pBareme.CodeGroupement);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@dateVigueur", dateVigueur);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@typeActe", pBareme.TypeActe);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@libelle", pBareme.Libelle);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@tarifFixe", pBareme.TarifFixe ?? Convert.DBNull);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@tarifMini", pBareme.TarifMini ?? Convert.DBNull);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@tarifMaxi", pBareme.TarifMaxi ?? Convert.DBNull);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@nomVaccin", pNomVaccin);
                cmd.Parameters.Add(monParametre);

                cmd.ExecuteNonQuery();
            }
        }
Exemple #3
0
        public static void DeleteBareme(Baremes pBareme)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                SqlParameter monParametre;

                SqlCommand cmd = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText = " Delete " +
                                  " FROM Baremes " +
                                  " WHERE CodeGroupement = @CodeGroupement " +
                                  " AND DateVigueur = @DateVigueur ";

                monParametre = new SqlParameter("@CodeGroupement", pBareme.CodeGroupement);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@DateVigueur", pBareme.DateVigueur);
                cmd.Parameters.Add(monParametre);

                cmd.ExecuteNonQuery();
            }
        }