本文整理汇总了C#中Common.List.JoinWith方法的典型用法代码示例。如果您正苦于以下问题:C# List.JoinWith方法的具体用法?C# List.JoinWith怎么用?C# List.JoinWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.JoinWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetSearchFilters
/// <summary>
/// Searches the filters.
/// </summary>
/// <param name="passengerPresenter">The passenger presenter.</param>
/// <param name="isExcept">if set to <c>true</c> [is except].</param>
/// <param name="searchType">Type of the search.</param>
/// <param name="pagingPageNumber">The paging page number.</param>
/// <param name="option">The option.</param>
/// <param name="isAll">The is all.</param>
/// <returns>
/// returns search filters
/// </returns>
private SearchFilters SetSearchFilters(PassengerPresenter passengerPresenter, bool isExcept, string searchType, int pagingPageNumber, string option, bool? isAll)
{
var exceptCountries = new List<string>();
List<string> selectedCountries = null;
var filteredCountries = string.Empty;
if (isExcept)
{
foreach (var country in passengerPresenter.Countries)
{
exceptCountries.Add(country.CountryId);
}
if (exceptCountries.Count > 0)
{
if (!string.IsNullOrEmpty(passengerPresenter.SelectedCitizenship))
{
var exceptSelectedCountries = passengerPresenter.SelectedCitizenship.Split(CommaSeparatorChar).Select(i => i.Trim()).Where(i => !string.IsNullOrEmpty(i)).ToList();
foreach (var selectedCountry in exceptSelectedCountries)
{
exceptCountries.Remove(selectedCountry);
}
filteredCountries = exceptCountries.JoinWith(CommaSeparator);
}
}
}
var searchFilter = new SearchFilters();
switch (searchType)
{
case Stateroom:
searchFilter.Stateroom = passengerPresenter.SearchText;
break;
case BookingNo:
searchFilter.ReservationNo = passengerPresenter.SearchText;
break;
case PassportNo:
searchFilter.PassportNo = passengerPresenter.SearchText;
break;
case LastName:
searchFilter.LastNameContains = passengerPresenter.SearchText;
break;
case Birthdate:
searchFilter.Birthdate = passengerPresenter.SearchText;
break;
default:
searchFilter.LastNameContains = passengerPresenter.SearchText;
break;
}
if (!string.IsNullOrEmpty(SessionData.Instance.IsMessageMode) && SessionData.Instance.IsMessageMode.Equals(TrueConstant, StringComparison.OrdinalIgnoreCase))
{
searchFilter.IsMessageCount = true;
searchFilter.IsMessage = true;
passengerPresenter.IsMessage = true;
searchFilter.IsAlertCount = false;
}
else
{
searchFilter.IsMessageCount = false;
searchFilter.IsMessage = false;
passengerPresenter.IsMessage = false;
searchFilter.IsAlertCount = true;
}
searchFilter.PersonTypeId = !string.IsNullOrEmpty(option) ? option : passengerPresenter.SelectedPassengerType;
searchFilter.VoyageId = passengerPresenter.SelectedVoyage;
if (!string.IsNullOrWhiteSpace(passengerPresenter.SelectedCitizenship))
{
selectedCountries = passengerPresenter.SelectedCitizenship.Split(',').ToList();
}
searchFilter.Citizenship = isExcept ? filteredCountries : selectedCountries != null && selectedCountries.Count == SessionData.Instance.MasterData.Countries.Count ? string.Empty : passengerPresenter.SelectedCitizenship;
searchFilter.MaxResult = ApplicationSettings.MaxPageSize;
searchFilter.PageNumber = pagingPageNumber > 0 ? pagingPageNumber : 1;
searchFilter.IsAll = isAll;
return searchFilter;
}