Пример #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 void addPlaceHorizontalementInverse(Panel panel, Zone z)
        {
            Point[]      polygon   = Fonction.convertCoordonnee(z.Coordonnee);
            Point[]      rectangle = Fonction.createRectangle(polygon); //le rectangle mcontenir anle polygone
            GraphicsPath path      = new GraphicsPath();

            path.AddPolygon(polygon);
            int indexFin   = 1;
            int index      = 3;
            int limiteBody = rectangle[2].X;

            int x = rectangle[index].X;
            int y = rectangle[index].Y;
            //maka ny coin anakroa meme coté (tsy opposé)

            int nbPlace = z.NumDepart;     //atao numero depart

            z.Sieges = new List <Seza>();
            while (x > rectangle[indexFin].X && y < rectangle[indexFin].Y)
            {
                x -= (int)z.EspacementCote;
                Point A, B, C, D;     //coins anle sieges
                A  = new Point(x, y);
                x -= (int)z.TailleSeza;
                B  = new Point(x, y);
                C  = new Point(x, B.Y + (int)z.TailleSeza);
                D  = new Point(x + (int)z.TailleSeza, y + (int)z.TailleSeza);
                Point[] place  = { A, B, C, D };
                String  numStr = "" + nbPlace;
                if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D))
                {
                    Seza temp = new Seza(nbPlace, Fonction.convertString(place), 0);
                    z.Sieges.Add(temp);


                    Fonction.drawSeza(panel, place, "Red", numStr);
                    nbPlace++;
                }

                if (x <= limiteBody)
                {
                    x  = rectangle[index].X;
                    y += (int)z.EspacementHaut + (int)z.TailleSeza;
                    ;
                }
            }
            //ETO NO MI-INSERT NY SEZA reetra anle zone ANATY BASE (VITA)
            Fonction  f   = new Fonction();
            DBConnect dbc = new DBConnect();

            f.insertSeza(dbc, z.Sieges, z.Id);
            z.NbPlace = nbPlace;
        }
Пример #3
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);
            }
        }