private string[] GetIncludedDestinations()
        {
            if (_opportunity.Contains(Opportunity.HowDoYouWantToSearch))
            {
                var howDoYouWantToSearch =
                    (HowDoYouWantToSearch)_opportunity.GetAttributeValue <OptionSetValue>(Opportunity.HowDoYouWantToSearch).Value;
                switch (howDoYouWantToSearch)
                {
                case HowDoYouWantToSearch.All:
                    return(new string[] { ((int)HowDoYouWantToSearch.All).ToString() });

                case HowDoYouWantToSearch.ByCountry:
                    var destinationCountry1 = CrmService.GetIso2Code(_client, _opportunity.GetAttributeValue <EntityReference>(Opportunity.DestinationCountry1)?.Id) + " - " + _opportunity.GetAttributeValue <EntityReference>(Opportunity.DestinationCountry1)?.Name;
                    return(new[] { destinationCountry1, ((int)HowDoYouWantToSearch.ByCountry).ToString() });

                case HowDoYouWantToSearch.ByRegion:
                    var destinationRegion1 = CrmService.GetRegionCode(_client, _opportunity.GetAttributeValue <EntityReference>(Opportunity.Region1)?.Id);
                    return(new[] { destinationRegion1, ((int)HowDoYouWantToSearch.ByRegion).ToString() });

                case HowDoYouWantToSearch.ByHotel:
                    var hotel1 = CrmService.GetHotelCode(_client, _opportunity.GetAttributeValue <EntityReference>(Opportunity.Hotel1)?.Id);
                    return(new[] { hotel1, ((int)HowDoYouWantToSearch.ByHotel).ToString() });

                case HowDoYouWantToSearch.ByDestinationAirport:
                    var destinationAirport1 = _opportunity.GetAttributeValue <EntityReference>(Opportunity.DestinationAirport1)?.Name;
                    return(new[] { destinationAirport1, ((int)HowDoYouWantToSearch.ByDestinationAirport).ToString() });

                default:
                    return(new string[] { });
                }
            }
            return(new string[] { });
        }
 private string GetGatewayOwrName(EntityReference gatewayRef)
 {
     if (gatewayRef != null)
     {
         var gatewayOwrName = gatewayRef.Id + " - " + CrmService.GetAirportName(_client, gatewayRef.Id) + " - " + gatewayRef.Name;
         return(gatewayOwrName);
     }
     return("");
 }
        private AddressOwr[] GetAddresses()
        {
            var addresses = new[]
            {
                new AddressOwr
                {
                    FlatNumberUnit = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1FlatOrUnitNumber) ?
                                     ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1FlatOrUnitNumber]).Value.ToString():"",
                    HouseNumberBuilding = _opportunity.Contains(AliasName.ContactAliasName +
                                                                Crm.Common.Constants.Attributes.Customer.Address1HouseNumberOrBuilding)?
                                          ((AliasedValue)_opportunity[AliasName.ContactAliasName +
                                                                      Crm.Common.Constants.Attributes.Customer.Address1HouseNumberOrBuilding]).Value.ToString():"",
                    Town = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1Town)?
                           ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1Town]).Value.ToString():"",
                    Country = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1CountryId) ?
                              CrmService.GetIso2Code(_client, ((EntityReference)((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1CountryId]).Value)?.Id) : "",
                    County = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1County)?
                             ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1County]).Value.ToString():"",
                    PostalCode = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1PostalCode)?
                                 ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1PostalCode]).Value.ToString():""
                },
                new AddressOwr
                {
                    FlatNumberUnit = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2FlatOrUnitNumber)?
                                     ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2FlatOrUnitNumber]).Value.ToString():"",
                    HouseNumberBuilding = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2HouseNumberOrBuilding)?
                                          ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2HouseNumberOrBuilding]).Value.ToString():"",
                    Town = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2Town)?
                           ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2Town]).Value.ToString():"",
                    Country = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2CountryId)?
                              CrmService.GetIso2Code(_client, ((EntityReference)((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address1CountryId]).Value)?.Id) : "",
                    County = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2County)?
                             ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2County]).Value.ToString():"",
                    PostalCode = _opportunity.Contains(AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2PostalCode)?
                                 ((AliasedValue)_opportunity[AliasName.ContactAliasName + Crm.Common.Constants.Attributes.Customer.Address2PostalCode]).Value.ToString():""
                }
            };

            return(addresses);
        }