public RegVuelos(ref ListaVuelos listavuelos, ref ListaCiudades listaciudades) { InitializeComponent(); this.listavuelos = listavuelos; this.listaciudades = listaciudades; dateTimePicker1.Format = DateTimePickerFormat.Short; dateTimePicker2.Format = DateTimePickerFormat.Time; dateTimePicker2.ShowUpDown = true; }
public UsuariosLista(ref ListaVuelos listaVuelos) { InitializeComponent(); button_buscar.Enabled = false; VueloId = 0; button1.Enabled = false; this.listaVuelos = listaVuelos; refreshListview(); // if (userList.Items.Count <= 0) // { // button1.Enabled = false; // } }
public List <ResponseVuelos> BusquedaListaVuelos(RequestVuelos oRequestVuelos) { List <ResponseVuelos> oResponseVuelos = new List <ResponseVuelos>(); ListaVuelos oListaVuelos = new ListaVuelos(); oListaVuelos = new ListaVuelosDA().BusquedaListaVuelos(oRequestVuelos); foreach (Vuelos oVuelos in oListaVuelos) { string PaisOrigen = BuscaPais(oVuelos.CodPaisOrigen); string PaisDestino = BuscaPais(oVuelos.CodPaisDestino); string Escalas = Escala(oVuelos.CantEscalas); string Equipaje = (oVuelos.Equipaje == true) ? "SI" : "NO"; oResponseVuelos.Add(new ResponseVuelos { PaisOrigen = PaisOrigen, PaisDestino = PaisDestino, Escalas = Escalas, Equipaje = Equipaje, FechaSalida = oVuelos.FechaSalida, FechaRetorno = oVuelos.FechaRetorno, Precio = oVuelos.Precio }); } return(oResponseVuelos); }
public ListaVuelos BusquedaListaVuelos(RequestVuelos oRequestVuelos) { ListaVuelos ListaVuelos = new ListaVuelos(); try { if (VariablesPublicas.ListaVuelos.ToList().Count > 0) { ListaVuelos.AddRange((from q in VariablesPublicas.ListaVuelos where q.CantEscalas == oRequestVuelos.CantidadEscalas && q.Equipaje == oRequestVuelos.Equipaje && q.Precio == oRequestVuelos.Precio select q).ToList()); } } catch (Exception ex) { throw ex; } return(ListaVuelos); }
public VuelosLista(ref ListaVuelos listaVuelos,ref ListaCiudades listaciudades) { InitializeComponent(); Buscar.Enabled = false; this.listaVuelos = listaVuelos; this.listaciudades = listaciudades; Button_delete.Enabled = false; int index = 0; foreach(Vuelo v in listaVuelos) { string[] datav = v.ToString('|').Split('|'); ListViewItem dv = new ListViewItem(datav); dv.SubItems.Add(index.ToString()); listView1.Items.Add(dv); index++; } }
public GrafoVisual(ref ListaCiudades listaciudades, ref ListaVuelos listaVuelos) { InitializeComponent(); checkBoxCosto.Checked = true; this.listaVuelos = listaVuelos; buttonDelete.Enabled = false; this.listaciudades = listaciudades; refreshListView(); pictureBox1.Image = new Bitmap(pictureBox1.Image); buttonDijk.Enabled = false; g = Graphics.FromImage(pictureBox1.Image); g.SmoothingMode = SmoothingMode.AntiAlias; // The smoothing mode specifies whether lines, curves, and the edges of filled areas use smoothing (also called antialiasing). One exception is that path gradient brushes do not obey the smoothing mode. Areas filled using a PathGradientBrush are rendered the same way (aliased) regardless of the SmoothingMode property. g.InterpolationMode = InterpolationMode.HighQualityBicubic; // The interpolation mode determines how intermediate values between two endpoints are calculated. g.PixelOffsetMode = PixelOffsetMode.HighQuality; // Use this property to specify either higher quality, slower rendering, or lower quality, faster rendering of the contents of this Graphics object. g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; penarrow.StartCap = LineCap.ArrowAnchor; penarrow.EndCap = LineCap.ArrowAnchor; foreach (CiudadNodo c in listaciudades) { comboBox1.Items.Add(c.name); comboBox2.Items.Add(c.name); g.DrawEllipse(pen1, c.X, c.Y, 10, 10); g.DrawString(c.getName(), new Font("Tahoma", 8),Brushes.White,c.X,c.Y); foreach (AristaCiudad a in c.Aristas) { penarrow.Color = Color.FromArgb(100,Color.Red); g.DrawLine(penarrow, a.X, a.Y, c.X, c.Y); g.DrawString(a.getCosto().ToString()+" "+a.getTiempo().ToString(), new Font("Tahoma", 8), Brushes.Blue, calcMedPoint(a.X, c.X), calcMedPoint(a.Y, c.Y)); // g.DrawEllipse(pen1,a.X, a.Y, 10, 10); } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); ListaVuelos lv = new ListaVuelos(); using (Stream stream = File.Open("Vuelos.bin", FileMode.Open)) { var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); lv = (ListaVuelos)bformatter.Deserialize(stream); } VentanaPrincipalForm ventanaPrincipal = new VentanaPrincipalForm(lv); ventanaPrincipal.ShowDialog(); File.Delete("Vuelos.bin"); using (Stream sw = File.Open("Vuelos.bin", FileMode.Create)) { var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bformatter.Serialize(sw, lv); sw.Close(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); List <Vuelo> listavuelos = new ListaVuelos(); string serializableFile = "Vuelos.bin"; if (File.Exists(serializableFile)) { using (Stream stream = File.Open(serializableFile, FileMode.Open)) { var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); listavuelos = (List <Vuelo>)bformatter.Deserialize(stream); } } else { Vuelo v1; Vuelo v2; Vuelo v3; Vuelo v4; Vuelo v5; Vuelo v6; Vuelo v7; Vuelo v8; Vuelo v9; Vuelo v10; Vuelo v11; Vuelo v12; Vuelo v13; Vuelo v14; Vuelo v15; Vuelo v16; Vuelo v17; Vuelo v18; Vuelo v19; Vuelo v20; Vuelo v21; Vuelo v22; Vuelo v23; Vuelo v24; Vuelo v25; Vuelo v26; Vuelo v27; Vuelo v28; Vuelo v29; Vuelo v30; Vuelo v31; Vuelo v32; Vuelo v33; Vuelo v34; v1 = new Vuelo("A", "B", 0, 0, 11, 9, 2001, 600, 50, 2); v2 = new Vuelo("A", "C", 4, 20, 12, 9, 2001, 1050, 90, 2); v3 = new Vuelo("B", "F", 9, 11, 20, 4, 2001, 1150, 80, 1); v4 = new Vuelo("B", "D", 8, 30, 21, 12, 2012, 600, 50, 4); v5 = new Vuelo("F", "G", 20, 30, 1, 1, 2000, 750, 40, 3); v6 = new Vuelo("E", "B", 9, 55, 11, 3, 1996, 650, 60, 2); v7 = new Vuelo("B", "Q", 13, 25, 30, 4, 1994, 1850, 70, 1); v8 = new Vuelo("C", "D", 10, 10, 11, 4, 2005, 800, 35, 2); v9 = new Vuelo("C", "E", 11, 11, 9, 5, 2003, 850, 50, 3); v10 = new Vuelo("E", "C", 10, 50, 16, 9, 2016, 750, 45, 2); v11 = new Vuelo("E", "G", 14, 45, 31, 10, 2016, 1150, 80, 1); v12 = new Vuelo("E", "L", 5, 10, 14, 2, 2017, 1650, 60, 1); v13 = new Vuelo("E", "D", 2, 40, 21, 3, 2017, 700, 35, 2); v14 = new Vuelo("D", "E", 21, 0, 25, 12, 2016, 900, 45, 3); v15 = new Vuelo("D", "B", 22, 0, 30, 4, 2017, 700, 55, 2); v16 = new Vuelo("F", "B", 0, 0, 12, 12, 2012, 800, 65, 4); v17 = new Vuelo("F", "L", 15, 35, 15, 9, 1910, 2850, 140, 1); v18 = new Vuelo("G", "A", 9, 45, 21, 7, 1987, 1250, 95, 3); v19 = new Vuelo("G", "E", 8, 30, 11, 9, 2001, 1175, 75, 1); v20 = new Vuelo("G", "L", 20, 20, 28, 2, 1459, 2675, 135, 3); v21 = new Vuelo("G", "J", 4, 20, 1, 5, 2020, 1400, 60, 2); v22 = new Vuelo("G", "H", 16, 20, 4, 7, 2025, 450, 25, 1); v23 = new Vuelo("H", "G", 9, 15, 5, 5, 1906, 350, 30, 3); v24 = new Vuelo("H", "I", 19, 45, 19, 11, 2019, 400, 35, 1); v25 = new Vuelo("I", "H", 16, 40, 6, 6, 2006, 400, 30, 4); v26 = new Vuelo("I", "K", 4, 50, 14, 3, 2016, 400, 35, 1); v27 = new Vuelo("K", "I", 10, 15, 28, 6, 2032, 400, 35, 3); v28 = new Vuelo("K", "J", 18, 10, 11, 9, 2001, 300, 25, 1); v29 = new Vuelo("J", "L", 10, 40, 22, 2, 2022, 750, 40, 2); v30 = new Vuelo("J", "M", 12, 0, 12, 12, 2012, 1450, 70, 2); v31 = new Vuelo("L", "M", 12, 5, 4, 4, 2004, 650, 40, 2); v32 = new Vuelo("L", "K", 13, 15, 30, 8, 2008, 700, 70, 1); v33 = new Vuelo("L", "E", 21, 0, 7, 7, 2017, 1550, 60, 3); v34 = new Vuelo("M", "L", 4, 20, 14, 9, 2016, 700, 40, 2); listavuelos.Add(v1); listavuelos.Add(v2); listavuelos.Add(v3); listavuelos.Add(v4); listavuelos.Add(v5); listavuelos.Add(v6); listavuelos.Add(v7); listavuelos.Add(v8); listavuelos.Add(v9); listavuelos.Add(v10); listavuelos.Add(v11); listavuelos.Add(v12); listavuelos.Add(v13); listavuelos.Add(v14); listavuelos.Add(v15); listavuelos.Add(v16); listavuelos.Add(v17); listavuelos.Add(v18); listavuelos.Add(v19); listavuelos.Add(v20); listavuelos.Add(v21); listavuelos.Add(v22); listavuelos.Add(v23); listavuelos.Add(v24); listavuelos.Add(v25); listavuelos.Add(v26); listavuelos.Add(v27); listavuelos.Add(v28); listavuelos.Add(v29); listavuelos.Add(v30); listavuelos.Add(v31); listavuelos.Add(v32); listavuelos.Add(v33); listavuelos.Add(v34); } Grafo g = new Grafo(listavuelos); //Nodo n = g.avanza3(); PrincipalForm ventanaPrincipal = new PrincipalForm(ref listavuelos, ref g); ventanaPrincipal.ShowDialog(); //escritura using (Stream stream = File.Open(serializableFile, FileMode.Create)) { var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bformatter.Serialize(stream, listavuelos); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); List <Vuelo> listavuelos = new ListaVuelos(); Vuelo v1; Vuelo v2; Vuelo v3; Vuelo v4; Vuelo v5; Vuelo v6; Vuelo v7; Vuelo v8; Vuelo v9; Vuelo v10; Vuelo v11; Vuelo v12; Vuelo v13; Vuelo v14; Vuelo v15; Vuelo v16; Vuelo v17; Vuelo v18; Vuelo v19; Vuelo v20; Vuelo v21; Vuelo v22; Vuelo v23; Vuelo v24; Vuelo v25; Vuelo v26; Vuelo v27; Vuelo v28; Vuelo v29; Vuelo v30; Vuelo v31; Vuelo v32; Vuelo v33; Vuelo v34; v1 = new Vuelo("A", "B", 0, 0, 11, 9, 2001, 600, 50, 2); v2 = new Vuelo("A", "F", 4, 20, 12, 9, 2001, 1050, 90, 2); v3 = new Vuelo("A", "G", 9, 11, 20, 4, 2001, 1150, 80, 1); v4 = new Vuelo("B", "A", 8, 30, 21, 12, 2012, 600, 50, 4); v5 = new Vuelo("B", "C", 20, 30, 1, 1, 2000, 750, 40, 3); v6 = new Vuelo("B", "D", 9, 55, 11, 3, 1996, 650, 60, 2); v7 = new Vuelo("B", "Q", 13, 25, 30, 4, 1994, 1850, 70, 1); v8 = new Vuelo("C", "D", 10, 10, 11, 4, 2005, 800, 35, 2); v9 = new Vuelo("C", "E", 11, 11, 9, 5, 2003, 850, 50, 3); v10 = new Vuelo("E", "C", 10, 50, 16, 9, 2016, 750, 45, 2); v11 = new Vuelo("E", "G", 14, 45, 31, 10, 2016, 1150, 80, 1); v12 = new Vuelo("E", "L", 5, 10, 14, 2, 2017, 1650, 60, 1); v13 = new Vuelo("E", "D", 2, 40, 21, 3, 2017, 700, 35, 2); v14 = new Vuelo("D", "E", 21, 0, 25, 12, 2016, 900, 45, 3); v15 = new Vuelo("D", "B", 22, 0, 30, 4, 2017, 700, 55, 2); v16 = new Vuelo("F", "B", 0, 0, 12, 12, 2012, 800, 65, 4); v17 = new Vuelo("F", "L", 15, 35, 15, 9, 1910, 2850, 140, 1); v18 = new Vuelo("G", "A", 9, 45, 21, 7, 1987, 1250, 95, 3); v19 = new Vuelo("G", "E", 8, 30, 11, 9, 2001, 1175, 75, 1); v20 = new Vuelo("G", "L", 20, 20, 28, 2, 1459, 2675, 135, 3); v21 = new Vuelo("G", "J", 4, 20, 1, 5, 2020, 1400, 60, 2); v22 = new Vuelo("G", "H", 16, 20, 4, 7, 2025, 450, 25, 1); v23 = new Vuelo("H", "G", 9, 15, 5, 5, 1906, 350, 30, 3); v24 = new Vuelo("H", "I", 19, 45, 19, 11, 2019, 400, 35, 1); v25 = new Vuelo("I", "H", 16, 40, 6, 6, 2006, 400, 30, 4); v26 = new Vuelo("I", "K", 4, 50, 14, 3, 2016, 400, 35, 1); v27 = new Vuelo("K", "I", 10, 15, 28, 6, 2032, 400, 35, 3); v28 = new Vuelo("K", "J", 18, 10, 11, 9, 2001, 300, 25, 1); v29 = new Vuelo("J", "L", 10, 40, 22, 2, 2022, 750, 40, 2); v30 = new Vuelo("J", "M", 12, 0, 12, 12, 2012, 1450, 70, 2); v31 = new Vuelo("L", "M", 12, 5, 4, 4, 2004, 650, 40, 2); v32 = new Vuelo("L", "K", 13, 15, 30, 8, 2008, 700, 70, 1); v33 = new Vuelo("L", "E", 21, 0, 7, 7, 2017, 1550, 60, 3); v34 = new Vuelo("M", "L", 4, 20, 14, 9, 2016, 700, 40, 2); listavuelos.Add(v1); listavuelos.Add(v2); listavuelos.Add(v3); listavuelos.Add(v4); listavuelos.Add(v5); listavuelos.Add(v6); listavuelos.Add(v7); listavuelos.Add(v8); listavuelos.Add(v9); listavuelos.Add(v10); listavuelos.Add(v11); listavuelos.Add(v12); listavuelos.Add(v13); listavuelos.Add(v14); listavuelos.Add(v15); listavuelos.Add(v16); listavuelos.Add(v17); listavuelos.Add(v18); listavuelos.Add(v19); listavuelos.Add(v20); listavuelos.Add(v21); listavuelos.Add(v22); listavuelos.Add(v23); listavuelos.Add(v24); listavuelos.Add(v25); listavuelos.Add(v26); listavuelos.Add(v27); listavuelos.Add(v28); listavuelos.Add(v29); listavuelos.Add(v30); listavuelos.Add(v31); listavuelos.Add(v32); listavuelos.Add(v33); listavuelos.Add(v34); PrincipalForm ventanaPrincipal = new PrincipalForm(ref listavuelos); ventanaPrincipal.ShowDialog(); //listavuelos.guardar(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Principal()); ListaVuelos listaVuelos = new ListaVuelos(); ListaCiudades listaciudades = new ListaCiudades(); try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader("infoVuelos.txt")) { // Read the stream to a string, and write the string to the console. while (!sr.EndOfStream) { String line = sr.ReadLine(); string[] datavuelo = line.Split('|'); Console.WriteLine(datavuelo[5]); DateTime date = DateTime.Parse(datavuelo[5]); Vuelo vuelo = new Vuelo(int.Parse(datavuelo[0]),datavuelo[1], datavuelo[2], int.Parse(datavuelo[4]), int.Parse(datavuelo[3]),date); listaVuelos.Add(vuelo); } } } catch (Exception e) { Console.WriteLine("The file Info vueloes could not be read:"); Console.WriteLine(e.Message); return; } //Leyendo usuarios try { using (StreamReader ifile = new StreamReader("usuarios.txt")) { while(!ifile.EndOfStream) { string uline = ifile.ReadLine(); string[] du = uline.Split('|'); int indexV = int.Parse(du[0]); //indice es igual a al primer campo de du Usuario user = new Usuario(du[1], du[2], du[4], int.Parse(du[3])); listaVuelos[indexV].userlist.Add(user); listaVuelos[indexV].setAsientoTomado(int.Parse(du[3])); } } } catch(Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } //Leyendo Ciudades try { using (StreamReader ifile = new StreamReader("Ciudades.txt")) { while (!ifile.EndOfStream) { string cline = ifile.ReadLine(); string[] cu = cline.Split('|'); List<AristaCiudad> aristas = new List<AristaCiudad>(); CiudadNodo city = new CiudadNodo(float.Parse(cu[0]), float.Parse(cu[1]), cu[2],aristas); listaciudades.Add(city); } } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } //Leyendo Aristas try { using (StreamReader ifile = new StreamReader("Aristas.txt")) { while (!ifile.EndOfStream) { string aline = ifile.ReadLine(); string[] au = aline.Split('|'); AristaCiudad arista = new AristaCiudad(float.Parse(au[1]), float.Parse(au[2]),au[0], au[3], int.Parse(au[4]),int.Parse(au[5])); int ind = listaciudades.getcityIndex(au[0]); listaciudades[ind].Aristas.Add(arista); } } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } Principal ventanaPrincipal = new Principal(ref listaVuelos,ref listaciudades); ventanaPrincipal.ShowDialog(); //codigo para escribir //string lines = "First line.\r\nSecond line.\r\nThird line."; StreamWriter file = new StreamWriter("infoVuelos.txt"); StreamWriter file2 = new StreamWriter("usuarios.txt"); int vindex=0; foreach (Vuelo v in listaVuelos) { file.WriteLine(v.ToString('|')); foreach(Usuario u in v.userlist) { file2.WriteLine(vindex.ToString()+'|'+u.ToString()); } vindex++; } file.Close(); file2.Close(); StreamWriter filecity = new StreamWriter("Ciudades.txt"); StreamWriter fileari = new StreamWriter("Aristas.txt"); foreach(CiudadNodo c in listaciudades) { filecity.WriteLine(c.X.ToString() + '|' + c.Y.ToString() + '|' + c.getName()); foreach (AristaCiudad a in c.Aristas) { fileari.WriteLine(c.getName() + '|' + a.ToString()); } } filecity.Close(); fileari.Close(); Console.WriteLine("fin del programa"); }
public Principal(ref ListaVuelos listaVuelos,ref ListaCiudades listaciudades) { InitializeComponent(); this.listaVuelos = listaVuelos; this.listaciudades = listaciudades; }