private void GetFlights()
        {
            BAPI_FLIGHT_GETLIST.BAPI_FLIGHT_GETLISTService flightListService =
                new BAPI_FLIGHT_GETLIST.BAPI_FLIGHT_GETLISTService();

            flightListService.Credentials = new NetworkCredential("bcuser", "minisap");

            BAPI_FLIGHT_GETLIST.BAPIRET2[]   returnFlightList;
            BAPI_FLIGHT_GETLIST.BAPISFLDRA[] dateRange;

            BAPI_FLIGHT_GETLIST.BAPISFLDST destFrom;
            BAPI_FLIGHT_GETLIST.BAPISFLDST destTo;

            BAPI_FLIGHT_GETLIST.BAPIPAREX[]  extensionIn;
            BAPI_FLIGHT_GETLIST.BAPIPAREX[]  extensionOut;
            BAPI_FLIGHT_GETLIST.BAPISFLDAT[] flights;

            dateRange = new BAPI_FLIGHT_GETLIST.BAPISFLDRA[0];

            extensionIn      = new BAPI_FLIGHT_GETLIST.BAPIPAREX[0];
            extensionOut     = new BAPI_FLIGHT_GETLIST.BAPIPAREX[0];
            flights          = new BAPI_FLIGHT_GETLIST.BAPISFLDAT[0];
            returnFlightList = new BAPI_FLIGHT_GETLIST.BAPIRET2[0];
            destFrom         = new BAPI_FLIGHT_GETLIST.BAPISFLDST();
            destTo           = new BAPI_FLIGHT_GETLIST.BAPISFLDST();

            flightListService.BAPI_FLIGHT_GETLIST(
                string.Empty,
                ref dateRange,
                destFrom,
                destTo,
                ref extensionIn,
                ref extensionOut,
                ref flights,
                0,
                false,
                ref returnFlightList);

            _flightList.Clear();

            for (int idx = 0; idx < flights.Length; idx++)
            {
                int firstClassFree    = 0;
                int businessClassFree = 0;
                int economyClassFree  = 0;

                bool isAvailable = CheckAvailability(
                    flights[idx].AIRLINEID,
                    flights[idx].CONNECTID,
                    flights[idx].FLIGHTDATE,
                    ref firstClassFree,
                    ref businessClassFree,
                    ref economyClassFree);

                if (isAvailable &&
                    Convert.ToDateTime(flights[idx].FLIGHTDATE) >= DateTime.Now)
                {
                    Flight flight = new Flight(
                        flights[idx].AIRLINEID,
                        flights[idx].AIRLINE,
                        flights[idx].CITYFROM,
                        flights[idx].CITYTO,
                        flights[idx].AIRPORTFR,
                        flights[idx].AIRPORTTO,
                        flights[idx].FLIGHTDATE,
                        flights[idx].DEPTIME,
                        flights[idx].ARRDATE,
                        flights[idx].ARRTIME,
                        firstClassFree,
                        businessClassFree,
                        economyClassFree);

                    _flightList.Add(flight);
                }
            }
        }
示例#2
0
 /// <remarks/>
 public void BAPI_FLIGHT_GETLISTAsync(string AIRLINE, BAPISFLDRA[] DATE_RANGE, BAPISFLDST DESTINATION_FROM, BAPISFLDST DESTINATION_TO, BAPIPAREX[] EXTENSION_IN, BAPIPAREX[] EXTENSION_OUT, BAPISFLDAT[] FLIGHT_LIST, int MAX_ROWS, bool MAX_ROWSSpecified, BAPIRET2[] RETURN, object userState)
 {
     if ((this.BAPI_FLIGHT_GETLISTOperationCompleted == null))
     {
         this.BAPI_FLIGHT_GETLISTOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBAPI_FLIGHT_GETLISTOperationCompleted);
     }
     this.InvokeAsync("BAPI_FLIGHT_GETLIST", new object[] {
         AIRLINE,
         DATE_RANGE,
         DESTINATION_FROM,
         DESTINATION_TO,
         EXTENSION_IN,
         EXTENSION_OUT,
         FLIGHT_LIST,
         MAX_ROWS,
         MAX_ROWSSpecified,
         RETURN
     }, this.BAPI_FLIGHT_GETLISTOperationCompleted, userState);
 }
示例#3
0
 public void BAPI_FLIGHT_GETLIST([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] string AIRLINE, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] ref BAPISFLDRA[] DATE_RANGE, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] BAPISFLDST DESTINATION_FROM, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] BAPISFLDST DESTINATION_TO, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] ref BAPIPAREX[] EXTENSION_IN, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] ref BAPIPAREX[] EXTENSION_OUT, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] ref BAPISFLDAT[] FLIGHT_LIST, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] int MAX_ROWS, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlIgnoreAttribute()] bool MAX_ROWSSpecified, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)][System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] ref BAPIRET2[] RETURN)
 {
     object[] results = this.Invoke("BAPI_FLIGHT_GETLIST", new object[] {
         AIRLINE,
         DATE_RANGE,
         DESTINATION_FROM,
         DESTINATION_TO,
         EXTENSION_IN,
         EXTENSION_OUT,
         FLIGHT_LIST,
         MAX_ROWS,
         MAX_ROWSSpecified,
         RETURN
     });
     DATE_RANGE    = ((BAPISFLDRA[])(results[0]));
     EXTENSION_IN  = ((BAPIPAREX[])(results[1]));
     EXTENSION_OUT = ((BAPIPAREX[])(results[2]));
     FLIGHT_LIST   = ((BAPISFLDAT[])(results[3]));
     RETURN        = ((BAPIRET2[])(results[4]));
 }
示例#4
0
 /// <remarks/>
 public void BAPI_FLIGHT_GETLISTAsync(string AIRLINE, BAPISFLDRA[] DATE_RANGE, BAPISFLDST DESTINATION_FROM, BAPISFLDST DESTINATION_TO, BAPIPAREX[] EXTENSION_IN, BAPIPAREX[] EXTENSION_OUT, BAPISFLDAT[] FLIGHT_LIST, int MAX_ROWS, bool MAX_ROWSSpecified, BAPIRET2[] RETURN)
 {
     this.BAPI_FLIGHT_GETLISTAsync(AIRLINE, DATE_RANGE, DESTINATION_FROM, DESTINATION_TO, EXTENSION_IN, EXTENSION_OUT, FLIGHT_LIST, MAX_ROWS, MAX_ROWSSpecified, RETURN, null);
 }