public BrasserieDal Get()
        {
            BrasserieDal brasserie = new BrasserieDal();

            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = connectionString;
                using (SqlCommand command = con.CreateCommand())
                {
                    command.CommandText = "Select * from Brasserie";
                    con.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            brasserie.brasserieId           = (int)reader["brasserieId"];
                            brasserie.brasseriePresentation = (string)reader["brasseriePresentation"];
                            brasserie.mailInfon             = (string)reader["mailInfon"];
                            brasserie.mailRecrutement       = (string)reader["mailRecrutement"];
                            brasserie.nomBrasserie          = (string)reader["nomBrasserie"];
                        }
                    }
                }
            }
            return(brasserie);
        }
Beispiel #2
0
        public static BrasserieDal GetBrasserieDal(this BrasserieWPF wpf)
        {
            BrasserieDal dal = new BrasserieDal();

            dal.brasserieId           = wpf.brasserieId;
            dal.brasseriePresentation = wpf.brasseriePresentation;
            dal.mailInfon             = wpf.mailInfon;
            dal.mailRecrutement       = wpf.mailRecrutement;
            dal.nomBrasserie          = wpf.nomBrasserie;
            return(dal);
        }
Beispiel #3
0
        public static BrasserieWPF GetBrasserieWPF(this BrasserieDal dal)
        {
            BrasserieWPF wpf = new BrasserieWPF();

            wpf.brasserieId           = dal.brasserieId;
            wpf.brasseriePresentation = dal.brasseriePresentation;
            wpf.mailInfon             = dal.mailInfon;
            wpf.mailRecrutement       = dal.mailRecrutement;
            wpf.nomBrasserie          = dal.nomBrasserie;
            return(wpf);
        }
 public void Update(BrasserieDal parametre)
 {
     using (SqlConnection con = new SqlConnection())
     {
         con.ConnectionString = connectionString;
         using (SqlCommand command = con.CreateCommand())
         {
             command.CommandText = "EditBrasserie";
             command.CommandType = System.Data.CommandType.StoredProcedure;
             command.Parameters.AddWithValue(nameof(parametre.brasserieId), parametre.brasserieId);
             command.Parameters.AddWithValue(nameof(parametre.brasseriePresentation), parametre.brasseriePresentation);
             command.Parameters.AddWithValue("mailIfon", parametre.mailInfon);
             command.Parameters.AddWithValue(nameof(parametre.mailRecrutement), parametre.mailRecrutement);
             command.Parameters.AddWithValue(nameof(parametre.nomBrasserie), parametre.nomBrasserie);
             con.Open();
             command.ExecuteNonQuery();
         }
     }
 }