本文整理匯總了C#中TvDatabase.TvBusinessLayer.GetAllRadioChannels方法的典型用法代碼示例。如果您正苦於以下問題:C# TvBusinessLayer.GetAllRadioChannels方法的具體用法?C# TvBusinessLayer.GetAllRadioChannels怎麽用?C# TvBusinessLayer.GetAllRadioChannels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.GetAllRadioChannels方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReLoad
public void ReLoad()
{
//System.Diagnostics.Debugger.Launch();
try
{
SetupDatabaseConnection();
Log.Info("get channels from database");
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
sb.AddConstraint(Operator.Equals, "isTv", 1);
sb.AddOrderByField(true, "sortOrder");
SqlStatement stmt = sb.GetStatement(true);
channels = ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());
Log.Info("found:{0} tv channels", channels.Count);
TvNotifyManager.OnNotifiesChanged();
m_groups.Clear();
TvBusinessLayer layer = new TvBusinessLayer();
RadioChannelGroup allRadioChannelsGroup =
layer.GetRadioChannelGroupByName(TvConstants.RadioGroupNames.AllChannels);
IList<Channel> radioChannels = layer.GetAllRadioChannels();
if (radioChannels != null)
{
if (radioChannels.Count > allRadioChannelsGroup.ReferringRadioGroupMap().Count)
{
foreach (Channel radioChannel in radioChannels)
{
layer.AddChannelToRadioGroup(radioChannel, allRadioChannelsGroup);
}
}
}
Log.Info("Done.");
Log.Info("get all groups from database");
sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
sb.AddOrderByField(true, "groupName");
stmt = sb.GetStatement(true);
IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
IList<GroupMap> allgroupMaps = GroupMap.ListAll();
bool hideAllChannelsGroup = false;
using (
Settings xmlreader =
new MPSettings())
{
hideAllChannelsGroup = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false);
}
foreach (ChannelGroup group in groups)
{
if (group.GroupName == TvConstants.TvGroupNames.AllChannels)
{
foreach (Channel channel in channels)
{
if (channel.IsTv == false)
{
continue;
}
bool groupContainsChannel = false;
foreach (GroupMap map in allgroupMaps)
{
if (map.IdGroup != group.IdGroup)
{
continue;
}
if (map.IdChannel == channel.IdChannel)
{
groupContainsChannel = true;
break;
}
}
if (!groupContainsChannel)
{
layer.AddChannelToGroup(channel, TvConstants.TvGroupNames.AllChannels);
}
}
break;
}
}
groups = ChannelGroup.ListAll();
foreach (ChannelGroup group in groups)
{
//group.GroupMaps.ApplySort(new GroupMap.Comparer(), false);
if (hideAllChannelsGroup && group.GroupName.Equals(TvConstants.TvGroupNames.AllChannels) && groups.Count > 1)
{
continue;
}
m_groups.Add(group);
}
Log.Info("loaded {0} tv groups", m_groups.Count);
//TVHome.Connected = true;
}
catch (Exception ex)
{
Log.Error("TVHome: Error in Reload");
Log.Error(ex);
//TVHome.Connected = false;
}
//.........這裏部分代碼省略.........