Exemple #1
0
        public void insertReservation(DBConnect dbc, string idStade, string idZone, String[] sieges, DateTime date, string idEvent)
        {
            SqlDataReader  read    = null;
            SqlConnection  con     = dbc.createConnection();
            SqlTransaction transac = null;

            try
            {
                //Boolean check = checkSiege(sieges, dbc,idEvent);
                con.Open();
                transac = con.BeginTransaction();
                Fonction f = new Fonction();
                for (int i = 0; i < sieges.Length; i++)
                {
                    String     numSiege    = sieges[i];
                    String     queryString = "INSERT INTO Reservation(id,datereservation,idzone,idStade,numeroSiege,idEvent) VALUES ('" + f.getNextval("sequenceReservation", dbc) + "',@date,'" + idZone + "','" + idStade + "','" + sieges[i] + "','" + idEvent + "')";
                    SqlCommand comm        = new SqlCommand(queryString, con, transac);
                    comm.Parameters.AddWithValue("@date", date.Date);
                    comm.ExecuteNonQuery();
                }
                string     query2 = "Insert into NbReservation(id,nb,date,idEvent) VALUES('" + f.getNextval("sequenceNbReservation", dbc) + "'," + sieges.Length + ",@date,'" + idEvent + "')";
                SqlCommand com    = new SqlCommand(query2, con, transac);
                com.Parameters.AddWithValue("@date", date.Date);
                com.ExecuteNonQuery();
                transac.Commit();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (read != null)
                {
                    read.Close();
                }
            }
        }
Exemple #2
0
        public void insertSeza(DBConnect dbc, List <Seza> sieges, String idZone)
        {
            SqlDataReader  read    = null;
            SqlConnection  con     = dbc.createConnection();
            SqlTransaction transac = null;

            try
            {
                con.Open();
                transac = con.BeginTransaction();
                Fonction f = new Fonction();
                for (int i = 0; i < sieges.Count; i++)
                {
                    Seza       siege       = sieges[i];
                    String     queryString = "INSERT INTO Siege(idSiege,numero,coordonnee,reservation,idZone) VALUES ('" + f.getNextval("sequenceSiege", dbc) + "'," + siege.Numero + ",'" + siege.Coordonee + "',0,'" + idZone + "')";
                    SqlCommand com         = new SqlCommand(queryString, con, transac);
                    com.ExecuteNonQuery();
                }
                transac.Commit();
            }catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (read != null)
                {
                    read.Close();
                }
            }
        }
Exemple #3
0
        public void insertEvenement(DBConnect dbc, DateTime date, string idStade, string nomEvent)
        {
            SqlDataReader  read    = null;
            SqlConnection  con     = dbc.createConnection();
            SqlTransaction transac = null;

            try
            {
                con.Open();
                transac = con.BeginTransaction();
                Fonction f = new Fonction();


                String     queryString = "INSERT INTO evenement(id,idStade,date,nom) VALUES ('" + f.getNextval("sequenceEvenement", dbc) + "','" + idStade + "',@date,'" + nomEvent + "')";
                SqlCommand com         = new SqlCommand(queryString, con, transac);
                com.Parameters.AddWithValue("@date", date.Date);
                com.ExecuteNonQuery();
                transac.Commit();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (read != null)
                {
                    read.Close();
                }
            }
        }