public ActionResult FlightInformation()
        {
            List <TFlightTime> Flights = new List <TFlightTime>();
            //TFlightTime obj = new TFlightTime();
            //SelectReturn sr = DataBaseAccess.GetAllTInfo(obj);
            //List<object> list = sr.list;//object
            //List<string> value = sr.value;//值

            Actions          a           = new Actions();
            List <FLIGHTIME> flightTimes = a.GetFlightTime("东方航空公司");

            foreach (FLIGHTIME item in flightTimes)
            {
                TFlightTime flight = new TFlightTime();
                flight.f_id            = item.F_ID;
                flight.t_airport       = item.T_AIRPORT;
                flight.t_terminal      = item.T_TERMINAL;
                flight.ex_takeoff_time = item.EX_TAKEOFF_TIME.ToString();
                flight.ex_land_time    = item.EX_LAND_TIME.ToString();
                flight.re_takeoff_time = null;
                flight.re_land_time    = null;
                flight.l_airport       = item.L_AIRPORT;
                flight.l_termnal       = item.L_TERMNAL;
                Flights.Add(flight);
            }
            return(View("FlightInformation", Flights));
        }
Ejemplo n.º 2
0
        public ActionResult GetFlightInfo(string id, int capacity)
        {
            //需要在此函数中传回一个数组,为了方便先传递一个list
            Seat          obj   = new Seat(id);        //定义Flight_ID为id的航班上的一个座位
            List <string> needs = new List <string>(); //查询的数据需求,此处时座位号

            needs.Add("Seat_Number");
            List <string> res = new List <string>();     //查询结果

            res = DataBaseAccess.GetSingleInfo(obj, needs);


            int[] SeatArray = new int[capacity];
            for (int i = 0; i < capacity; i++)        //初始化
            {
                SeatArray[i] = int.MinValue;
            }
            for (int i = 0; i < res.Count; i++)
            {
                if (res[i] != "")
                {
                    SeatArray[int.Parse(res[i]) - 1] = 0;
                }
            }

            //数组,航班号,出发地点(机场,航站楼),出发时间,票价
            //机场,航站楼,出发时间
            TFlightTime   objsingle   = new TFlightTime(id);
            List <string> needssingle = new List <string>();

            needssingle.Add("T_Airport");
            needssingle.Add("T_Terminal");
            needssingle.Add("Ex_TakeOff_Time");
            List <string> ressingle = new List <string>();

            ressingle = DataBaseAccess.GetSingleInfo(objsingle, needssingle);
            //
            //票价
            Flight        objflight = new Flight(id);
            List <string> needvalue = new List <string>();

            needvalue.Add("Value");
            List <string> resvalue = new List <string>();

            resvalue = DataBaseAccess.GetSingleInfo(objflight, needvalue);
            //
            List <string> all = new List <string>();

            //
            all.Add(id);
            foreach (string str in ressingle)
            {
                all.Add(str);
            }
            all.Add(resvalue[0]);
            //
            FlightSelectReturn data = new FlightSelectReturn(SeatArray, all);

            return(View("Flight", data));
        }