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


C# Framework.SqlBuilder类代码示例

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


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


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