Пример #1
0
        private void Suivant_Click(object sender, EventArgs e)
        {
            try
            {
                if (listePoint.Count <= 2)
                {
                    throw new Exception("points insuffisants");
                }
                if (NomStade.Text.CompareTo("") == 0)
                {
                    throw new Exception("Ajoutez un nom au stade !");
                }
                // IGENERER-NA ID ILAY STADE
                Fonction  F        = new Fonction();
                DBConnect dbc      = new DBConnect();
                int       idStadee = F.getId(dbc, "stade");
                string    idStade  = "STADE" + idStadee;
                Stade     stade    = new Stade(idStade, NomStade.Text, 0, Fonction.convertString(listePoint.ToArray <Point>()));
                //   ETO N MI-INSERER ANLE STADE
                F.insertStade(dbc, stade);



                CreateZone cz = new CreateZone();
                cz.Stade = stade;
                cz.Show();
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
 public static Stade[] getAllStade(SqlConnection c)
 {
     object[] result  = Fonction.select(c, "stade", null, null);
     Stade[]  reponse = new Stade[result.Length];
     for (int i = 0; i < result.Length; i++)
     {
         reponse[i] = (Stade)result[i];
     }
     return(reponse);
 }
Пример #3
0
        public static Stade getStade(SqlConnection c, String id)
        {
            String        sql        = "SELECT * FROM stadeClass WHERE idStade='" + id + "'";
            SqlCommand    command    = new SqlCommand(sql, c);
            SqlDataReader dataReader = command.ExecuteReader();
            Stade         resultat   = null;
            List <Zone>   zone       = new List <Zone>();

            while (dataReader.Read())
            {
                resultat = new Stade((string)dataReader.GetValue(0), (string)dataReader.GetValue(1), (double)dataReader.GetValue(2), (string)dataReader.GetValue(3));
                zone.Add(new Zone((string)dataReader.GetValue(4), (string)dataReader.GetValue(0), (string)dataReader.GetValue(5), (double)dataReader.GetValue(6), (string)dataReader.GetValue(7)));
            }
            resultat.Zone = zone.ToArray <Zone>();
            dataReader.Close();
            command.Dispose();
            return(resultat);
        }
Пример #4
0
        public void insertStade(DBConnect dbc, Stade stade)
        {
            SqlDataReader read = null;
            SqlConnection con  = dbc.createConnection();

            try
            {
                con.Open();
                String     queryString = "INSERT INTO stade(id,nom,nbPlace,coordonee) VALUES ('" + stade.Id + "','" + stade.Nom + "'," + stade.NbPlace + ",'" + stade.Coordonnee + "')";
                SqlCommand com         = new SqlCommand(queryString, con);
                com.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (read != null)
                {
                    read.Close();
                }
            }
        }