• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Framework.SqlBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Gentle.Framework.SqlBuilder的典型用法代码示例。如果您正苦于以下问题:C# SqlBuilder类的具体用法?C# SqlBuilder怎么用?C# SqlBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SqlBuilder类属于Gentle.Framework命名空间,在下文中一共展示了SqlBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RemoveAllAttendancesOfEvent

        public void RemoveAllAttendancesOfEvent(Event anEvent)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_event", anEvent.Id);

            SqlStatement stmt = sb.GetStatement(true);
            stmt.Execute();
        }
开发者ID:TheProjecter,项目名称:zaspe-sharp,代码行数:8,代码来源:AttendanceManager.Methods.cs


示例2: RemoveAllAttendancesOfPerson

        public void RemoveAllAttendancesOfPerson(Person aPerson)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_person", aPerson.Id);

            SqlStatement stmt = sb.GetStatement(true);
            stmt.Execute();
        }
开发者ID:TheProjecter,项目名称:zaspe-sharp,代码行数:8,代码来源:AttendanceManager.Methods.cs


示例3: OnActivated

    public void OnActivated()
    {
      try
      {
        Application.DoEvents();

        Cursor.Current = Cursors.WaitCursor;

        UpdateMenuAndTabs();

        listView1.Items.Clear();
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (GroupMap));

        sb.AddConstraint(Operator.Equals, "idGroup", _channelGroup.IdGroup);
        sb.AddOrderByField(true, "sortOrder");

        SqlStatement stmt = sb.GetStatement(true);

        IList<GroupMap> maps = ObjectFactory.GetCollection<GroupMap>(stmt.Execute());

        foreach (GroupMap map in maps)
        {
          Channel channel = map.ReferencedChannel();
          if (!channel.IsTv)
          {
            continue;
          }
          listView1.Items.Add(CreateItemForChannel(channel, map));
        }
        bool isAllChannelsGroup = (_channelGroup.GroupName == TvConstants.TvGroupNames.AllChannels);
        removeChannelFromGroup.Enabled = !isAllChannelsGroup;
        mpButtonDel.Enabled = !isAllChannelsGroup;

        if (_channelGroup.GroupName != TvConstants.TvGroupNames.AllChannels)
        {
          labelPinCode.Visible = true;
          textBoxPinCode.Visible = true;
          textBoxPinCode.Text = _channelGroup.PinCode;
        }

      }
      catch (Exception exp)
      {
        Log.Error("OnActivated error: {0}", exp.Message);
      }
      finally
      {
        Cursor.Current = Cursors.Default;
      }
    }
开发者ID:Eddie-Jee,项目名称:MediaPortal-1,代码行数:50,代码来源:ChannelsInGroupControl.cs


示例4: CreateShareForm_Load

        private void CreateShareForm_Load(object sender, EventArgs e)
        {
            _channelNameLabel.Text = this.Channel.DisplayName;
            LoadGroups();

            LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(this.Channel);
            if (linkedChannel != null)
            {
                SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.GroupMap));
                sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id);
                SqlResult result = Broker.Execute(sb.GetStatement());
                List<TvDatabase.GroupMap> groupMaps = (List<TvDatabase.GroupMap>)
                    ObjectFactory.GetCollection(typeof(TvDatabase.GroupMap), result, new List<TvDatabase.GroupMap>());
                if (groupMaps.Count > 0)
                {
                    foreach (ListViewItem item in _groupsListView.Items)
                    {
                        if (item.Tag is int
                            && (int)item.Tag == groupMaps[0].IdGroup)
                        {
                            item.Selected = true;
                            _groupsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }

                    foreach (ListViewItem item in _channelsListView.Items)
                    {
                        ChannelItem channelItem = item.Tag as ChannelItem;
                        if (channelItem.Channel.IdChannel == linkedChannel.Id)
                        {
                            item.Selected = true;
                            _channelsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }
                }
            }
        }
开发者ID:Christoph21x,项目名称:ARGUS-TV,代码行数:47,代码来源:CreateChannelLinkForm.cs


示例5: OnPageLoad

    protected override void OnPageLoad()
    {
      Log.Debug("zaposd pageload");
      // following line should stay. Problems with OSD not
      // appearing are already fixed elsewhere
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
      sb.AddConstraint(Operator.Equals, "istv", 1);
      sb.AddOrderByField(true, "sortOrder");
      SqlStatement stmt = sb.GetStatement(true);
      ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());

      AllocResources();
      // if (g_application.m_pPlayer) g_application.m_pPlayer.ShowOSD(false);
      ResetAllControls(); // make sure the controls are positioned relevant to the OSD Y offset
      m_bNeedRefresh = false;
      m_dateTime = DateTime.Now;
      channelNr = GetChannelNumber();
      channelName = GetChannelName();
      idChannel = GetIdChannel();
      SetCurrentChannelLogo();
      base.OnPageLoad();

      GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100000 + GetID));
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:24,代码来源:TVZapOSD.cs


示例6: RetrieveOnce

    /// <summary>
    /// Retreives the first found instance of a 'Once' typed schedule given its Channel,Title,Start and End Times 
    /// </summary>
    /// <param name="idChannel">Channel id to look for</param>
    /// <param name="programName">Title we wanna look for</param>
    /// <param name="startTime">StartTime</param>
    /// <param name="endTime">EndTime</param>
    /// <returns>schedule instance or null</returns>
    public static Schedule RetrieveOnce(int idChannel, string programName, DateTime startTime, DateTime endTime)
    {
      //select * from 'foreigntable'
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Schedule));

      // 
      sb.AddConstraint(Operator.Equals, "scheduleType", 0);
      sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
      sb.AddConstraint(Operator.Equals, "programName", programName);
      sb.AddConstraint(Operator.Equals, "startTime", startTime);
      sb.AddConstraint(Operator.Equals, "endTime", endTime);
      // passing true indicates that we'd like a list of elements, i.e. that no primary key
      // constraints from the type being retrieved should be added to the statement
      SqlStatement stmt = sb.GetStatement(true);

      // execute the statement/query and create a collection of User instances from the result set
      IList<Schedule> getList = ObjectFactory.GetCollection<Schedule>(stmt.Execute());
      if (getList.Count != 0)
      {
        return getList[0];
      }
      return null;

      // TODO In the end, a GentleList should be returned instead of an arraylist
      //return new GentleList( typeof(ChannelMap), this );
    }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:34,代码来源:Schedule.cs


示例7: ConflictingSchedules

    /// <summary>
    /// Get a list of Conflicts referring to the current entity.
    /// </summary>
    public IList<Conflict> ConflictingSchedules()
    {
      //select * from 'foreigntable'
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Conflict));

      // where foreigntable.foreignkey = ourprimarykey
      sb.AddConstraint(Operator.Equals, "idConflictingSchedule", idSchedule);

      // passing true indicates that we'd like a list of elements, i.e. that no primary key
      // constraints from the type being retrieved should be added to the statement
      SqlStatement stmt = sb.GetStatement(true);

      // execute the statement/query and create a collection of User instances from the result set
      return ObjectFactory.GetCollection<Conflict>(stmt.Execute());

      // TODO In the end, a GentleList should be returned instead of an arraylist
      //return new GentleList( typeof(CanceledSchedule), this );
    }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:21,代码来源:Schedule.cs


示例8: GetChannelByName

        /// <summary>
        /// Provides a wrapper for getting the channel by Name from the database.
        /// </summary>
        /// <param name="channelName">Channel Name.</param>
        /// <param name="idTvChannel">The id tv channel.</param>
        /// <returns>true if the channel name was found</returns>
        protected bool GetChannelByName(string channelName, out int idTvChannel)
        {
            //Channel fch = Channel.Retrieve(
             idTvChannel = -1;
             SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel));

             sb.AddConstraint(Operator.Equals, "displayName", channelName.ToString());

             SqlStatement stmt = sb.GetStatement(true);

             System.Collections.IList chList = ObjectFactory.GetCollection(typeof(Channel), stmt.Execute());

             if (chList.Count > 0)
             {
            idTvChannel = ((Channel)chList[0]).IdChannel;
            return true;
             }

             return false;
        }
开发者ID:ijprest,项目名称:mp-schedulesdirect,代码行数:26,代码来源:EpgListingsImporter.cs


示例9: FindNoEPGSchedule

    public static Schedule FindNoEPGSchedule(Channel channel)
    {
      int idChannel = channel.IdChannel;

      //select * from 'foreigntable'
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Schedule));

      // 
      sb.AddConstraint(Operator.Equals, "scheduleType", 0);
      sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
      sb.AddConstraint(Operator.Equals, "idParentSchedule", -1);
      sb.AddConstraint(Operator.Equals, "series", false);
      // passing true indicates that we'd like a list of elements, i.e. that no primary key
      // constraints from the type being retrieved should be added to the statement
      SqlStatement stmt = sb.GetStatement(true);

      // execute the statement/query and create a collection of User instances from the result set
      IList<Schedule> getList = ObjectFactory.GetCollection<Schedule>(stmt.Execute());
      if (getList.Count != 0)
      {
        return getList[0];
      }
      return null;
    }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:24,代码来源:Schedule.cs


示例10: Retrieve

    /// <summary>
    /// Retrieves an entity given it's filename.
    /// </summary>
    public static Recording Retrieve(string fileName)
    {
      // Return null if id is smaller than seed and/or increment for autokey
      if (string.IsNullOrEmpty(fileName))
      {
        return null;
      }

      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Recording));
      sb.AddConstraint(Operator.Equals, "fileName", fileName);

      SqlStatement stmt = sb.GetStatement(true);

      // execute the statement/query and create a collection of User instances from the result set
      IList<Recording> getList = ObjectFactory.GetCollection<Recording>(stmt.Execute());
      if (getList.Count != 0)
      {
        return getList[0];
      }
      return null;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:24,代码来源:Recording.cs


示例11: OnMessage

    public override bool OnMessage(GUIMessage message)
    {
      switch (message.Message)
      {
        case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: // fired when OSD is hidden
          {
            //if (g_application.m_pPlayer) g_application.m_pPlayer.ShowOSD(true);
            // following line should stay. Problems with OSD not
            // appearing are already fixed elsewhere
            //for (int i = (int)Controls.Panel1; i < (int)Controls.Panel2; i++)
            //{
            //  HideControl(GetID, i);
            //}
            Dispose();
            GUIPropertyManager.SetProperty("#currentmodule", GUIWindowManager.GetWindow(message.Param1).GetModuleName());
            return true;
          }


        case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: // fired when OSD is shown
          {
            // following line should stay. Problems with OSD not
            // appearing are already fixed elsewhere
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
            sb.AddConstraint(Operator.Equals, "istv", 1);
            sb.AddOrderByField(true, "sortOrder");
            SqlStatement stmt = sb.GetStatement(true);
            listTvChannels = ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());
            GUIPropertyManager.SetProperty("#currentmodule", GetModuleName());
            previousProgram = null;
            AllocResources();
            // if (g_application.m_pPlayer) g_application.m_pPlayer.ShowOSD(false);
            ResetAllControls(); // make sure the controls are positioned relevant to the OSD Y offset
            isSubMenuVisible = false;
            m_iActiveMenuButtonID = 0;
            m_iActiveMenu = 0;
            m_bNeedRefresh = false;
            m_dateTime = DateTime.Now;
            Reset();
            FocusControl(GetID, (int)Controls.OSD_PLAY, 0); // set focus to play button by default when window is shown
            ShowPrograms();
            QueueAnimation(AnimationType.WindowOpen);
            for (int i = (int)Controls.Panel1; i < (int)Controls.Panel2; i++)
            {
              ShowControl(GetID, i);
            }
            if (g_Player.Paused)
            {
              ToggleButton((int)Controls.OSD_PLAY, true);
              // make sure play button is down (so it shows the pause symbol)
            }
            else
            {
              ToggleButton((int)Controls.OSD_PLAY, false); // make sure play button is up (so it shows the play symbol)
            }
            m_delayInterval = MediaPortal.Player.Subtitles.SubEngine.GetInstance().DelayInterval;
            if (m_delayInterval > 0)
              m_subtitleDelay = MediaPortal.Player.Subtitles.SubEngine.GetInstance().Delay / m_delayInterval;
            m_delayIntervalAudio = PostProcessingEngine.GetInstance().AudioDelayInterval;
            if (m_delayIntervalAudio > 0)
              m_audioDelay = PostProcessingEngine.GetInstance().AudioDelay / m_delayIntervalAudio;

            g_Player.UpdateMediaInfoProperties();
            GUIPropertyManager.SetProperty("#TV.View.HasTeletext", TVHome.Card.HasTeletext.ToString());

            MediaPortal.Player.VideoStreamFormat videoFormat = g_Player.GetVideoFormat();

            GUIPropertyManager.SetProperty("#Play.Current.TSBitRate",
             ((float)MediaPortal.Player.g_Player.GetVideoFormat().bitrate / 1024 / 1024).ToString("0.00", CultureInfo.InvariantCulture));

            GUIPropertyManager.SetProperty("#Play.Current.VideoFormat.RawResolution",
              videoFormat.width.ToString() + "x" + videoFormat.height.ToString());

            GUIPropertyManager.SetProperty("#TV.TuningDetails.FreeToAir", string.Empty);

            Channel chan = TVHome.Navigator.Channel;
            if (chan != null)
            {
              IList<TuningDetail> details = chan.ReferringTuningDetail();
              if (details.Count > 0)
              {
                TuningDetail detail = null;
                switch (TVHome.Card.Type)
                {
                  case TvLibrary.Interfaces.CardType.Analog:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 0)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.Atsc:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 1)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.DvbC:
                    foreach (TuningDetail t in details)
//.........这里部分代码省略.........
开发者ID:cmendozac,项目名称:MediaPortal-1,代码行数:101,代码来源:TvOSD.cs


示例12: GetProgramAt

 public Program GetProgramAt(DateTime date, string title)
 {
   //IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
   //DateTime startTime = DateTime.Now;
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
   sb.AddConstraint(Operator.Equals, "Title", title);
   sb.AddConstraint(Operator.Equals, "idChannel", IdChannel);
   sb.AddConstraint(Operator.GreaterThan, "endTime", date);
   sb.AddConstraint(Operator.LessThanOrEquals, "startTime", date);
   sb.AddOrderByField(true, "startTime");
   sb.SetRowLimit(1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Program> programs = ObjectFactory.GetCollection<Program>(stmt.Execute());
   if (programs.Count == 0)
   {
     return null;
   }
   return programs[0];
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:19,代码来源:Channel.cs


示例13: UpdateNowAndNext

    private void UpdateNowAndNext()
    {
      if (_currentProgram != null)
      {
        if (DateTime.Now >= _currentProgram.StartTime && DateTime.Now <= _currentProgram.EndTime)
        {
          return;
        }
      }

      _currentProgram = null;
      _nextProgram = null;

      DateTime date = DateTime.Now;
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
      sb.AddConstraint(Operator.Equals, "idChannel", IdChannel);
      sb.AddConstraint(Operator.GreaterThanOrEquals, "endTime", date);
      sb.AddOrderByField(true, "startTime");
      sb.SetRowLimit(2);
      SqlStatement stmt = sb.GetStatement(true);
      IList<Program> programs = ObjectFactory.GetCollection<Program>(stmt.Execute());
      if (programs.Count == 0)
      {
        return;
      }
      _currentProgram = programs[0];
      if (_currentProgram.StartTime >= date)
      {
        _nextProgram = _currentProgram;
        _currentProgram = null;
      }
      else
      {
        if (programs.Count == 2)
        {
          _nextProgram = programs[1];
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:39,代码来源:Channel.cs


示例14: ContainsInGenre

 /// <summary>
 /// Get a list which contains token in the description
 /// </summary>
 private IList<Program> ContainsInGenre(string Token)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
   sb.AddConstraint(Operator.Like, "genre", "%" + Token + "%");
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<Program>(stmt.Execute());
 }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:10,代码来源:PersonalTVGuide.cs


示例15: getTvServerChannels

    private void getTvServerChannels()
    {
      CBChannelGroup chGroup = (CBChannelGroup)GroupComboBox.SelectedItem;

      IList<Channel> Channels;
      if (chGroup != null && chGroup.idGroup != -1)
      {
        SqlBuilder sb1 = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof (Channel));
        SqlStatement stmt1 = sb1.GetStatement(true);
        SqlStatement ManualJoinSQL = new SqlStatement(stmt1.StatementType, stmt1.Command,
                                                      String.Format(
                                                        "select c.* from Channel c join {0}GroupMap g on c.idChannel=g.idChannel where c.{1} = 1 and g.idGroup = '{2}' order by g.sortOrder",
                                                        IsTvMapping ? "" : "Radio", IsTvMapping ? "isTv" : "isRadio",
                                                        chGroup.idGroup), typeof (Channel));
        Channels = ObjectFactory.GetCollection<Channel>(ManualJoinSQL.Execute());
      }
      else
      {
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
        sb.AddOrderByField(true, "sortOrder");
        if (IsTvMapping)
        {
          sb.AddConstraint("isTv = 1");
        }
        else
        {
          sb.AddConstraint("isRadio = 1");
        }
        SqlStatement stmt = sb.GetStatement(true);
        Channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
      }

      foreach (Channel chan in Channels)
      {
        if (!_channelMapping.ContainsKey(chan.DisplayName))
        {
          ChannelMap channel = new ChannelMap();
          channel.displayName = chan.DisplayName;
          _channelMapping.Add(chan.DisplayName, channel);
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:42,代码来源:WebEPGMappingControl.cs


示例16: Import

    public bool Import(string fileName, bool deleteBeforeImport, bool showProgress)
    {
      //System.Diagnostics.Debugger.Launch();
      _errorMessage = "";
      if (_isImporting == true)
      {
        _errorMessage = "already importing...";
        return false;
      }
      _isImporting = true;

      bool result = false;
      XmlTextReader xmlReader = null;


      // remove old programs
      _status.Status = "Removing old programs";
      _status.Channels = 0;
      _status.Programs = 0;
      _status.StartTime = DateTime.Now;
      _status.EndTime = new DateTime(1971, 11, 6);
      if (showProgress && ShowProgress != null) ShowProgress(_status);

      layer.RemoveOldPrograms();

      /*
      // for each channel, get the last program's time
      Dictionary<int, DateTime> lastProgramForChannel = new Dictionary<int, DateTime>();
      IList channels = Channel.ListAll();
      foreach (Channel ch in channels)
      {
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.Program));
        sb.AddConstraint(Operator.Equals, "idChannel", ch.IdChannel);
        sb.AddOrderByField(false, "starttime");
        sb.SetRowLimit(1);
        SqlStatement stmt = sb.GetStatement(true);
        IList programsInDbs = ObjectFactory.GetCollection(typeof(TvDatabase.Program), stmt.Execute());

        DateTime lastProgram = DateTime.MinValue;
        if (programsInDbs.Count > 0)
        {
          TvDatabase.IProgram p = (TvDatabase.Program)programsInDbs[0];
          lastProgram = p.EndTime;
        }
        lastProgramForChannel[ch.IdChannel] = lastProgram;
      }*/

      //TVDatabase.SupressEvents = true;
      bool useTimeZone = layer.GetSetting("xmlTvUseTimeZone", "false").Value == "true";
      int hours = Int32.Parse(layer.GetSetting("xmlTvTimeZoneHours", "0").Value);
      int mins = Int32.Parse(layer.GetSetting("xmlTvTimeZoneMins", "0").Value);
      int timeZoneCorrection = hours * 60 + mins;

      ArrayList Programs = new ArrayList();
      Dictionary<int, ChannelPrograms> dChannelPrograms = new Dictionary<int, ChannelPrograms>();
      try
      {
        Log.WriteFile("xmltv import {0}", fileName);

        //
        // Make sure the file exists before we try to do any processing
        //
        if (File.Exists(fileName))
        {
          _status.Status = "Loading channel list";
          _status.Channels = 0;
          _status.Programs = 0;
          _status.StartTime = DateTime.Now;
          _status.EndTime = new DateTime(1971, 11, 6);
          if (showProgress && ShowProgress != null) ShowProgress(_status);

          Dictionary<int, Channel> guideChannels = new Dictionary<int, Channel>();

          IList<Channel> allChannels = Channel.ListAll();

          int iChannel = 0;

          xmlReader = new XmlTextReader(fileName);

          #region import non-mapped channels by their display-name

          if (xmlReader.ReadToDescendant("tv"))
          {
            // get the first channel
            if (xmlReader.ReadToDescendant("channel"))
            {
              do
              {
                String id = xmlReader.GetAttribute("id");
                if (id == null || id.Length == 0)
                {
                  Log.Error("  channel#{0} doesnt contain an id", iChannel);
                }
                else
                {
                  String displayName = null;

                  XmlReader xmlChannel = xmlReader.ReadSubtree();
                  xmlChannel.ReadStartElement(); // read channel
                  // now, xmlChannel is positioned on the first sub-element of <channel>
//.........这里部分代码省略.........
开发者ID:hkjensen,项目名称:MediaPortal-1,代码行数:101,代码来源:XMLTVImport.cs


示例17: UpdateProgram

        /// <summary>
        /// Update the Program in the database if it exists or add if it is new.
        /// </summary>
        /// <param name="mpProgram">The Program to add to the database</param>
        protected void UpdateProgram(Program mpProgram)
        {
            IFormatProvider mmddFormat = new System.Globalization.CultureInfo(String.Empty, false);
             SqlBuilder sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(Program));
             // startTime < MyEndTime AND endTime > MyStartTime
             // OR ==
             string sqlW1 = String.Format("(StartTime < '{0}' and EndTime > '{1}')", mpProgram.EndTime.ToString(tvLayer.GetDateTimeString(), mmddFormat), mpProgram.StartTime.ToString(tvLayer.GetDateTimeString(), mmddFormat));
             string sqlW2 = String.Format("(StartTime = '{0}' and EndTime = '{1}')", mpProgram.StartTime.ToString(tvLayer.GetDateTimeString(), mmddFormat), mpProgram.EndTime.ToString(tvLayer.GetDateTimeString(), mmddFormat));

             sb.AddConstraint(Operator.Equals, "idChannel", mpProgram.IdChannel);
             sb.AddConstraint(string.Format("({0} or {1}) ", sqlW1, sqlW2));
             sb.AddOrderByField(true, "starttime");

             SqlStatement stmt = sb.GetStatement(true);
             IList progList = ObjectFactory.GetCollection(typeof(Program), stmt.Execute());

             if (progList.Count > 0)
             {
            bool bMatch = false;
            foreach (Program prog in progList)
            {
               if (!bMatch && prog.StartTime == mpProgram.StartTime && prog.EndTime == mpProgram.EndTime && prog.Title == mpProgram.Title)
               {
                  //update - but only allow one match
                  bMatch = true;
                  prog.Classification  = mpProgram.Classification;
                  prog.Description     = mpProgram.Description;
                  prog.EpisodeNum      = mpProgram.EpisodeNum;
                  prog.Genre           = mpProgram.Genre;
                  prog.OriginalAirDate = mpProgram.OriginalAirDate;
                  prog.SeriesNum       = mpProgram.SeriesNum;
                  prog.StarRating      = mpProgram.StarRating;
                  prog.Title           = mpProgram.Title;
                  prog.EpisodeName     = mpProgram.EpisodeName;
                  prog.Persist();
               }
               else
                  prog.Delete();
            }
            if (!bMatch)
               mpProgram.Persist();
             }
             else
             {
            mpProgram.Persist();
             }
        }
开发者ID:ijprest,项目名称:mp-schedulesdirect,代码行数:51,代码来源:EpgListingsImporter.cs


示例18: LookupEPGMapping

        /// <summary>
        /// Provides a wrapper for getting the channel by xmlTvId from the database.
        /// </summary>
        /// <param name="xmlTvId">xmlTvId aka ExternalID</param>
        /// <param name="idTvChannel">The id tv channel.</param>
        /// <param name="strTvChannel">The name tv channel.</param>
        /// <returns>true if the channel name was found</returns>
        protected bool LookupEPGMapping(string xmlTvId, out int idTvChannel, out string strTvChannel)
        {
            //Channel fch = Channel.Retrieve(
            idTvChannel  = -1;
            strTvChannel = String.Empty;

            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel));

            sb.AddConstraint(Operator.Equals, "externalId", xmlTvId.ToString());

            SqlStatement stmt = sb.GetStatement(true);

            System.Collections.IList chList = ObjectFactory.GetCollection(typeof(Channel), stmt.Execute());

            if (chList.Count > 0)
            {
               idTvChannel  = ((Channel)chList[0]).IdChannel;
               strTvChannel = ((Channel)chList[0]).DisplayName;
               return true;
            }

            return false;
        }
开发者ID:ijprest,项目名称:mp-schedulesdirect,代码行数:30,代码来源:EpgListingsImporter.cs


示例19: ActiveRecording

    public static Recording ActiveRecording(string title, int idChannel)
    {
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Recording));
      sb.AddConstraint(Operator.Equals, "isRecording", true);
      sb.AddConstraint(Operator.Equals, "title", title);
      sb.AddConstraint(Operator.Equals, "idChannel", idChannel);

      SqlStatement stmt = sb.GetStatement(true);

      // execute the statement/query and create a collection of User instances from the result set
      IList<Recording> getList = ObjectFactory.GetCollection<Recording>(stmt.Execute());
      if (getList.Count != 0)
      {
        return getList[0];
      }
      return null;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:17,代码来源:Recording.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GeoLib.C2DPoint类代码示例发布时间:2022-05-26
下一篇:
C# Controls.NuGenPaintParams类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap