Ejemplo n.º 1
0
        protected void CopyTo <T>(T dataItem) where T : BasePNRDataItem
        {
            dataItem.ID      = ID;
            dataItem.IDInPNR = IDInPNR;
            dataItem.Type    = Type;

            if (TravellerRef != null)
            {
                dataItem.TravellerRef = new RefList <int>(TravellerRef);
            }
            if (ServiceRef != null)
            {
                dataItem.ServiceRef = new RefList <int>(ServiceRef);
            }
            if (SegmentRef != null)
            {
                dataItem.SegmentRef = new RefList <int>(SegmentRef);
            }

            #region Клонирование внутренних элементов
            switch (Type)
            {
            case PNRDataItemType.Remark:
                dataItem.Remark = Remark?.Copy();
                break;

            case PNRDataItemType.TL:
                dataItem.TimeLimits = TimeLimits?.Copy();
                break;

            case PNRDataItemType.SSR:
                dataItem.SSR = SSR?.DeepCopy();
                break;

            case PNRDataItemType.Commission:
                dataItem.Commission = Commission?.Copy();
                break;

            case PNRDataItemType.FOP:
                dataItem.FOPInfo = FOPInfo?.Copy();
                break;

            case PNRDataItemType.SourceInfo:
                dataItem.SourceInfo = SourceInfo?.Copy();
                break;

            case PNRDataItemType.IDDocument:
                dataItem.Document = Document?.Copy();
                break;

            case PNRDataItemType.ContactInfo:
                dataItem.ContactInfo = ContactInfo?.Copy();
                break;

            case PNRDataItemType.LoyaltyCard:
                dataItem.LoyaltyCard = LoyaltyCard?.Copy();
                break;

            case PNRDataItemType.Meal:
                dataItem.Meal = Meal?.DeepCopy();
                break;

            case PNRDataItemType.ED:
                dataItem.ElectronicDocument = ElectronicDocument?.DeepCopy();
                break;

            case PNRDataItemType.PD:
                dataItem.PaperDocument = PaperDocument?.Copy();
                break;

            case PNRDataItemType.FE:
                dataItem.Endorsements = Endorsements?.Copy();
                break;

            case PNRDataItemType.Visa:
                dataItem.Visa = Visa?.Copy();
                break;

            case PNRDataItemType.ArrivalAddress:
                dataItem.ArrivalAddress = ArrivalAddress?.Copy();
                break;

            case PNRDataItemType.BookedSeat:
                dataItem.BookedSeat = BookedSeat?.Copy();
                break;

            case PNRDataItemType.ValidatingCompany:
                dataItem.ValidatingCompany = ValidatingCompany?.Copy();
                break;

            case PNRDataItemType.TourCode:
                dataItem.TourCode = TourCode?.Copy();
                break;

            case PNRDataItemType.Discount:
                dataItem.Discount = Discount?.Copy();
                break;

            case PNRDataItemType.FareSourceCode:
                dataItem.FareSourceCode = FareSourceCode?.Copy();
                break;

            case PNRDataItemType.AdditionalLocators:
                dataItem.AdditionalLocators = AdditionalLocators?.Copy();
                break;

            case PNRDataItemType.OSI:
                dataItem.OSI = OSI?.Copy();
                break;

            case PNRDataItemType.ReferencedBooks:
                dataItem.ReferencedBooks = ReferencedBooks?.Copy();
                break;

            case PNRDataItemType.FareInfo:
                dataItem.FareInfo = FareInfo?.Copy();
                break;

            case PNRDataItemType.DiscountDocument:
                dataItem.DiscountDocument = DiscountDocument?.Copy();
                break;

            case PNRDataItemType.VoucherFile:
                dataItem.Voucher = Voucher?.Copy();
                break;

            case PNRDataItemType.LinkedBooks:
                dataItem.LinkedBooks = LinkedBooks?.Copy();
                break;
            }
            #endregion
        }