当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.GetRadioChannelGroupByName方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetRadioChannelGroupByName方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetRadioChannelGroupByName方法的具体用法?C# TvBusinessLayer.GetRadioChannelGroupByName怎么用?C# TvBusinessLayer.GetRadioChannelGroupByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetRadioChannelGroupByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Importxmlfile


//.........这里部分代码省略.........
                            textoutput(mapcount + " channels assigned to group " + groupName);
                        }
                        catch (Exception exc)
                        {
                            textoutput("<RED>TvChannels: Failed to add group " + idGroup + " group name " + groupName);
                            if (DEBUG == true)
                            {
                                textoutput("<RED>Exception message is " + exc.Message);
                            }
                            //return false;
                        }
                    }
                    textoutput(channelGroupCount + " channel group settings imported");
                    progressbar((int)PB_action.STOP, ref PB_Import, (int)PB_part.TV_TvGroups);
                }

                // Import Radio channel groups
                if (radiogroups == true)
                {
                    progressbar((int)PB_action.START, ref PB_Import, (int)PB_part.TV_Radiogroups);
                    textoutput("Importing radio channel group settings");

                    XmlNodeList radiochannelGroupList = doc.SelectNodes("/tvserver/radiochannelgroups/radiochannelgroup");
                    radiochannelGroupCount = 0;
                    foreach (XmlNode radionodeChannelGroup in radiochannelGroupList)
                    {
                        int idGroup = Int32.Parse(radionodeChannelGroup.Attributes["IdGroup"].Value);
                        string groupName = radionodeChannelGroup.Attributes["GroupName"].Value;
                        try
                        {
                            radiochannelGroupCount++;
                            string radiogroupName = radionodeChannelGroup.Attributes["GroupName"].Value;
                            int radiogroupSortOrder = Int32.Parse(radionodeChannelGroup.Attributes["SortOrder"].Value);
                            RadioChannelGroup radiogroup = layer.GetRadioChannelGroupByName(radiogroupName);
                            if (radiogroup == null)
                                radiogroup = new RadioChannelGroup(radiogroupName, radiogroupSortOrder);
                            radiogroup.Persist();
                            XmlNodeList radiomappingList = radionodeChannelGroup.SelectNodes("mappings/radiomap");
                            int mapcount = 0;
                            foreach (XmlNode radionodeMap in radiomappingList)
                            {
                                mapcount++;
                                //string channelname = radionodeMap.Attributes["ChannelName"].Value;
                                string displayname = radionodeMap.Attributes["DisplayName"].Value;
                                Channel channel = mygetChannelbyName(displayname);

                                int sortOrder = Int32.Parse(GetNodeAttribute(radionodeMap, "SortOrder", "9999"));
                                int idMap = Int32.Parse(GetNodeAttribute(radionodeMap, "IdMap", "0"));
                                if (channel != null)
                                {
                                    RadioGroupMap radiomap = new RadioGroupMap(radiogroup.IdGroup, channel.IdChannel, sortOrder);
                                    radiomap.SortOrder = sortOrder;
                                    radiomap.Persist();
                                }
                                else
                                {
                                    textoutput("<YELLOW>Channel " + displayname + " (Display: " + displayname + ") could not be assigned to group " + radiogroupName + " in map number " + idMap);
                                }
                            }
                            textoutput(mapcount + " channels assigned to group " + groupName);
                        }
                        catch (Exception exc)
                        {
                            textoutput("<RED>RadioChannels: Failed to add radio group " + idGroup + " group name " + groupName);
                            if (DEBUG == true)
                            {
开发者ID:huha001,项目名称:BackupSettings,代码行数:67,代码来源:BackupSettingsExportImport.cs

示例2: 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;
      }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:TVHomeNavigator.cs

示例3: importButton_Click


//.........这里部分代码省略.........
                  }
                  else
                  {
                    foreach (GroupMap map in channel.ReferringGroupMap())
                    {
                      if (map.IdGroup == group.IdGroup)
                      {
                        map.SortOrder = sortOrder;
                        map.Persist();
                        break;
                      }
                    }
                  }
                }
              }
            }
            catch (Exception exg)
            {
              Log.Error("TvChannels: Failed to add group - {0}", exg.Message);
            }
          }
        }

        if (radioChannelGroupList != null && importradiogroups)
        {
          // Import radio channel groups
          foreach (XmlNode nodeChannelGroup in radioChannelGroupList)
          {
            try
            {
              radioChannelGroupCount++;
              string groupName = nodeChannelGroup.Attributes["GroupName"].Value;
              int groupSortOrder = Int32.Parse(nodeChannelGroup.Attributes["SortOrder"].Value);
              RadioChannelGroup group = layer.GetRadioChannelGroupByName(groupName) ??
                                        new RadioChannelGroup(groupName, groupSortOrder);
              group.Persist();
              XmlNodeList mappingList = nodeChannelGroup.SelectNodes("mappings/map");
              foreach (XmlNode nodeMap in mappingList)
              {
                IList<Channel> channels = layer.GetChannelsByName(nodeMap.Attributes["ChannelName"].Value);
                int sortOrder = Int32.Parse(GetNodeAttribute(nodeMap, "SortOrder", "9999"));
                if (channels != null && channels.Count > 0)
                {
                  Channel channel = channels[0];
                  if (!channel.GroupNames.Contains(group.GroupName))
                  {
                    RadioGroupMap map = new RadioGroupMap(group.IdGroup, channel.IdChannel, sortOrder);
                    map.Persist();
                  }
                  else
                  {
                    foreach (RadioGroupMap map in channel.ReferringRadioGroupMap())
                    {
                      if (map.IdGroup == group.IdGroup)
                      {
                        map.SortOrder = sortOrder;
                        map.Persist();
                        break;
                      }
                    }
                  }
                }
              }
            }
            catch (Exception exg)
            {
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:67,代码来源:ImportExport.cs


注:本文中的TvDatabase.TvBusinessLayer.GetRadioChannelGroupByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。