Exemplo n.º 1
0
        public void Update(int Id, DateTime dateJour, int nbr_personne, string Nom, string Prenom, String Login, string Pwd, Double somme, int FestivalId, int Coefficient)
        {
            int      IdJ;
            JourDAO  jourDAO  = new JourDAO();
            TarifDAO tarifDAO = new TarifDAO();
            Tarif    tarif    = new Tarif();

            IdJ   = jourDAO.Id_Jour(dateJour, FestivalId);
            tarif = tarifDAO.valeur_tarif(IdJ, Coefficient);

            somme = tarif.Montant * tarif.Coefficient * nbr_personne;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string sqlQuery = "Update Festivalier (Id, Nom, Prenom, Login, Pwd, Nb_Participants, Somme, FestivalId) " +
                                  "Values (Id.nextVal, @Nom, @Prenom, @Login, @Pwd, @Nb_Participants, @Somme, @FestiavalId) where Id = " + Id;

                SqlCommand command = new SqlCommand(sqlQuery, connection);

                command.Parameters["@Nom"].Value             = Nom;
                command.Parameters["@Prenom"].Value          = Prenom;
                command.Parameters["@Login"].Value           = Login;
                command.Parameters["@Pwd"].Value             = Pwd;
                command.Parameters["@Nb_Participants"].Value = nbr_personne;
                command.Parameters["@Somme"].Value           = somme;
                command.Parameters["@FestivalId"].Value      = FestivalId;

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
        }
Exemplo n.º 2
0
        public void InsertScene(int FestivalId, string Nom, string Adresse, int Capacite, bool Accessibilite, string lieu, DateTime dateJour, string artiste)
        {
            SceneDAO   sceneDAO   = new SceneDAO();
            LieuDAO    lieuDAO    = new LieuDAO();
            JourDAO    jourDAO    = new JourDAO();
            ArtisteDAO artisteDAO = new ArtisteDAO();
            int        LieuId     = lieuDAO.Return_IdLieu(lieu);
            int        ArtisteId  = artisteDAO.Return_IdArtiste(artiste);
            int        JourId     = jourDAO.Id_Jour(dateJour, FestivalId);


            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string sqlQueryScene = "INSERT INTO Scene (IdS, Nom, Adresse, Capacite, Accessibilite, LieuId) " +
                                       "Values (IdS.NextVal, @Nom, @Adresse, @Capacite, @Accessibilite, @LieuId)";
                string sqlQueryFestivalArtiste = "INSERT INTO Festival_Artiste (Id, FestivalId, ArtisteId, SceneId, JourId) " +
                                                 "Values (Id.NextVal, @FestivalId, @ArtisteId, @SceneId, @JourId)";

                SqlCommand commandScene = new SqlCommand(sqlQueryScene, connection);
                commandScene.Parameters["@Nom"].Value           = Nom;
                commandScene.Parameters["@Adresse"].Value       = Adresse;
                commandScene.Parameters["@Capacite"].Value      = Capacite;
                commandScene.Parameters["@Accessibilite"].Value = Accessibilite;
                commandScene.Parameters["@LieuId"].Value        = LieuId;

                connection.Open();
                commandScene.ExecuteNonQuery();
                int SceneId = sceneDAO.Return_IdScene(Nom);

                SqlCommand commandFestivalArtist = new SqlCommand(sqlQueryFestivalArtiste, connection);
                commandScene.Parameters["@FestivalId"].Value = FestivalId;
                commandScene.Parameters["@ArtisteId"].Value  = ArtisteId;
                commandScene.Parameters["@SceneId"].Value    = SceneId;
                commandScene.Parameters["@JourId"].Value     = JourId;

                commandFestivalArtist.ExecuteNonQuery();
                connection.Close();
            }
        }