public TFlightTime Search(string f_id)
        {
            DBConnectionPool pool = new DBConnectionPool(10);
            OracleConnection conn = pool.fetchConnection();


            string      sql    = "select * from FLIGHTIME where F_ID='" + f_id + "'";
            TFlightTime flight = new TFlightTime();

            OracleCommand cmd = new OracleCommand();

            OracleHelper.PrepareCommand(cmd, conn, null, sql, null);

            OracleDataReader objReader = null;

            objReader = cmd.ExecuteReader();


            while (objReader.Read())
            {
                flight.f_id            = objReader[0].ToString();
                flight.t_airport       = objReader[1].ToString();
                flight.t_terminal      = objReader["t_terminal"].ToString();
                flight.ex_takeoff_time = objReader["ex_takeoff_time"].ToString();
                flight.ex_land_time    = objReader["ex_land_time"].ToString();
                flight.re_land_time    = null;
                flight.re_takeoff_time = null;
                flight.l_airport       = objReader["l_airport"].ToString();
                flight.l_termnal       = objReader["l_termnal"].ToString();
            }
            return(flight);
        }
예제 #2
0
        public static List <FlightStateReturn> QueryFlightsState(OracleConnection connection, List <string> needs)
        {
            List <FlightStateReturn> res = new List <FlightStateReturn>();

            StringBuilder StrSql = new StringBuilder();

            try
            {
                StrSql.Append(string.Format("select"));
                for (int i = 0; i < needs.Count; i++)
                {
                    if (i == 0)
                    {
                        StrSql.Append(string.Format(" {0}", needs[i]));
                    }
                    else
                    {
                        StrSql.Append(string.Format(",{0}", needs[i]));
                    }
                }
                StrSql.Append(string.Format(" from {0}", "fstate natural join flightime"));//DBAttribute.GetDBTable(obj.GetType()))
            }
            catch (ArgumentException e)
            {
                throw new ArgumentException(e.Message);
            }

            OracleCommand cmd = new OracleCommand();

            PrepareCommand(cmd, connection, null, StrSql.ToString(), null);

            OracleDataReader odr = null;

            odr = cmd.ExecuteReader();
            //odr读取数据并存入res
            while (odr.Read())
            {
                TFlightTime tfe  = new TFlightTime();
                int         flag = 0;

                tfe.f_id            = odr[flag++].ToString();
                tfe.t_airport       = odr[flag++].ToString();
                tfe.t_terminal      = odr[flag++].ToString();
                tfe.l_airport       = odr[flag++].ToString();
                tfe.l_termnal       = odr[flag++].ToString();
                tfe.ex_takeoff_time = odr[flag++].ToString();
                tfe.ex_land_time    = odr[flag++].ToString();

                FlightStateReturn fsr = new FlightStateReturn(tfe, odr[flag].ToString());
                res.Add(fsr);
            }
            return(res);
        }
 public FlightStateReturn(TFlightTime flightTime, string state)
 {
     tf    = flightTime;
     State = state;
 }