Exemplo n.º 1
0
        protected void Proposer(object sender, EventArgs e)
        {
            DBConnection dbc = new DBConnection();

            this.Button2.Visible = true;
            try
            {
                dbc.OpenConnection();

                string inputIdAirport = this.DropDownList1.Text.Substring(this.DropDownList1.Text.IndexOf('[') + 1);;  //Ilay idAeroport mila aMBOARINA FA TSY METY
                inputIdAirport = inputIdAirport.Remove(inputIdAirport.Length - 1);

                //The airport chosen
                aeroportGlobal = new Aeroport(inputIdAirport);

                //Getting the airports pistes w/ piste details (longueurs_pistes sy ny degagement)
                aeroportGlobal.getPistes(dbc);

                //Order listPist asc % length
                aeroportGlobal.pistes = aeroportGlobal.pistes.OrderBy(x => x.longueur).ToList();

                //Getting the flights ordered with their Avion_Modele(besoins) without id_Pistes nor any piste info
                List <VolPiste> listeVolPisteOrdered = Vol.getVolsOrdered(dbc, listeVolsGlobale, aeroportGlobal.pistes);

                //A Proposition goes with a list of its proposed operator-scheduled flights (awaiting for use)
                Proposition propos = new Proposition(listeVolPisteOrdered);

                //BEHOLD the func that gives each ordered flights an adequate piste
                List <VolPiste> res = propos.getTheseVolPistesOnePiste(listeVolPisteOrdered, aeroportGlobal.pistes, dbc);


                //NY APOITRA FARANY
                ListeVols.DataSource = res;
                ListeVols.DataBind();
            }

            finally
            {
                dbc.CloseConnection();
            }
        }
Exemplo n.º 2
0
        protected void GenerateListVolsOfAirport(object sender, EventArgs e)
        {
            string inputIdAirport = this.DropDownList1.Text.Substring(this.DropDownList1.Text.IndexOf('[') + 1);;  //Ilay idAeroport mila aMBOARINA FA TSY METY

            inputIdAirport        = inputIdAirport.Remove(inputIdAirport.Length - 1);
            Session["IdAeroport"] = inputIdAirport;
            this.Panel1.Visible   = true;
            DateTime dateDebut = new DateTime(1999, 1, 1, 0, 0, 0);
            DateTime dateFin   = new DateTime(1999, 1, 1, 0, 0, 0);

            // MGET ANLE DATE DEBUT sy DATE FIN eto
            //exception date par défaut
            if (TextBox1.Text == String.Empty)
            {
                //ATAO 1999-01-01 00:00:0000
                dateDebut = new DateTime(1999, 1, 1, 0, 0, 0);
            }
            else
            {
                dateDebut = Convert.ToDateTime(TextBox1.Text);
            }
            if (TextBox2.Text == String.Empty)
            {
                dateFin = new DateTime(1999, 1, 1, 0, 0, 0);
            }
            else
            {
                dateFin = Convert.ToDateTime(TextBox2.Text);
            }

            DBConnection dbc = new DBConnection();

            try
            {
                dbc.OpenConnection();
                Aeroport currentAirport = new Aeroport(inputIdAirport);
                currentAirport.getAllFlightsAirport(dbc, dateDebut, dateFin);
                //filtrena
                currentAirport.getAction();
                currentAirport.getVolAt(dateDebut, dateFin);

                //global list and airport for reuse of proposer
                listeVolsGlobale = currentAirport.vols.ToList();


                //bind this.vols to the gridview
                ListeVols.DataSource = currentAirport.vols;
                ListeVols.DataBind();

                //tests
                //this.TextBox3.Text = inputIdAirport;
                //this.TextBox3.Text = dateFin.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbc.CloseConnection();
            }


            // mamerina tableau ana Vol[] { string NomVol , string action(decoller/atterrir) , DateTime Temps(datedepart/date probable atter) , string Etat } (apiana anreo ny attributs an vol)
        }