本文整理汇总了C#中Bobs.Usr.PlacesVisit方法的典型用法代码示例。如果您正苦于以下问题:C# Usr.PlacesVisit方法的具体用法?C# Usr.PlacesVisit怎么用?C# Usr.PlacesVisit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bobs.Usr
的用法示例。
在下文中一共展示了Usr.PlacesVisit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(Usr u)
{
AllMusicTypes = null;
SelectedMusicTypes = null;
GenericMusicTypes = null;
SelectedPlaces = null;
MusicQ = null;
PlaceQ = null;
#region Populate MusicQ and MusicTypes
if (u.FavouriteMusicTypeK == 0 && u.MusicTypesFavouriteCount == 0)
{
MusicQ = new Q(true);
}
else
{
List<int> musicTypesK = new List<int>();
#region Add MusicTypes
if (u.MusicTypesFavouriteCount > 0)
{
foreach (MusicType mt in u.MusicTypesFavourite)
{
if (!musicTypesK.Contains(mt.K))
{
musicTypesK.Add(mt.K);
AllMusicTypes.Add(mt.Order, mt);
SelectedMusicTypes.Add(mt.Order, mt);
AddMusicTypeChildren(mt, ref musicTypesK);
#region Add the parent
if (u.UpdateSendGenericMusic && mt.ParentK > 1 && !musicTypesK.Contains(mt.ParentK))
{
musicTypesK.Add(mt.ParentK);
AllMusicTypes.Add(mt.Parent.Order, mt.Parent);
GenericMusicTypes.Add(mt.Parent.Order, mt.Parent);
}
#endregion
}
}
}
else
{
if (u.FavouriteMusicTypeK != 0)
{
musicTypesK.Add(u.FavouriteMusicTypeK);
AllMusicTypes.Add(u.FavouriteMusicType.Order, u.FavouriteMusicType);
SelectedMusicTypes.Add(u.FavouriteMusicType.Order, u.FavouriteMusicType);
AddMusicTypeChildren(u.FavouriteMusicType, ref musicTypesK);
}
}
if (u.UpdateSendGenericMusic && !musicTypesK.Contains(1))
{
musicTypesK.Add(1);
MusicType mtAllMusic = new MusicType(1);
AllMusicTypes.Add(mtAllMusic.Order, mtAllMusic);
GenericMusicTypes.Add(mtAllMusic.Order, mtAllMusic);
}
#endregion
musicTypesK.Sort();
MusicQ = new Or(musicTypesK.ConvertAll<Q>(mtk => new Q(EventMusicType.Columns.MusicTypeK, mtk)).ToArray());
}
#endregion
#region Populate PlaceQ and SelectedPlaces
List<int> placesK = new List<int>();
if (u.HomePlaceK > 0)
{
placesK.Add(u.HomePlaceK);
SelectedPlaces.Add(u.Home.Name, u.Home);
}
foreach (Place p in u.PlacesVisit(null, 0))
{
if (!placesK.Contains(p.K))
{
placesK.Add(p.K);
SelectedPlaces.Add(p.Name, p);
}
}
if (placesK.Count > 0)
{
placesK.Sort();
PlaceQ = new Or(placesK.ConvertAll<Q>(pk => new Q(Venue.Columns.PlaceK, pk)).ToArray());
}
else
{
PlaceQ = new Q(false);
}
#endregion
}