public static void addPlace(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 index = 0; Point temp = rectangle[index]; //mitady anle coins anaky telo amle rectangle conteneur du polygone for (int i = 1; i < rectangle.Length; i++) // tetezina le points zoronle rectangle { if (rectangle[i].X < temp.X && rectangle[i].Y < temp.Y) //? { index = i; // } } int indexFin = index + 2; if (indexFin > 3) { indexFin = indexFin - 4; } int indexMil = indexFin - 1; if (indexMil < 0) { indexMil = 3; } int x = rectangle[index].X; int y = rectangle[index].Y; //maka ny coin anakroa meme coté (tsy opposé) int nbPlace = 0; 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 += 5; B = new Point(x, y); C = new Point(x, B.Y + 5); D = new Point(x - 5, y + 5); Point[] place = { A, B, C, D }; if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D)) { Fonction.drawFigure(panel, place, "Red"); nbPlace++; } if (x >= rectangle[indexMil].X) { x = rectangle[index].X; y += (int)z.EspacementHaut + 5; } } z.NbPlace = nbPlace; }
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); } }
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(); } } }
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(); } } }
private void panelClick(object senders, EventArgs e) { Point p = panel1.PointToClient(Cursor.Position); listePoint.Add(p); Fonction.drawPoint(this.panel1, p); }
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); }
public AfficherStade() { InitializeComponent(); panel1.BackColor = Color.White; //mtest ny database kely loa DBConnect dbc = new DBConnect(); Fonction F = new Fonction(); int nbSiegeactuelle = F.getId(dbc, "Siege"); textBox1.Text = "" + nbSiegeactuelle; }
private void button1_Click(object sender, EventArgs e) { Zone[] z = Stade.Zone; if (z != null) { for (int i = 0; i < z.Length; i++) { Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee); Fonction.drawFigure(panel1, p, z[i].Couleur); } } }
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; }
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); } }
public CreateZone() { InitializeComponent(); panel1.BackColor = Color.White; panel1.Click += new EventHandler(this.panelClick); string[] propList = Fonction.getAllColor(); string[] selected = { "Red" }; propList = Fonction.getColorNoSelected(propList, selected); colors = propList; foreach (string c in propList) { comboBox1.Items.Add(c); } }
private void button1_Click(object sender, EventArgs e) { label1.Text = "Nom du stade : " + Stade.Nom; Point[] coord = Fonction.convertCoordonnee(Stade.Coordonnee); Fonction.drawFigure(panel1, coord, "Red"); Zone[] z = Stade.Zone; for (int i = 0; i < z.Length; i++) { Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee); Fonction.drawFigure(panel1, p, z[i].Couleur); DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone(); row.Cells[0].Value = z[i].Designation; row.Cells[1].Style.BackColor = Color.FromName(z[i].Couleur); dataGridView1.Rows.Add(row); } }
private void button2_Click(object sender, EventArgs e) { panel1.Invalidate(); string coord = Stade.Coordonnee; Fonction.drawFigure(this.panel1, Fonction.convertCoordonnee(coord), "Red"); Zone[] z = Stade.Zone; if (z != null) { for (int i = 0; i < z.Length; i++) { Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee); Fonction.drawFigure(panel1, p, z[i].Couleur); } } }
public static void addPlaceVerticalementNormale(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 = 0; int index = 2; int limiteBody = rectangle[1].Y; int x = rectangle[index].X; int y = rectangle[index].Y; // int nbPlace = 0; while (x < rectangle[indexFin].X && y < rectangle[indexFin].Y) { y += (int)z.EspacementHaut; Point A, B, C, D; //coins anle sieges A = new Point(x, y); x += 1; B = new Point(x, y); C = new Point(x, B.Y + 5); D = new Point(x - 5, y + 5); Point[] place = { A, B, C, D }; if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D)) { Fonction.drawFigure(panel, place, "Red"); nbPlace++; } if (y >= limiteBody) { y = rectangle[index].Y; x += (int)z.EspacementCote; } } z.NbPlace = nbPlace; }
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(); } } }
private void Visualiser_Click(object sender, EventArgs e) { Fonction.drawFigure(this.panel1, listePoint.ToArray <Point>(), "Red"); }
private void AfficherStade_Click(object sender, EventArgs e) { string coord = Stade.Coordonnee; Fonction.drawFigure(this.panel1, Fonction.convertCoordonnee(coord), "Red"); }