Ejemplo n.º 1
0
        public void ajouterHotel(clsHotelEntity hotel, clsInfoClient client)
        {
            SqlConnection MyC = new SqlConnection();
            MyC.ConnectionString = Connection;
            MyC.Open();

            SqlCommand MyCom = new SqlCommand("dbo.enregistrerHotel", MyC);
            MyCom.CommandType = CommandType.StoredProcedure;

            MyCom.Parameters.Add("@nomUser", SqlDbType.Text);
            MyCom.Parameters["@nomUser"].Value = client.nomUser;

            MyCom.Parameters.Add("@prenomUser", SqlDbType.Text);
            MyCom.Parameters["@prenomUser"].Value = client.prenomUser;

            MyCom.Parameters.Add("@adresseUser", SqlDbType.Text);
            MyCom.Parameters["@adresseUser"].Value = client.adresseUser;

            MyCom.Parameters.Add("@cpUser", SqlDbType.Int);
            MyCom.Parameters["@cpUser"].Value = client.cpUser;

            MyCom.Parameters.Add("@villeUser", SqlDbType.Text);
            MyCom.Parameters["@villeUser"].Value = client.villeUser;

            MyCom.Parameters.Add("@PAYSUSER", SqlDbType.Text);
            MyCom.Parameters["@PAYSUSER"].Value = client.paysUser;

            MyCom.Parameters.Add("@compteUser", SqlDbType.Text);
            MyCom.Parameters["@compteUser"].Value = client.compteUser;

            MyCom.Parameters.Add("@nomHotel", SqlDbType.Text);
            MyCom.Parameters["@nomHotel"].Value = hotel.nomHotel;

            MyCom.Parameters.Add("@adresseHotel", SqlDbType.Text);
            MyCom.Parameters["@adresseHotel"].Value = hotel.adresseHotel;

            MyCom.Parameters.Add("@cpHotel", SqlDbType.Int);
            MyCom.Parameters["@cpHotel"].Value = hotel.cpHotel;

            MyCom.Parameters.Add("@villeHotel", SqlDbType.Text);
            MyCom.Parameters["@VilleHotel"].Value = hotel.villeHotel;

            MyCom.Parameters.Add("@paysHotel", SqlDbType.Text);
            MyCom.Parameters["@paysHotel"].Value = hotel.paysHotel;

            MyCom.Parameters.Add("@dateArriveeHotel", SqlDbType.Date);
            MyCom.Parameters["@dateArriveeHotel"].Value = hotel.dateArrivee;

            MyCom.Parameters.Add("@dureeSejour", SqlDbType.Int);
            MyCom.Parameters["@dureeSejour"].Value = hotel.duree;

            MyCom.Parameters.Add("@prixHotel", SqlDbType.Int);
            MyCom.Parameters["@prixHotel"].Value = hotel.prixNuit;

            MyCom.ExecuteScalar();

            MyCom.Dispose();
            MyC.Close();
        }
Ejemplo n.º 2
0
        public void ajouterVol(clsVolEntity vol, clsInfoClient client)
        {
            SqlConnection MyC = new SqlConnection();
            MyC.ConnectionString = Connection;
            MyC.Open();

            SqlCommand MyCom = new SqlCommand("dbo.enregistrerVol", MyC);
            MyCom.CommandType = CommandType.StoredProcedure;

            MyCom.Parameters.Add("@nomUser", SqlDbType.Text);
            MyCom.Parameters["@nomUser"].Value = client.nomUser;

            MyCom.Parameters.Add("@prenomUser", SqlDbType.Text);
            MyCom.Parameters["@prenomUser"].Value = client.prenomUser;

            MyCom.Parameters.Add("@adresseUser", SqlDbType.Text);
            MyCom.Parameters["@adresseUser"].Value = client.adresseUser;

            MyCom.Parameters.Add("@cpUser", SqlDbType.Int);
            MyCom.Parameters["@cpUser"].Value = client.cpUser;

            MyCom.Parameters.Add("@villeUser", SqlDbType.Text);
            MyCom.Parameters["@villeUser"].Value = client.villeUser;

            MyCom.Parameters.Add("@paysUser", SqlDbType.Text);
            MyCom.Parameters["@paysUser"].Value = client.paysUser;

            MyCom.Parameters.Add("@compteUser", SqlDbType.Text);
            MyCom.Parameters["@compteUser"].Value = client.compteUser;

            MyCom.Parameters.Add("@villeDepartVol", SqlDbType.Text);
            MyCom.Parameters["@villeDepartVol"].Value = vol.villeDepart;

            MyCom.Parameters.Add("@paysDepartVol", SqlDbType.Text);
            MyCom.Parameters["@paysDepartVol"].Value = vol.paysDepart;

            MyCom.Parameters.Add("@villeDestinationVol", SqlDbType.Text);
            MyCom.Parameters["@villeDestinationVol"].Value = vol.villeDestination;

            MyCom.Parameters.Add("@paysDestinationVol", SqlDbType.Text);
            MyCom.Parameters["@paysDestinationVol"].Value = vol.paysDestination;

            MyCom.Parameters.Add("@dateDepartVol", SqlDbType.Date);
            MyCom.Parameters["@dateDepartVol"].Value = vol.dateDepart;

            MyCom.Parameters.Add("@prixVol", SqlDbType.Int);
            MyCom.Parameters["@prixVol"].Value = vol.prixVol;

            MyCom.ExecuteScalar();

            MyCom.Dispose();
            MyC.Close();
        }
Ejemplo n.º 3
0
 public bool ajouterCommande(clsHotelEntity hotel, clsVolEntity vol, clsInfoClient client)
 {
     bool R = true;
     try
     {
         (new clsEnregistrerHotel()).ajouterHotel(hotel, client);
         (new clsEnregistrerVol()).ajouterVol(vol, client);
     }
     catch(SqlException e)
     {
         Console.WriteLine(e);
         R = false;
     }
     return R;
 }
Ejemplo n.º 4
0
        protected void Button_valider_Click(object sender, EventArgs e)
        {
            // vol.nom
            // Donnée à envoyer
            string nom = txtNom.Text;
            string prenom = txtPrenom.Text;
            string age = txtAge.Text;
            string nationalite = txtNationalite.Text;
            string ville = txtVille.Text;
            string adresse = txtAdresse.Text;
            string tel = txtTelephone.Text;
            string numCarte = txtNumCarte.Text;
            string crypto = txtCryptogramme.Text;
            // date d'expiration de la carte
            DateTime dateExp = new DateTime(Convert.ToInt32(drpAnneeExpiration.SelectedValue),
                Convert.ToInt32(drpMoisExpiration.SelectedValue),  1);

            // Verification de remplissable des champs
            if (!String.IsNullOrEmpty(nom) && !String.IsNullOrEmpty(prenom) &&
                !String.IsNullOrEmpty(age) && !String.IsNullOrEmpty(nationalite) &&
                !String.IsNullOrEmpty(ville) && !String.IsNullOrEmpty(txtCp.Text) &&
                !String.IsNullOrEmpty(adresse) && !String.IsNullOrEmpty(tel)&&
                !String.IsNullOrEmpty(numCarte) && !String.IsNullOrEmpty(crypto)
                && dateExp != null)
            {
                // Informations client
                clsInfoClient client = new clsInfoClient();
                client.nomUser = nom;
                client.prenomUser = prenom;
                client.age = age;
                client.paysUser = nationalite;
                client.villeUser = ville;
                client.cpUser = Convert.ToInt32(txtCp.Text);
                client.adresseUser = adresse;
                client.tel = tel;
                client.compteUser = numCarte + ' ' + crypto;
                client.dateExp = dateExp;

                // Recuperation du vol et de l'hotel
                clsVolEntity vol = new clsVolEntity();
                clsHotelEntity hotel = new clsHotelEntity();
                vol = (clsVolEntity) Session["vol"];
                hotel = (clsHotelEntity) Session["hotel"];
                vol.infoClient = client;
                hotel.infoClient = client;

                // Ajout a la file d'attente
                MessageQueue mqVols = new MessageQueue(@".\private$\cmdvols");
                MessageQueue mqHotels = new MessageQueue(@".\private$\cmdhotels");
                mqVols.Send(vol, "Commande vol");
                mqHotels.Send(hotel, "Commande hotel");
                mqVols.Close();
                mqHotels.Close();
                Response.Redirect("UICommandeValidee.aspx");
            }
            else
            {
                lblError.Text = "Veuillez remplir les champs !";
                lblError.Visible = true;
            }
        }