Esempio n. 1
0
        /// <summary>
        /// Выполняет полное копирование объекта, реализация интерфейса ICloneable
        /// </summary>
        /// <returns>Результат копирования</returns>
        public SearchFlightsRQBody Clone()
        {
            var result = new SearchFlightsRQBody();

            result.MultiOWRequestedSegmentNumber = MultiOWRequestedSegmentNumber;
            result.UserRequestedClass            = UserRequestedClass;

            result.RequestedFlightInfo         = new RequestElements.FlightDirection();
            result.RequestedFlightInfo.ODPairs = new RequestElements.FlightPairList();
            result.Passengers = new List <Passenger>();

            result.RequestedFlightInfo.AroundDates = RequestedFlightInfo.AroundDates;
            result.RequestedFlightInfo.Direct      = RequestedFlightInfo.Direct;
            result.RequestedFlightInfo.ForcedType  = RequestedFlightInfo.ForcedType;
            result.RequestedFlightInfo.SubType     = RequestedFlightInfo.SubType;

            foreach (var seg in RequestedFlightInfo.ODPairs)
            {
                result.RequestedFlightInfo.ODPairs.Add(seg.FullCopy());
            }

            foreach (var pass in Passengers)
            {
                var tmpPass = new Passenger();
                tmpPass.Count = pass.Count;
                tmpPass.Type  = pass.Type;

                result.Passengers.Add(tmpPass);
            }

            if (Restrictions != null)
            {
                result.Restrictions = new RequestElements.AdditionalSearchInfo();
                result.Restrictions.ClassPreference = new RequestElements.ClassPrefList();
                result.Restrictions.ClassPreference.AddRange(Restrictions.ClassPreference);
                result.Restrictions.PrivateFaresOnly           = Restrictions.PrivateFaresOnly;
                result.Restrictions.SourcePreference           = Restrictions.SourcePreference;
                result.Restrictions.MaxConnectionTime          = Restrictions.MaxConnectionTime;
                result.Restrictions.ResultsGrouping            = Restrictions.ResultsGrouping;
                result.Restrictions.MaxResultCount             = Restrictions.MaxResultCount;
                result.Restrictions.PriceRefundType            = Restrictions.PriceRefundType;
                result.Restrictions.AsyncSearch                = Restrictions.AsyncSearch;
                result.Restrictions.AdditionalPublicFaresOnly  = Restrictions.AdditionalPublicFaresOnly;
                result.Restrictions.MaxConnections             = Restrictions.MaxConnections;
                result.Restrictions.RequestorTags              = Restrictions.RequestorTags;
                result.Restrictions.ThreeDomainAgreementNumber = Restrictions.ThreeDomainAgreementNumber;

                if (Restrictions.CompanyFilter != null)
                {
                    result.Restrictions.CompanyFilter = new List <Company>();
                    foreach (var oldComp in Restrictions.CompanyFilter)
                    {
                        var comp = new Company();
                        comp.Code          = oldComp.Code;
                        comp.Include       = oldComp.Include;
                        comp.SegmentNumber = oldComp.SegmentNumber;

                        result.Restrictions.CompanyFilter.Add(comp);
                    }
                }
            }

            if (EndUserData != null)
            {
                result.EndUserData = new EndUserDataDataItem();
                result.EndUserData.EndUserBrowserAgent = EndUserData.EndUserBrowserAgent;
                result.EndUserData.EndUserIP           = EndUserData.EndUserIP;
                result.EndUserData.RequestOrigin       = EndUserData.RequestOrigin;
            }

            return(result);
        }
		/// <summary>
		/// Выполняет полное копирование объекта, реализация интерфейса ICloneable
		/// </summary>
		/// <returns>Результат копирования</returns>
		public SearchFlightsRQBody Clone()
		{
			var result = new SearchFlightsRQBody();

			result.MultiOWRequestedSegmentNumber = MultiOWRequestedSegmentNumber;

			result.RequestedFlightInfo = new RequestElements.FlightDirection();
			result.RequestedFlightInfo.ODPairs = new RequestElements.FlightPairList();
			result.Passengers = new List<Passenger>();

			result.RequestedFlightInfo.AroundDates = RequestedFlightInfo.AroundDates;
			result.RequestedFlightInfo.Direct = RequestedFlightInfo.Direct;
			result.RequestedFlightInfo.Type = RequestedFlightInfo.Type;
			result.RequestedFlightInfo.SubType = RequestedFlightInfo.SubType;

			foreach (var seg in RequestedFlightInfo.ODPairs)
			{
				result.RequestedFlightInfo.ODPairs.Add(seg.FullCopy());
			}

			foreach (var pass in Passengers)
			{
				var tmpPass = new Passenger();
				tmpPass.Count = pass.Count;
				tmpPass.Type = pass.Type;

				result.Passengers.Add(tmpPass);
			}

			if (Restrictions != null)
			{
				result.Restrictions = new RequestElements.AdditionalSearchInfo();
				result.Restrictions.ClassPreference = Restrictions.ClassPreference;
				result.Restrictions.CurrencyCode = Restrictions.CurrencyCode;
				result.Restrictions.PrivateFaresOnly = Restrictions.PrivateFaresOnly;
				result.Restrictions.SourcePreference = Restrictions.SourcePreference;
				result.Restrictions.MaxConnectionTime = Restrictions.MaxConnectionTime;
				result.Restrictions.ResultsGrouping = Restrictions.ResultsGrouping;
				result.Restrictions.MaxResultCount = Restrictions.MaxResultCount;

				if (Restrictions.CompanyFilter != null)
				{
					result.Restrictions.CompanyFilter = new List<Company>();
					foreach (var oldComp in Restrictions.CompanyFilter)
					{
						var comp = new Company();
						comp.Code = oldComp.Code;
						comp.Include = oldComp.Include;
						comp.SegmentNumber = oldComp.SegmentNumber;

						result.Restrictions.CompanyFilter.Add(comp);
					}
				}
			}

			if (EndUserData != null)
			{
				result.EndUserData = new EndUserDataDataItem();
				result.EndUserData.EndUserBrowserAgent = EndUserData.EndUserBrowserAgent;
				result.EndUserData.EndUserIP = EndUserData.EndUserIP;
				result.EndUserData.RequestOrigin = EndUserData.RequestOrigin;
			}

			return result;
		}