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


C# SqlBuilder.SetRowLimit方法代码示例

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


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

示例1: GetRecordingByFileName

 public Recording GetRecordingByFileName(string fileName)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Recording));
   sb.AddConstraint(Operator.Equals, "fileName", fileName);
   sb.SetRowLimit(1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Recording> recordings = ObjectFactory.GetCollection<Recording>(stmt.Execute());
   if (recordings.Count == 0)
   {
     return null;
   }
   return recordings[0];
 }
开发者ID:sekotin,项目名称:MediaPortal-1,代码行数:13,代码来源:BusinessLayer.cs

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

示例3: GetNewestProgramForChannel

 public DateTime GetNewestProgramForChannel(int idChannel)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
   sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
   sb.AddOrderByField(false, "startTime");
   sb.SetRowLimit(1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Program> progs = ObjectFactory.GetCollection<Program>(stmt.Execute());
   return progs.Count > 0 ? progs[0].StartTime : DateTime.MinValue;
 }
开发者ID:sekotin,项目名称:MediaPortal-1,代码行数:10,代码来源:BusinessLayer.cs

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

示例5: GetChannelIdByDisplayName

 private int GetChannelIdByDisplayName(string aChannelName)
 {
   int channelId = -1;
   if (string.IsNullOrEmpty(aChannelName))
     return channelId;
   try
   {
     SqlBuilder sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(Channel));
     sb.AddConstraint(Operator.Equals, "displayName", aChannelName);
     sb.SetRowLimit(1);
     SqlStatement stmt = sb.GetStatement(true);
     IList channels = ObjectFactory.GetCollection(typeof(Channel), stmt.Execute());
     if (channels.Count == 1)
       channelId = ((Channel)channels[0]).IdChannel;
   }
   catch (Exception ex)
   {
     MessageBox.Show(string.Format("Could not get ChannelID for DisplayName: {0}\n{1}", aChannelName, ex.Message));
   }
   return channelId;
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:21,代码来源:formMatroskaImporter.cs

示例6: RetrieveLast

        public Event[] RetrieveLast(int numberOfEvents)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Event));
            sb.SetRowLimit(numberOfEvents);
            sb.AddOrderByField(false, "date");
            sb.AddConstraint(Operator.LessThanOrEquals, "date", DateTime.Now);

            SqlStatement stmt = sb.GetStatement(true);

            IList events = ObjectFactory.GetCollection(typeof(Event), stmt.Execute());

            List<Event> events_result = new List<Event>();
            foreach (Event e in events)
                events_result.Add(e);

            return events_result.ToArray();
        }
开发者ID:TheProjecter,项目名称:zaspe-sharp,代码行数:17,代码来源:EventsManager.Methods.cs

示例7: RetrieveLastEventsAttended

        public IList<Attendance> RetrieveLastEventsAttended(Person aPerson, int numberOfEvents)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Attendance));
            sb.SetRowLimit(numberOfEvents);
            sb.AddOrderByField(false, "date");

            SqlStatement stmt = sb.GetStatement(true);

            Attendance[] attendances =
                (Attendance[])ObjectFactory.GetCollection(typeof(Attendance), stmt.Execute());

            return attendances;
        }
开发者ID:TheProjecter,项目名称:zaspe-sharp,代码行数:13,代码来源:AttendanceManager.Methods.cs

示例8: GetLastProgramEntry

        /// <summary>
        /// Gets the DateTime of the last program entry or now if MinValue if there are no program entries in the database.
        /// </summary>
        /// <returns></returns>
        protected static DateTime GetLastProgramEntry()
        {
            //long lastEntry;
              //// FIXME: Why is the GetLastProgramEntry call returning a string? Should probably natively return a long.
              //Int64.TryParse(TVDatabase.GetLastProgramEntry(), out lastEntry);
              //DateTime lastDate = (lastEntry == 0) ? DateTime.MinValue : MediaPortal.Util.Utils.longtodate(Convert.ToInt64(lastEntry));
              //return lastDate;

              SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Program));
              IFormatProvider mmddFormat = new System.Globalization.CultureInfo(String.Empty, false);

              sb.SetRowLimit(1);
              sb.AddOrderByField(false, "EndTime");

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

              if (progs.Count >= 1)
              {
            Program lProgram = (Program)progs[0];
            return lProgram.EndTime;
              }

              return DateTime.MinValue;
        }
开发者ID:ijprest,项目名称:mp-schedulesdirect,代码行数:29,代码来源:SchedulesDirectPluginTVE3.cs


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