예제 #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();
            }
        }
예제 #2
0
        public Festivalier Insert(int JourId, int nbr_personne, string Nom, string Prenom, String Login, string Pwd, Double somme, int FestivalId, int nbr_Jour, int coefficient)
        {
            FestivalierDAO festivalierDAO = new FestivalierDAO();
            TarifDAO       tarifDAO       = new TarifDAO();
            Tarif          tarif          = new Tarif();
            Festivalier    festivalier    = new Festivalier();

            tarif = tarifDAO.valeur_tarif(JourId, coefficient);

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

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

                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();

                festivalier = festivalierDAO.Display_One_Festivalier_Login(Login, FestivalId);

                return(festivalier);
            }
        }