public Layer5705.RequestPassenger ToLayer5705(PassengerRequest passenger, DateTime departDate, QueryCars.Result.AgeRestrictions ageLimits) { if (passenger == null) { throw new ArgumentNullException(nameof(passenger)); } return(new Layer5705.RequestPassenger { Id = passenger.Ref, LastName = passenger.LastName, FirstName = passenger.FirstName, MidName = passenger.MiddleName, Gender = passenger.Gender.Value == Gender.FEMALE ? Layer5705.Gender.FEMALE : Layer5705.Gender.MALE, Birthdate = passenger.BirthDate?.ToString("dd.MM.yyyy"), DocType = ConvertDocType(passenger.Passport.Type), DocNumber = passenger.Passport.Series + passenger.Passport.Number, Country = passenger.Passport.Citizenship.RzdId ?? 114, Tariff = GetTariffByBirthDate(passenger.BirthDate.Value, departDate, ageLimits), Insurance = passenger.InsuranceProviderId, PolicyDate = passenger.PolicyEndDate, LoyalNum = passenger.LoalityCardNumber, UniversalNum = passenger.PartnerCardNumber, Volunteer = passenger.PartnerCardNumber != null }); }
protected override bool isValid(out string exceptionMessage) { if (name.Length == 0) { return makeExceptionMessage (out exceptionMessage, "The name of the passenger is invalid"); } PassengerRequest pr = new PassengerRequest (); if (pr.fetchPassengerFromName (name).Count () != 0) { return makeExceptionMessage(out exceptionMessage, "There is already a passenger with the given name"); } return makeExceptionMessage(out exceptionMessage); }