本文整理汇总了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];
}
示例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];
}
}
}
示例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;
}
示例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];
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}