예제 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                //recuperation inputs formulaire

                if (NomZone.Text.CompareTo("") == 0 || comboBox1.Text.CompareTo("") == 0)
                {
                    throw new Exception("Completez tous les champs");
                }
                if (!Fonction.IsNumeric(textBox1.Text))
                {
                    throw new Exception("le numero de siege de depart doit etre un nombre");
                }
                if (!Fonction.IsNumeric(prixSiege.Text))
                {
                    throw new Exception("le prix de la siege doit etre un nombre");
                }
                string coord = Fonction.convertString(ListePointZone.ToArray <Point>());



                //Récuperer-na ny id anle stade misy anle zone
                String idStade = Stade.Id;
                // Tsy atao sequence ny id anle zone
                Fonction  f       = new Fonction();
                DBConnect dbc     = new DBConnect();
                int       idZonee = f.getId(dbc, "zone");
                string    idZone  = "Z" + idZonee;
                Zone      temp    = new Zone(idZone, NomZone.Text, comboBox1.Text, idStade, 0, coord, (Double)numericUpDown2.Value, (Double)numericUpDown1.Value, (Double)tailleSiege.Value, Int32.Parse(textBox1.Text), Double.Parse(prixSiege.Text));
                //ETO NO INSERER-NA NY ZONE
                f.insertZone(dbc, temp);


                string[] colorSelected = { comboBox1.Text };
                comboBox1.Text = "";
                comboBox1.Items.Clear();
                colors = Fonction.getColorNoSelected(colors, colorSelected);
                foreach (string c in colors)
                {
                    comboBox1.Items.Add(c);
                }
                Zone.Add(temp);
                NomZone.Text = "";
                Stade.Zone   = Zone.ToArray <Zone>();
                ListePointZone.Clear();
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }