TvDatabase.TvBusinessLayer.GetTVGuideChannelsForGroup C# (CSharp) Method

GetTVGuideChannelsForGroup() public method

Gets a list of tv channels sorted by their group
public GetTVGuideChannelsForGroup ( int groupID ) : List
groupID int
return List
    public List<Channel> GetTVGuideChannelsForGroup(int groupID)
    {
      SqlBuilder sb1 = new SqlBuilder(StatementType.Select, typeof (Channel));
      SqlStatement stmt1 = sb1.GetStatement(true);
      SqlStatement ManualJoinSQL = new SqlStatement(stmt1.StatementType, stmt1.Command,
                                                    String.Format(
                                                      "select c.* from Channel c inner join GroupMap g on (c.idChannel=g.idChannel and g.idGroup = '{0}') where visibleInGuide = 1 and isTv = 1 order by g.sortOrder",
                                                      groupID), typeof (Channel));
      return ObjectFactory.GetCollection<Channel>(ManualJoinSQL.Execute()) as List<Channel>;
    }

Usage Example

示例#1
0
    private List<Channel> GetChannelListByGroup()
    {
      int idGroup = TVHome.Navigator.CurrentGroup.IdGroup;

      if (_tvGroupChannelListCache == null)
      {
        _tvGroupChannelListCache = new Dictionary<int, List<Channel>>();
      }

      List<Channel> channels = null;
      if (_tvGroupChannelListCache.TryGetValue(idGroup, out channels))  //already in cache ? then return it.      
      {
        Log.Debug("TvMiniGuide: GetChannelListByGroup returning cached version of channels.");
        return channels;
      }
      else //not in cache, fetch it and update cache, then return.
      {
        TvBusinessLayer layer = new TvBusinessLayer();
        List<Channel> tvChannelList = layer.GetTVGuideChannelsForGroup(idGroup);

        if (tvChannelList != null)
        {
          Log.Debug("TvMiniGuide: GetChannelListByGroup caching channels from DB.");
          _tvGroupChannelListCache.Add(idGroup, tvChannelList);
          return tvChannelList;
        }
      }
      return new List<Channel>();
    }
All Usage Examples Of TvDatabase.TvBusinessLayer::GetTVGuideChannelsForGroup
TvBusinessLayer