7 #include <stdair/bom/FareOptionStruct.hpp>
8 #include <stdair/bom/TravelSolutionStruct.hpp>
9 #include <stdair/bom/CancellationStruct.hpp>
10 #include <stdair/service/Logger.hpp>
12 #include <airinv/AIRINV_Master_Service.hpp>
19 void DistributionManager::
20 calculateAvailability (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
21 stdair::TravelSolutionList_T& ioTravelSolutionList,
22 const stdair::PartnershipTechnique& iPartnershipTechnique) {
23 for (stdair::TravelSolutionList_T::iterator itTS =
24 ioTravelSolutionList.begin();
25 itTS != ioTravelSolutionList.end(); ++itTS) {
26 stdair::TravelSolutionStruct& lCurrentTravelSolution = *itTS;
29 ioAIRINV_Master_Service.calculateAvailability (lCurrentTravelSolution,
30 iPartnershipTechnique);
35 bool DistributionManager::
36 sell (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
37 const stdair::TravelSolutionStruct& iTravelSolution,
38 const stdair::NbOfSeats_T& iPartySize) {
39 bool hasSaleBeenSuccessful =
false;
41 const stdair::KeyList_T& lSegmentDateKeyList =
42 iTravelSolution.getSegmentPath();
43 const stdair::FareOptionStruct& lChosenFareOption =
44 iTravelSolution.getChosenFareOption ();
45 const stdair::ClassList_StringList_T& lClassPath =
46 lChosenFareOption.getClassPath();
47 stdair::ClassList_StringList_T::const_iterator itClassKeyList =
49 for (stdair::KeyList_T::const_iterator itKey= lSegmentDateKeyList.begin();
50 itKey != lSegmentDateKeyList.end(); ++itKey, ++itClassKeyList) {
51 const std::string& lSegmentDateKey = *itKey;
54 std::ostringstream ostr;
55 const stdair::ClassList_String_T& lClassList = *itClassKeyList;
56 assert (lClassList.size() > 0);
57 ostr << lClassList.at(0);
58 const stdair::ClassCode_T lClassCode (ostr.str());
60 hasSaleBeenSuccessful =
61 ioAIRINV_Master_Service.sell (lSegmentDateKey, lClassCode, iPartySize);
64 return hasSaleBeenSuccessful;
68 bool DistributionManager::
69 playCancellation (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
70 const stdair::CancellationStruct& iCancellation) {
71 bool hasCancellationBeenSuccessful =
false;
73 const stdair::PartySize_T& lPartySize = iCancellation.getPartySize();
74 const stdair::KeyList_T& lSegmentDateKeyList =
75 iCancellation.getSegmentPath();
76 const stdair::ClassList_String_T& lClassList = iCancellation.getClassList();
77 stdair::ClassList_String_T::const_iterator itClass = lClassList.begin();
78 for (stdair::KeyList_T::const_iterator itKey= lSegmentDateKeyList.begin();
79 itKey != lSegmentDateKeyList.end(); ++itKey, ++itClass) {
80 const std::string& lSegmentDateKey = *itKey;
83 std::ostringstream ostr;
85 const stdair::ClassCode_T lClassCode (ostr.str());
87 hasCancellationBeenSuccessful =
88 ioAIRINV_Master_Service.cancel (lSegmentDateKey, lClassCode,
91 return hasCancellationBeenSuccessful;