Example #1
0
        public bool CreateTrip(
            string agencyNumber,
            string classType,
            string customerID,
            string flConn1,
            string flConn2,
            string flDate1,
            string flDate2,
            out string travelAgencyNumber,
            out string tripNumber)
        {
            _bapiExtensionIn  = new SAP_FLIGHTTRIPCREATE.BAPIPAREX[0];
            _bapiExtensionOut = new SAP_FLIGHTTRIPCREATE.BAPIPAREX[0];
            _bapiFlTripReturn = new SAP_FLIGHTTRIPCREATE.BAPIRET2[0];

            SAP_FLIGHTTRIPCREATE.BAPISTRNEW flData =
                new SAP_FLIGHTTRIPCREATE.BAPISTRNEW();

            flData.AGENCYNUM  = agencyNumber;
            flData.CLASS      = classType;
            flData.CUSTOMERID = customerID;
            flData.FLCONN1    = flConn1;
            flData.FLCONN2    = flConn2;
            flData.FLDATE1    = flDate1;
            flData.FLDATE2    = flDate2;

            CookieContainer cookieContainer = new CookieContainer();

            _bapiFlightTripCreate.Url += "?session_mode=1";
            _bapiCommitWork.Url       += "?session_mode=2";

            _bapiFlightTripCreate.CookieContainer = cookieContainer;
            _bapiCommitWork.CookieContainer       = cookieContainer;

            _bapiTicketPrice = _bapiFlightTripCreate.BAPI_FLTRIP_CREATE(
                ref _bapiExtensionIn,
                flData,
                ref _bapiPassengers,
                ref _bapiFlTripReturn,
                out travelAgencyNumber,
                out tripNumber);
            if (_bapiFlTripReturn.Length > 1)
            {
                return(false);
            }
            SAP_COMMITWORK.BAPIRET2 ret = _bapiCommitWork.BAPI_TRANSACTION_COMMIT("");
            return(true);
        }
        public bool CreateFromData()
        {
            _bapiCustomerCreate =
                new SAP_FLIGHTCUSTOMERCREATE.BAPI_FLCUST_CREATEFROMDATAService();
            _bapiCustomerCreate.Url =
                Properties.Settings.Default.ContosoTours_SAPServices_SAP_FLIGHTCUSTOMERCREATE_BAPI_FLCUST_CREATEFROMDATAService;

            _bapiCommitWork     = new SAP_COMMITWORK.BAPI_TRANSACTION_COMMITService();
            _bapiCommitWork.Url =
                Properties.Settings.Default.ContosoTours_SAPServices_SAP_COMMITWORK_BAPI_TRANSACTION_COMMITService;

            _bapiCommitWork.Credentials     = SAPIdentity;
            _bapiCustomerCreate.Credentials = SAPIdentity;

            _bapiExtIn  = new SAP_FLIGHTCUSTOMERCREATE.BAPIPAREX[0];
            _bapiExtOut = new SAP_FLIGHTCUSTOMERCREATE.BAPIPAREX[0];
            _bapiReturn = new SAP_FLIGHTCUSTOMERCREATE.BAPIRET2[0];

            CookieContainer cookieContainer = new CookieContainer();

            _bapiCustomerCreate.Url += "?session_mode=1";
            _bapiCommitWork.Url     += "?session_mode=2";

            _bapiCustomerCreate.CookieContainer = cookieContainer;
            _bapiCommitWork.CookieContainer     = cookieContainer;

            _bapiCustomerCreate.BAPI_FLCUST_CREATEFROMDATA(
                _bapiCustData,
                ref _bapiExtIn,
                ref _bapiReturn,
                "");
            if (_bapiReturn.Length > 1)
            {
                return(false);
            }
            _bapiCommitWork.BAPI_TRANSACTION_COMMIT("");
            return(true);
        }