public void TravelItineraryMethodTest()
        {
            GetInformationToDIX getInformationdix = new GetInformationToDIX();

            string convid = "TestSession";
            string ipcc = "5IPC";
            string securitytoken = @"Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/RESE!ICESMSLB\/RES.LB!-3596380841176999631!999852!0!1!E2E-1";
            string RecLoc = "WJMMCZ";


            GetInformationToDIX.GetInformationToDIXObject dixObject = getInformationdix.TravelItineraryMethod(convid, ipcc, securitytoken, RecLoc);
        }
コード例 #2
0
        /// <summary>
        /// Obtiene la información de los segmentos de un record para crear el DIX
        /// </summary>
        private void GetInformationDIX()
        {
            using (WSSessionSabre obj = new WSSessionSabre())
            {
                obj.OpenConnection();
                if (obj.IsConnected)
                {
                    myObject = new GetInformationToDIX().TravelItineraryMethod(obj.ConversationId, obj.IPcc, obj.SecurityToken, txtPNR.Text);
                }
            }
            if (myObject != null && myObject.Status)
            {
                if (myObject.Response == "PNR OF GROUP")
                {
                    MessageBox.Show("RECORD LOCALIZADOR DE GRUPO, NO SE PUEDE OBTENER SU INFORMACIÓN", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtPNR.Focus();
                }
                else
                {
                    try
                    {
                        if (myObject.namePassengerList.Count > 0)
                        {
                            informationDIX = string.Concat("                                             ATN: ",
                                                           myObject.namePassengerList[0].paxName,
                                                           (!string.IsNullOrEmpty(myObject.namePassengerList[0].paxRef) ? " REF: " : ""),
                                                           myObject.namePassengerList[0].paxRef, "\n");
                            for (int i = 1; i < myObject.namePassengerList.Count; i++)
                            {
                                informationDIX = string.Concat(informationDIX,
                                                               "                                                  ",
                                                               myObject.namePassengerList[i].paxName,
                                                               (!string.IsNullOrEmpty(myObject.namePassengerList[i].paxRef) ? " REF: " : ""),
                                                               myObject.namePassengerList[i].paxRef, "\n");
                            }
                        }
                        if (myObject.remarkInvoicesList.Count > 0)
                        {
                            informationDIX = string.Concat(informationDIX, "\n",
                                                           "                                             DIR: ", myObject.remarkInvoicesList[0], "\n");
                            for (int i = 1; i < myObject.remarkInvoicesList.Count; i++)
                            {
                                informationDIX = string.Concat(informationDIX,
                                                               "                                                  ",
                                                               myObject.remarkInvoicesList[i], "\n");
                            }
                        }
                        informationDIX = string.Concat(informationDIX,
                                                       "\n\n\n",
                                                       "NO. DE CLIENTE: ", myObject.LocationDK, "\n",
                                                       "      VENDEDOR: ", myObject.Agent, "\n",
                                                       "   CLAVE SABRE: ", txtPNR.Text, "\n",
                                                       "         FECHA: ", DateTime.Now.ToString("dd-MMM-yyyy").ToUpper(), "\n");
                        if (myObject.hotelList.Count > 0 || myObject.autoList.Count > 0)
                        {
                            List <InformationByItinerary> segmenByDateList = new List <InformationByItinerary>();
                            for (int i = 0; i < myObject.listItineraryInfo.Count; i++)
                            {
                                InformationByItinerary item = new InformationByItinerary();
                                item.date        = Convert.ToDateTime(myObject.listItineraryInfo[i].dateFlight);
                                item.indexInList = i;
                                item.typeSegment = "Vuelo";
                                segmenByDateList.Add(item);
                            }
                            for (int i = 0; i < myObject.hotelList.Count; i++)
                            {
                                InformationByItinerary item = new InformationByItinerary();
                                item.date        = Convert.ToDateTime(myObject.hotelList[i].startDate);
                                item.indexInList = i;
                                item.typeSegment = "Hotel";
                                segmenByDateList.Add(item);
                            }
                            for (int i = 0; i < myObject.autoList.Count; i++)
                            {
                                InformationByItinerary item = new InformationByItinerary();
                                item.date        = Convert.ToDateTime(myObject.autoList[i].dateRent);
                                item.indexInList = i;
                                item.typeSegment = "Auto";
                                segmenByDateList.Add(item);
                            }
                            segmenByDateList.Sort(delegate(InformationByItinerary segment1, InformationByItinerary segment2)
                            {
                                return(segment1.date.CompareTo(segment2.date));
                            });
                            for (int i = 0; i < segmenByDateList.Count; i++)
                            {
                                if (segmenByDateList[i].typeSegment == "Vuelo")
                                {
                                    BuildAirInformation(segmenByDateList[i].indexInList);
                                }
                                else if (segmenByDateList[i].typeSegment == "Auto")
                                {
                                    BuildCarInformation(segmenByDateList[i].indexInList);
                                }
                                else if (segmenByDateList[i].typeSegment == "Hotel")
                                {
                                    BuildHotelInformation(segmenByDateList[i].indexInList);
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < myObject.listItineraryInfo.Count; i++)
                            {
                                BuildAirInformation(i);
                            }
                        }

                        for (int i = 0; i < myObject.segmentProtectionList.Count; i++)
                        {
                            List <ListItem> cityCodeSegmentProtection = CatCitiesBL.GetCities(myObject.segmentProtectionList[i].locationCode);
                            myObject.segmentProtectionList[i].locationCode = cityCodeSegmentProtection[0].Text.Substring(4, cityCodeSegmentProtection[0].Text.Length - 4);
                            if (myObject.segmentProtectionList[i].daySegment == "Sunday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Domingo";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Monday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Lunes";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Tuesday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Martes";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Wednesday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Miercoles";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Thursday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Jueves";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Friday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Viernes";
                            }
                            else if (myObject.segmentProtectionList[i].daySegment == "Saturday")
                            {
                                myObject.segmentProtectionList[i].daySegment = "Sabado";
                            }
                            informationDIX = string.Concat(informationDIX, "\n",
                                                           myObject.segmentProtectionList[i].dateSegment, "  -  ",
                                                           myObject.segmentProtectionList[i].daySegment.ToUpper(), "\n",
                                                           "  OTRO    ",
                                                           myObject.segmentProtectionList[i].locationCode, "\n",
                                                           "          ",
                                                           myObject.segmentProtectionList[i].textSegment, "\n");
                        }
                        informationDIX = string.Concat(informationDIX, "\n");
                        for (int k = 0; k < myObject.remarksList.Count; k++)
                        {
                            if (string.IsNullOrEmpty(myObject.remarksList[k].segmentNumber))
                            {
                                informationDIX = string.Concat(informationDIX,
                                                               myObject.remarksList[k].remark, "\n");
                            }
                        }
                    }
                    catch
                    {
                        status = false;
                    }
                    if (status)
                    {
                        BuildTXT(informationDIX);
                    }
                    else
                    {
                        MessageBox.Show("ERROR EN LA ESCRITURA DEL RECORD, FAVOR DE REPORTARLO A SISTEMAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                    }
                }
            }
            else
            {
                if (myObject != null)
                {
                    MessageBox.Show(myObject.Response, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("ERROR EN EL WEB SERVICE, FAVOR DE REPORTARLO A SISTEMAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
            }
        }