private OTATravelItineraryObjectHotel GetCars(TravelItinerary.TravelItineraryReadRSTravelItineraryItineraryInfoItemVehicle car, string commission, string dk, string phone, string rfc, string agent, string mail, string sixReceived, string passengerType, int passengerNum, string passengerName, string title, string passengerSurname, string lastStatus, List <string> cancelNumberList) { OTATravelItineraryObjectHotel obj = new OTATravelItineraryObjectHotel(); obj.Provider_Commission = commission; obj.Prov_Direct_Pay = true; obj.DK = dk; obj.Phone = phone; obj.RFC = rfc; obj.User = agent; obj.Mail = mail; obj.Request = sixReceived; obj.CancelNumberList = cancelNumberList; obj.StatusSabre = car.Status; string typeCar = string.Empty; typeCar = car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.GuaranteeInd == null ? string.Empty : car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.GuaranteeInd.Replace("DPST", string.Empty); if (!string.IsNullOrEmpty(typeCar)) { obj.Payment_Form = typeCar.Substring(0, 2).ToUpper(); obj.Car_Number = Convert.ToInt32(typeCar.Substring(typeCar.IndexOf("EXP") - 4, 4)); } else { obj.Payment_Form = string.Empty; obj.Car_Number = 0; } obj.Sales_Source = car.VehRentalCore.LocationDetails.LocationCode.ToUpper(); obj.Provider = "3318"; //OBTENER DE CONSULTA obj.Site = "5475"; //OBTENER DE CONSULTA double total = 0d; double semanal = 0d; foreach (TravelItinerary2.TravelItineraryReadRSTravelItineraryItineraryInfoItemVehicleVehVendorAvailVehResCoreVehicleChargesVehicleChargeApproximateTotalCharge chargeDetails in car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.ChargeDetails == null ? new TravelItinerary2.TravelItineraryReadRSTravelItineraryItineraryInfoItemVehicleVehVendorAvailVehResCoreVehicleChargesVehicleChargeApproximateTotalCharge[0] : car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.ChargeDetails) { if (chargeDetails.RateType == "APPROXIMATE TOTAL PRICE") { //obj.Number_Nights = Convert.ToInt32(chargeDetails.NumDays); total = Convert.ToDouble(chargeDetails.Amount); } if (chargeDetails.RateType == "DAILY RATE") { obj.Cost = Convert.ToDouble(chargeDetails.Amount); } if (chargeDetails.RateType == "WEEKLY RATE") { semanal = Convert.ToDouble(chargeDetails.Amount); } } obj.Number_Nights = (total / 1.16) / obj.Cost; obj.City = car.VehRentalCore.LocationDetails.LocationCode.ToUpper(); obj.In_Date = DateTime.ParseExact(car.VehRentalCore.PickUpDateTime, car.VehRentalCore.PickUpDateTime.Length > 5 ? "MM-ddTHH:mm" : "MM-dd", System.Globalization.CultureInfo.CurrentCulture); obj.Out_Date = DateTime.ParseExact(car.VehRentalCore.ReturnDateTime, car.VehRentalCore.ReturnDateTime.Length > 5 ? "MM-ddTHH:mm" : "MM-dd", System.Globalization.CultureInfo.CurrentCulture); if (obj.Cost.Equals(0)) { if (semanal.Equals(0)) { TimeSpan timespan = obj.Out_Date - obj.In_Date; obj.Number_Nights = timespan.TotalDays; obj.Cost = (total / 1.16) / obj.Number_Nights; } else { obj.Cost = semanal / 7; obj.Number_Nights = (total / 1.16) / obj.Cost; } } else { obj.Number_Nights = (total / 1.16) / obj.Cost; } string codeCityIti = string.Empty; codeCityIti = car.VehRentalCore.LocationDetails.LocationCode; List <ListItem> lstCodCity = new List <ListItem>(); lstCodCity = CatCitiesBL.GetCodeCities(codeCityIti); string country = GetCountryBL.GetCountryByCity(lstCodCity[0].Value); string codeCityDB = string.Empty; if (country.Equals("MX")) { codeCityDB = "AU"; } else { codeCityDB = "AI"; } obj.Service_Type = codeCityDB.ToUpper(); obj.Passenger_Type = passengerType.ToUpper(); obj.Passenger_Num = passengerNum; obj.Passenger_Name = passengerName.ToUpper(); obj.Title = title.ToUpper(); obj.Surname = passengerSurname; obj.Room = "1"; status = car.VehVendorAvail.Vendor.Code.ToUpper(); if (string.IsNullOrEmpty(car.VehRentalCore.LocationDetails.LocationName)) { obj.Hotel = string.Concat(car.VehRentalCore.LocationDetails.LocationCode.ToUpper(), car.VehVendorAvail.Vendor.Code.ToUpper(), "|", GetVendorByCodeBL.GetVendorByCode(car.VehVendorAvail.Vendor.Code.ToUpper()).ToUpper()); } else { string cit = car.VehRentalCore.LocationDetails.LocationName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Substring(0, 3); if (car.VehRentalCore.LocationDetails.LocationName.Length > 3) { string cod = car.VehRentalCore.LocationDetails.LocationName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Substring(3, 1); int numcod = Int32.Parse(Int32.TryParse(car.VehRentalCore.LocationDetails.LocationName.Split( new string[] { " " }, StringSplitOptions.RemoveEmptyEntries )[0].Substring( 4, car.VehRentalCore.LocationDetails.LocationName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Length - 4 ), out numcod) ? car.VehRentalCore.LocationDetails.LocationName.Split( new string[] { " " }, StringSplitOptions.RemoveEmptyEntries )[0].Substring( 4, car.VehRentalCore.LocationDetails.LocationName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Length - 4 ) : "0"); obj.Hotel = string.Concat(cit, car.VehVendorAvail.Vendor.Code.ToUpper(), cod, numcod.ToString("000"), "|", GetVendorByCodeBL.GetVendorByCode(car.VehVendorAvail.Vendor.Code.ToUpper()).ToUpper()); } else { obj.Hotel = string.Concat(cit, car.VehVendorAvail.Vendor.Code.ToUpper(), "|", GetVendorByCodeBL.GetVendorByCode(car.VehVendorAvail.Vendor.Code.ToUpper()).ToUpper()); } } obj.Rate = "VENTA"; obj.Currency = car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.Mileage != null?car.VehVendorAvail.VehResCore.VehicleCharges.VehicleCharge.Mileage.CurrencyCode.ToUpper() : string.Empty; obj.Price = obj.Cost * Convert.ToInt32(obj.Number_Nights); obj.Status = lastStatus; obj.P_Rate = "N/A"; obj.P_Currency = "N/A"; obj.P_IVA = "N/A"; obj.P_ISH = "N/A"; obj.P_Total = "N/A"; if (car.ConfirmationNumber != null) { if (!string.IsNullOrEmpty(car.ConfirmationNumber.ToString())) { obj.Confirmation_Number = car.ConfirmationNumber.ToString().ToUpper(); } } obj.ChainCode = car.VehVendorAvail.Vendor.Code.ToUpper(); DateTime DateIn = DateTime.ParseExact(car.VehRentalCore.PickUpDateTime, car.VehRentalCore.PickUpDateTime.Length > 5 ? "MM-ddTHH:mm" : "MM-dd", System.Globalization.CultureInfo.CurrentCulture); TimeSpan ts = new TimeSpan(); if (DateIn == DateTime.Now) { obj.Time_Limit = DateTime.Now; } else { ts = TimeSpan.FromDays(2); } obj.Time_Limit = DateIn.Subtract(ts); obj.In_City = car.VehVendorAvail.VehResCore.CollectionDeliveryInfo != null? car.VehVendorAvail.VehResCore.CollectionDeliveryInfo.CollectionInfo.Address.CityName.ToUpper() : obj.City; obj.Out_City = car.VehVendorAvail.VehResCore.CollectionDeliveryInfo != null? car.VehVendorAvail.VehResCore.CollectionDeliveryInfo.DeliveryInfo.Address.CityName.ToUpper() : obj.City; string description = string.Empty; string tipoVehiculo = GetTypesCarByCodeBL.GetTypesCarByCode(car.VehVendorAvail.VehResCore.RentalRate.Vehicle.VehType); string equipo = string.Empty; string arrendadora = obj.Hotel.Split('|')[1]; string in_City = GetCityNameBL.GetCityName(obj.In_City); string out_City = GetCityNameBL.GetCityName(obj.Out_City); if (car.VehVendorAvail.VehResCore.PricedEquip.Equipment.SpecialEquipConfirmed == "Y") { equipo = GetEquipmentCarByCodeBL.GetEquipmentCarByCode(car.VehVendorAvail.VehResCore.PricedEquip.Equipment.SpecialEquip).ToUpper(); } description = string.Concat(tipoVehiculo, "|", equipo, "|", arrendadora, "|", in_City, "|", obj.In_Date.ToString(@"dd \de MMMM yyyy HH:mm \HRS", new System.Globalization.CultureInfo("es-MX")), "|", out_City, "|", obj.Out_Date.ToString(@"dd \de MMMM yyyy HH:mm \HRS", new System.Globalization.CultureInfo("es-MX"))); //description = string.Concat("RENTA DE ", !tipoVehiculo.Contains("AUTO") ? "AUTO " : string.Empty, tipoVehiculo, !string.IsNullOrEmpty(equipo) ? " CON " : string.Empty, equipo, " EN ", arrendadora, "); //description = string.Concat(description, "RECIBE: \t", obj.In_Date.ToString(@"dd \de MMMM yyyy HH:mm \HRS", new System.Globalization.CultureInfo("es-MX")), " EN ", arrendadora, " ", in_City, "\n"); //description = string.Concat(description, "ENTREGA:\t", obj.Out_Date.ToString(@"dd \de MMMM yyyy HH:mm \HRS", new System.Globalization.CultureInfo("es-MX")), " EN ", arrendadora, " ", out_City); obj.Description = description.ToUpper(); return(obj); }
public static void SetListBoxCities(TextBox sender, ListBox lbDest) { List <ListItem> CitiesList = CatCitiesBL.GetCities_Predictive(sender.Text); SetListBox(sender, lbDest, CitiesList); }
private OTATravelItineraryObjectHotel GetHotel(TravelItinerary.TravelItineraryReadRSTravelItineraryItineraryInfoItemHotel hotel, string commission, string dk, string phone, string rfc, string agent, string mail, string sixReceived, string passengerType, int passengerNum, string passengerName, string title, string passengerSurname, string lastStatus, List <string> cancelNumberList) { OTATravelItineraryObjectHotel itineraryObject = new OTATravelItineraryObjectHotel(); itineraryObject.Provider_Commission = commission; itineraryObject.Prov_Direct_Pay = true; itineraryObject.DK = dk; itineraryObject.Phone = phone.ToUpper(); itineraryObject.RFC = rfc; itineraryObject.User = agent; itineraryObject.Mail = mail; itineraryObject.Request = sixReceived; itineraryObject.Passenger_Type = passengerType; itineraryObject.Passenger_Num = passengerNum; itineraryObject.Passenger_Name = passengerName; itineraryObject.Title = title; itineraryObject.Surname = passengerSurname; itineraryObject.CancelNumberList = cancelNumberList; itineraryObject.StatusSabre = hotel.Status; string typeCar = string.Empty; typeCar = hotel.Guarantee.Replace("DPST", string.Empty); itineraryObject.Payment_Form = typeCar.Length > 2 ? typeCar.Substring(0, 2) : string.Empty; itineraryObject.Car_Number = Convert.ToInt32(typeCar.Length > 2 ? typeCar.Substring(typeCar.IndexOf("EXP") - 4, 4) : "0"); itineraryObject.Sales_Source = hotel.BasicPropertyInfo.HotelCityCode; itineraryObject.Provider = "3318"; //OBTENER DE CONSULTA itineraryObject.Site = "5475"; //OBTENER DE CONSULTA itineraryObject.Room = hotel.NumberOfUnits; itineraryObject.City = hotel.BasicPropertyInfo.HotelCityCode; itineraryObject.In_Date = DateTime.ParseExact(hotel.TimeSpan.Start, "MM-dd", System.Globalization.CultureInfo.CurrentCulture); itineraryObject.Out_Date = DateTime.ParseExact(hotel.TimeSpan.End, "MM-dd", System.Globalization.CultureInfo.CurrentCulture); if (itineraryObject.Passenger_Num > 1) { itineraryObject.Room_Type = "Double"; } else { itineraryObject.Room_Type = "Single"; } string codeCityIti = string.Empty; codeCityIti = hotel.BasicPropertyInfo.HotelCityCode; List <ListItem> lstCodCity = new List <ListItem>(); lstCodCity = CatCitiesBL.GetCodeCities(codeCityIti); string country = GetCountryBL.GetCountryByCity(lstCodCity.Count > 0 ? lstCodCity[0].Value : string.Empty); string codeCityDB = string.Empty; if (country.Equals("MX") || string.IsNullOrEmpty(country)) { codeCityDB = "H1"; } else { codeCityDB = "H2"; } itineraryObject.Service_Type = codeCityDB; itineraryObject.Number_Nights = Convert.ToInt32(hotel.TimeSpan.Duration ?? 1.ToString()); status = hotel.BasicPropertyInfo.HotelCode; itineraryObject.Hotel = hotel.BasicPropertyInfo.HotelCode + "|" + hotel.BasicPropertyInfo.HotelName; itineraryObject.Rate = "VENTA"; itineraryObject.Currency = hotel.RoomRates.Rate.CurrencyCode; itineraryObject.Cost = Convert.ToDouble(hotel.RoomRates.Rate.Amount.Substring(0, hotel.RoomRates.Rate.Amount.IndexOf('.') + 3)); itineraryObject.Price = itineraryObject.Cost * Convert.ToInt32(itineraryObject.Number_Nights); itineraryObject.Status = lastStatus; itineraryObject.P_Rate = "N/A"; itineraryObject.P_Currency = "N/A"; itineraryObject.P_IVA = "N/A"; itineraryObject.P_ISH = "N/A"; itineraryObject.P_Total = "N/A"; if (hotel.BasicPropertyInfo.ConfirmationNumber != null) { if (!string.IsNullOrEmpty(hotel.BasicPropertyInfo.ConfirmationNumber[0].ToString())) { itineraryObject.Confirmation_Number = hotel.BasicPropertyInfo.ConfirmationNumber[0].ToString(); } } itineraryObject.ChainCode = hotel.BasicPropertyInfo.ChainCode; DateTime DateIn = DateTime.ParseExact(hotel.TimeSpan.Start, "MM-dd", System.Globalization.CultureInfo.CurrentCulture); TimeSpan ts = new TimeSpan(); if (DateIn == DateTime.Now) { itineraryObject.Time_Limit = DateTime.Now; } else { ts = TimeSpan.FromDays(2); } itineraryObject.Time_Limit = DateIn.Subtract(ts); itineraryObject = (itineraryObject != null) ? itineraryObject : new OTATravelItineraryObjectHotel(); return(itineraryObject); }
/// <summary> /// Obtiene informacion de los segmentos de hotel /// </summary> /// <param name="i">indice del segmento en su respectiva list</param> private void BuildHotelInformation(int i) { try { string dayOfWeek = string.Empty; List <ListItem> cityHotel = CatCitiesBL.GetCities(myObject.hotelList[i].hotelCityCode); List <ListItem> codeHotel = CatHotelsBL.GetHotels_Predictive(myObject.hotelList[i].chainCode); myObject.hotelList[i].hotelCityCode = cityHotel[0].Text.Substring(4, cityHotel[0].Text.Length - 4); myObject.hotelList[i].chainCode = codeHotel[0].Text2; if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Sunday") { dayOfWeek = "Domingo"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Monday") { dayOfWeek = "Lunes"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Tuesday") { dayOfWeek = "Martes"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Wednesday") { dayOfWeek = "Miercoles"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Thursday") { dayOfWeek = "Jueves"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Friday") { dayOfWeek = "Viernes"; } else if (myObject.hotelList[i].startDate.DayOfWeek.ToString() == "Saturday") { dayOfWeek = "Sabado"; } if (myObject.hotelList[i].startDate.ToString("dd-MMM-yyyy").ToUpper() != dateSegmnet) { informationDIX = string.Concat(informationDIX, "\n", myObject.hotelList[i].startDate.ToString("dd-MMM-yyyy").ToUpper(), " - ", dayOfWeek, "\n"); } dateSegmnet = myObject.hotelList[i].startDate.ToString("dd-MMM-yyyy").ToUpper(); informationDIX = string.Concat(informationDIX, " HOTEL ", myObject.hotelList[i].hotelCityCode.PadRight(35, ' '), "SALIDA-", myObject.hotelList[i].endDate, "\n"); informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].chainCode.PadRight(35, ' '), myObject.hotelList[i].duration, " NOCHES", "\n"); informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].hotelName.PadRight(35, ' '), myObject.hotelList[i].roomNumbers, (Convert.ToInt32(myObject.hotelList[i].roomNumbers) > 1) ? " HABITACIONES" : " HABITACION", "\n"); for (int j = 0; j < myObject.hotelList[i].address.Count; j++) { if (j == 0) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].address[j].PadRight(35, ' '), myObject.hotelList[i].shortText, "\n"); } else if (j == 1) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].address[j].PadRight(35, ' '), "TARIFA-", (string.IsNullOrEmpty(myObject.hotelList[i].textAmount) ? myObject.hotelList[i].amount : myObject.hotelList[i].textAmount), (!string.IsNullOrEmpty(myObject.hotelList[i].correncyCode)) ? myObject.hotelList[i].correncyCode + " POR NOCHE" : " POR NOCHE", "\n"); } else if (j == 2 && !string.IsNullOrEmpty(myObject.hotelList[i].daysBeforeCancel)) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].address[j].PadRight(35, ' '), "CANCELAR ", myObject.hotelList[i].daysBeforeCancel.Substring(0, 2), (myObject.hotelList[i].daysBeforeCancel.Substring(2, 1) == "H") ? " HORAS ANTES DE LA LLEGADA" : " DIAS ANTES DE LA LLEGADA", "\n"); } else { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].address[j], "\n"); } } if (myObject.hotelList[i].address.Count == 0) { informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), myObject.hotelList[i].shortText, "\n"); informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), "TARIFA-", (string.IsNullOrEmpty(myObject.hotelList[i].textAmount) ? myObject.hotelList[i].amount : myObject.hotelList[i].textAmount), (!string.IsNullOrEmpty(myObject.hotelList[i].correncyCode)) ? myObject.hotelList[i].correncyCode + " POR NOCHE" : " POR NOCHE", "\n"); if (!string.IsNullOrEmpty(myObject.hotelList[i].daysBeforeCancel)) { informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), "CANCELAR ", myObject.hotelList[i].daysBeforeCancel.Substring(0, 2), (myObject.hotelList[i].daysBeforeCancel.Substring(2, 1) == "H") ? " HORAS ANTES DE LA LLEGADA" : " DIAS ANTES DE LA LLEGADA", "\n"); } } if (myObject.hotelList[i].address.Count == 1) { informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), "TARIFA-", (string.IsNullOrEmpty(myObject.hotelList[i].textAmount) ? myObject.hotelList[i].amount : myObject.hotelList[i].textAmount), (!string.IsNullOrEmpty(myObject.hotelList[i].correncyCode)) ? myObject.hotelList[i].correncyCode + " POR NOCHE" : " POR NOCHE", "\n"); if (!string.IsNullOrEmpty(myObject.hotelList[i].daysBeforeCancel)) { informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), "CANCELAR ", myObject.hotelList[i].daysBeforeCancel.Substring(0, 2), (myObject.hotelList[i].daysBeforeCancel.Substring(2, 1) == "H") ? " HORAS ANTES DE LA LLEGADA" : " DIAS ANTES DE LA LLEGADA", "\n"); } } if (myObject.hotelList[i].address.Count == 2 && !string.IsNullOrEmpty(myObject.hotelList[i].daysBeforeCancel)) { informationDIX = string.Concat(informationDIX, " ".PadRight(45, ' '), "CANCELAR ", myObject.hotelList[i].daysBeforeCancel.Substring(0, 2), (myObject.hotelList[i].daysBeforeCancel.Substring(2, 1) == "H") ? " HORAS ANTES DE LA LLEGADA" : " DIAS ANTES DE LA LLEGADA", "\n"); } if (!string.IsNullOrEmpty(myObject.hotelList[i].phone)) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].phone, "\n"); } if (!string.IsNullOrEmpty(myObject.hotelList[i].fax)) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].fax, "\n"); } informationDIX = string.Concat(informationDIX, " LLEGADA GARANTIZADA", "\n"); if (!string.IsNullOrEmpty(myObject.hotelList[i].confirmationNumber)) { informationDIX = string.Concat(informationDIX, " CONFIRMACION ", myObject.hotelList[i].confirmationNumber, "\n"); } if (!string.IsNullOrEmpty(myObject.hotelList[i].specialPrefs)) { informationDIX = string.Concat(informationDIX, " ", myObject.hotelList[i].specialPrefs, "\n"); } } catch { status = false; } }
/// <summary> /// Obtiene información de los segmentos de auto /// </summary> /// <param name="i">indice del segmento en su respectiva lista</param> private void BuildCarInformation(int i) { try { string dayOfWeek = string.Empty; List <ListItem> cityCarRent = CatCitiesBL.GetCities(myObject.autoList[i].locationCode); myObject.autoList[i].locationCode = cityCarRent[0].Text.Substring(4, cityCarRent[0].Text.Length - 4); myObject.autoList[i].vendorCode = GetCatCarVenCodNameBL.GetCatCarVenCodName(myObject.autoList[i].vendorCode); myObject.autoList[i].equipType = GetCatCarTypCodDescriptionBL.GetCatCarTypCodDescription(myObject.autoList[i].equipType); if (!string.IsNullOrEmpty(myObject.autoList[i].specialEquip)) { myObject.autoList[i].specialEquip = GetCatCarEquCodNameBL.GetCatCarEquCodName(myObject.autoList[i].specialEquip); } if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Sunday") { dayOfWeek = "Domingo"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Monday") { dayOfWeek = "Lunes"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Tuesday") { dayOfWeek = "Martes"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Wednesday") { dayOfWeek = "Miercoles"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Thursday") { dayOfWeek = "Jueves"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Friday") { dayOfWeek = "Viernes"; } else if (myObject.autoList[i].dateRent.DayOfWeek.ToString() == "Saturday") { dayOfWeek = "Sabado"; } if (myObject.autoList[i].dateRent.ToString("dd-MMM-yyyy").ToUpper() != dateSegmnet) { informationDIX = string.Concat(informationDIX, "\n", myObject.autoList[i].dateRent.ToString("dd-MMM-yyyy").ToUpper(), " - ", dayOfWeek.ToUpper(), "\n"); } dateSegmnet = myObject.autoList[i].dateRent.ToString("dd-MMM-yyyy").ToUpper(); informationDIX = string.Concat(informationDIX, " AUTO ", myObject.autoList[i].locationCode.PadRight(28, ' '), myObject.autoList[i].vendorCode.Trim().PadRight(28, ' '), (!string.IsNullOrEmpty(myObject.autoList[i].corporateID)) ? "ID EMPRESA-" + myObject.autoList[i].corporateID : "", "\n"); if (!string.IsNullOrEmpty(myObject.autoList[i].hourStart)) { informationDIX = string.Concat(informationDIX, " RECOGER-", myObject.autoList[i].hourStart.PadRight(20, ' '), myObject.autoList[i].equipType, "\n"); } else { informationDIX = string.Concat(informationDIX, " ", myObject.autoList[i].equipType, "\n"); } informationDIX = string.Concat(informationDIX, " DEVOLVER-", myObject.autoList[i].dateReturnCar.PadRight(19, ' '), (!string.IsNullOrEmpty(myObject.autoList[i].clientID) ? myObject.autoList[i].clientID : ""), "\n"); informationDIX = string.Concat(informationDIX, " LLEGADA GARANTIZADA", "\n"); informationDIX = string.Concat(informationDIX, " TARIFA-".PadRight(39, ' '), myObject.autoList[i].mileage.PadRight(26, ' '), (!string.IsNullOrEmpty(myObject.autoList[i].kilometraje)) ? myObject.autoList[i].kilometraje.Substring(0, myObject.autoList[i].kilometraje.Length - 3) + " KILOMETRAJE ILIMITADO" : string.Empty, "\n"); informationDIX = string.Concat(informationDIX, " DIA EXTRA-".PadRight(38, ' '), "KM/MI GRATIS ".PadRight(28, ' '), myObject.autoList[i].amount1, "\n"); informationDIX = string.Concat(informationDIX, " HORA EXTRA-".PadRight(38, ' '), "POR KM/MI".PadRight(28, ' '), myObject.autoList[i].amount2, "\n"); if (!string.IsNullOrEmpty(myObject.autoList[i].specialEquip)) { informationDIX = string.Concat(informationDIX, " ", myObject.autoList[i].specialEquip, "\n"); } informationDIX = string.Concat(informationDIX, " NUM. DE CONFIRMACION".PadRight(38, ' '), myObject.autoList[i].confirmationNumber, "\n"); if (!string.IsNullOrEmpty(myObject.autoList[i].phoneNumber)) { informationDIX = string.Concat(informationDIX, " LLAME AL ", myObject.autoList[i].phoneNumber, "\n"); } if (!string.IsNullOrEmpty(myObject.autoList[i].passengerName)) { informationDIX = string.Concat(informationDIX, " RESP PARA: ", myObject.autoList[i].passengerName, "\n"); } } catch { status = false; } }
/// <summary> /// Obtiene información de los segmentos aereos /// </summary> /// <param name="j">indice del segmento en su respectiva lista</param> private void BuildAirInformation(int j) { try { string tempAirLine = string.Empty; string tempAirLineClass = string.Empty; string descrptionMeal = string.Empty; List <CatAirlines> airlineList = CatAirlinesBL.GetAirlines(myObject.listItineraryInfo[j].airline); List <ListItem> originList = CatCitiesBL.GetCities(myObject.listItineraryInfo[j].origin); List <ListItem> destinationList = CatCitiesBL.GetCities(myObject.listItineraryInfo[j].destination); List <ListItem> airlineClass = CatLineClassesBL.GetAirLinesClasses(myObject.listItineraryInfo[j].resBookDesigCode); if (!string.IsNullOrEmpty(myObject.listItineraryInfo[j].codeMeal) && myObject.listItineraryInfo[j].codeMeal.Length == 1) { descrptionMeal = GetCodeMealToDIXBL.GetCodeMealToDIX(myObject.listItineraryInfo[j].codeMeal).ToUpper(); } else if (!string.IsNullOrEmpty(myObject.listItineraryInfo[j].codeMeal) && myObject.listItineraryInfo[j].codeMeal.Length > 1) { descrptionMeal = "MULTI MEALS"; } else { descrptionMeal = string.Empty; } tempAirLineClass = (airlineClass[0].Text.Contains("TURISTA") ? "ECONOMICA" : airlineClass[0].Text.Substring(2, airlineClass[0].Text.Length - 2)); tempAirLine = airlineList[0].CatAirLinName; myObject.listItineraryInfo[j].origin = originList[0].Text.Substring(4, originList[0].Text.Length - 4); myObject.listItineraryInfo[j].destination = destinationList[0].Text.Substring(4, destinationList[0].Text.Length - 4); if (myObject.listItineraryInfo[j].dayFlight == "Sunday") { myObject.listItineraryInfo[j].dayFlight = "Domingo"; } else if (myObject.listItineraryInfo[j].dayFlight == "Monday") { myObject.listItineraryInfo[j].dayFlight = "Lunes"; } else if (myObject.listItineraryInfo[j].dayFlight == "Tuesday") { myObject.listItineraryInfo[j].dayFlight = "Martes"; } else if (myObject.listItineraryInfo[j].dayFlight == "Wednesday") { myObject.listItineraryInfo[j].dayFlight = "Miercoles"; } else if (myObject.listItineraryInfo[j].dayFlight == "Thursday") { myObject.listItineraryInfo[j].dayFlight = "Jueves"; } else if (myObject.listItineraryInfo[j].dayFlight == "Friday") { myObject.listItineraryInfo[j].dayFlight = "Viernes"; } else if (myObject.listItineraryInfo[j].dayFlight == "Saturday") { myObject.listItineraryInfo[j].dayFlight = "Sabado"; } if (myObject.listItineraryInfo[j].dateFlight.ToString("dd-MMM-yyyy").ToUpper() != dateSegmnet) { informationDIX = string.Concat(informationDIX, "\n", myObject.listItineraryInfo[j].dateFlight.ToString("dd-MMM-yyyy").ToUpper(), " - ", myObject.listItineraryInfo[j].dayFlight.ToUpper(), "\n"); } dateSegmnet = myObject.listItineraryInfo[j].dateFlight.ToString("dd-MMM-yyyy").ToUpper(); informationDIX = string.Concat(informationDIX, " VUELO ", tempAirLine.PadRight(28, ' '), "VLO: ", myObject.listItineraryInfo[j].airline, myObject.listItineraryInfo[j].flightNumber, " ", tempAirLineClass.PadRight(15, ' '), descrptionMeal, "\n"); if (!string.IsNullOrEmpty(myObject.listItineraryInfo[j].operatingAirline)) { informationDIX = string.Concat(informationDIX, " ", "OPERATED BY ", myObject.listItineraryInfo[j].operatingAirline, "\n"); } informationDIX = string.Concat(informationDIX, " SAL ", myObject.listItineraryInfo[j].origin.PadRight(37, ' '), myObject.listItineraryInfo[j].timeDeparture, " ", myObject.listItineraryInfo[j].equipment, "\n"); if (!string.IsNullOrEmpty(myObject.listItineraryInfo[j].terminalDeparture)) { informationDIX = string.Concat(informationDIX, " DEPART: ", myObject.listItineraryInfo[j].terminalDeparture.PadRight(49, ' '), myObject.listItineraryInfo[j].durationFlight, "\n"); } else { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].durationFlight.PadLeft(77, ' '), "\n"); } if (!dateSegmnet.Equals(myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper())) { if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Sunday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Domingo", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Monday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Lunes", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Tuesday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Martes", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Wednesday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Miercoles", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Thursday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Jueves", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Friday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Viernes", "\n"); } else if (Convert.ToString(myObject.listItineraryInfo[j].dateArrival.DayOfWeek).Equals("Saturday")) { informationDIX = string.Concat(informationDIX, myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(), " - ", "Sabado", "\n"); } dateSegmnet = myObject.listItineraryInfo[j].dateArrival.ToString("dd-MMM-yyyy").ToUpper(); } informationDIX = string.Concat(informationDIX, " LLEG ", myObject.listItineraryInfo[j].destination.PadRight(37, ' '), myObject.listItineraryInfo[j].timeArrival, " ", (myObject.listItineraryInfo[j].escala == true) ? "CON ESCALA" : "SIN ESCALA", "\n"); if (!string.IsNullOrEmpty(myObject.listItineraryInfo[j].terminalArrival)) { informationDIX = string.Concat(informationDIX, " ARRIVE: ", myObject.listItineraryInfo[j].terminalArrival.PadRight(49, ' '), "CLAVE: ", myObject.listItineraryInfo[j].airlineRef, "\n"); } else { informationDIX = string.Concat(informationDIX, "CLAVE: ".PadLeft(74, ' '), myObject.listItineraryInfo[j].airlineRef, "\n"); } int aux = 0; string custLoyalty = string.Empty; if (myObject.listItineraryInfo[j].seatsNumber != null) { for (int i = 0; i < myObject.listItineraryInfo[j].seatsNumber.Count; i++) { string temp = myObject.listItineraryInfo[j].seatsNumber[i].paxNumber; for (int k = 0; k < myObject.namePassengerList.Count; k++) { if (myObject.namePassengerList[k].paxNumber == temp) { aux = k; break; } } if (myObject.namePassengerList[aux].custLoyalty.Count > 0) { for (int h = 0; h < myObject.namePassengerList[aux].custLoyalty.Count; h++) { if (myObject.namePassengerList[aux].custLoyalty[h].Substring(0, 2) == myObject.listItineraryInfo[j].airline) { custLoyalty = myObject.namePassengerList[aux].custLoyalty[h]; break; } } } informationDIX = string.Concat(informationDIX, " ", myObject.namePassengerList[aux].paxName.PadRight(27, ' '), " ASIENTO-", myObject.listItineraryInfo[j].seatsNumber[i].seatNumber, " ", custLoyalty, "\n"); } } else { for (int g = 0; g < myObject.namePassengerList.Count; g++) { if (myObject.namePassengerList[g].custLoyalty.Count > 0) { for (int q = 0; q < myObject.namePassengerList[g].custLoyalty.Count; q++) { if (myObject.namePassengerList[g].custLoyalty[q].Substring(0, 2) == myObject.listItineraryInfo[j].airline) { informationDIX = string.Concat(informationDIX, " ", myObject.namePassengerList[g].paxName.PadRight(25, ' '), " ", myObject.namePassengerList[g].custLoyalty[q], "\n"); break; } } } } } for (int i = 0; i < myObject.remarksList.Count; i++) { if (!string.IsNullOrEmpty(myObject.remarksList[i].segmentNumber) && myObject.remarksList[i].segmentNumber == myObject.listItineraryInfo[j].segment) { informationDIX = string.Concat(informationDIX, " ", myObject.remarksList[i].remark, "\n"); } } } catch { status = false; } }
/// <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); } }