Ejemplo 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();
            }
        }