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 List <Seza> getAllSeza(DBConnect dbc, string idStade) { SqlDataReader read = null; SqlConnection con = dbc.createConnection(); List <Seza> zones = new List <Seza>(); try { con.Open(); String queryString = "SELECT * from vueSiegesDuStade where idStade='" + idStade + "'"; SqlCommand com = new SqlCommand(queryString, con); read = com.ExecuteReader(); while (read.Read()) { Seza z = new Seza(read.GetString(0), read.GetInt32(1), read.GetInt32(2)); zones.Add(z); } } catch (Exception e) { throw e; } finally { if (read != null) { read.Close(); } } return(zones); }
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; }