Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Graf graf = new Graf();

            graf.Dijkstra_Modificat(5, 9, "2018-10-10");
            // TimeSpan h1 = Utility.OraAjungAvionStatie("Av1", "Lisbon");
            //Utility.Afiseaza_posibile_bilete(graf.StatiiFinale, "2018-10-10");
            Utility.Adauga_Bilete(graf.StatiiFinale, "2018-10-10", "ana", "maria", "12345677");
            // Utility.Afiseaza_posibile_bilete(graf.StatiiFinale, "2018-10-10");
            this.textBox1.Clear();
            this.textBox1.Text = "dffijdfidjikdjfdsikf";
            //this.textBox1.Text = h1.ToString();
            // this.textBox1.Text =Convert.ToDateTime(this.dateTimePicker1.Text).ToString();
        }
Пример #2
0
        private void CautaB_Click(object sender, EventArgs e)
        {
            this.alfa.Clear();
            this.CumparaB.Enabled = true;
            var context = new AvioaneDataContext();

            graf = new Graf();
            string statie1 = this.Dest1C.Text;
            string statie2 = this.Dest2C.Text;

            graf.Dijkstra_Modificat(Utility.GetIdStatie(statie1), Utility.GetIdStatie(statie2), Convert.ToDateTime(this.dateTimePicker1.Text).ToString());
            List <Bilete> Posibile = Utility.Afiseaza_posibile_bilete(graf.StatiiFinale, Convert.ToDateTime(this.dateTimePicker1.Text).ToString());

            for (int i = 0; i < Posibile.Count; i++)
            {
                alfa.Rows.Add(Posibile.ElementAt(i).ID_Avion.ToString(),
                              Posibile.ElementAt(i).Destinatie_1.ToString(),
                              Posibile.ElementAt(i).Ora_Decolare.ToString(),
                              Posibile.ElementAt(i).Destinatie_2.ToString(),
                              Posibile.ElementAt(i).Ora_Aterizare.ToString());
            }
            this.dataGridView1.DataSource = alfa;
            int nok = 0;

            foreach (var item in Posibile)
            {
                var dateREV = from c in context.Avioanes
                              where (c.Data_Reciclare < (item.Data) && c.ID_Avion.Equals(item.ID_Avion))
                              select c;
                if (dateREV.ToList().Count != 0)
                {
                    nok = 1;
                    break;
                }
            }
            if (nok == 1)
            {
                this.CumparaB.Enabled = false;
                MessageBox.Show("Exista avioane in service la acea data. Reprogramati");
            }
        }