本文整理汇总了C#中Gentle.Framework.SqlBuilder.GetStatement方法的典型用法代码示例。如果您正苦于以下问题:C# SqlBuilder.GetStatement方法的具体用法?C# SqlBuilder.GetStatement怎么用?C# SqlBuilder.GetStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gentle.Framework.SqlBuilder
的用法示例。
在下文中一共展示了SqlBuilder.GetStatement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitChannels
private void InitChannels()
{
listViewChannels.Clear();
listViewChannels.BeginUpdate();
try
{
SqlBuilder sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof (Channel));
if (checkBoxGuideChannels.Checked)
{
sb.AddConstraint(Operator.Equals, "visibleInGuide", 1);
}
sb.AddConstraint(Operator.Equals, "isTv", 1);
sb.AddOrderByField(true, "sortOrder");
sb.AddOrderByField(true, "displayName");
SqlStatement stmt = sb.GetStatement(true);
IList<Channel> channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
for (int i = 0; i < channels.Count; i++)
{
// TODO: add imagelist with channel logos from MP :)
ListViewItem curItem = new ListViewItem(channels[i].DisplayName);
curItem.Tag = channels[i];
listViewChannels.Items.Add(curItem);
}
}
finally
{
listViewChannels.EndUpdate();
}
mpButtonOk.Enabled = (listViewChannels.Items.Count > 0);
}
示例2: GetSetting
/// <summary>
/// gets a value from the database table "Setting"
/// </summary>
/// <returns>A Setting object with the stored value, if it doesnt exist the given default string will be the value</returns>
private Setting GetSetting(string tagName, string defaultValue)
{
if (defaultValue == null)
{
return null;
}
if (tagName == null)
{
return null;
}
if (tagName == "")
{
return null;
}
SqlBuilder sb;
try
{
sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(Setting));
}
catch (TypeInitializationException)
{
return new Setting(tagName,defaultValue);
}
sb.AddConstraint(Operator.Equals, "tag", tagName);
SqlStatement stmt = sb.GetStatement(true);
IList<Setting> settingsFound = ObjectFactory.GetCollection<Setting>(stmt.Execute());
if (settingsFound.Count == 0)
{
Setting set = new Setting(tagName, defaultValue);
set.Persist();
return set;
}
return settingsFound[0];
}
示例3: 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();
}
示例4: 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();
}
示例5: 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;
}
}
示例6: 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;
}
}
}
}
}
示例7: GetTVGuideChannelsForGroup
/// <summary>
/// Gets a list of tv channels sorted by their group
/// </summary>
/// <returns>a list of TVDatabase Channels</returns>
public List<Channel> GetTVGuideChannelsForGroup(int groupID)
{
SqlBuilder sb1 = new SqlBuilder(StatementType.Select, typeof (Channel));
SqlStatement stmt1 = sb1.GetStatement(true);
SqlStatement ManualJoinSQL = new SqlStatement(stmt1.StatementType, stmt1.Command,
String.Format(
"select c.* from Channel c inner join GroupMap g on (c.idChannel=g.idChannel and g.idGroup = '{0}') where visibleInGuide = 1 and isTv = 1 order by g.sortOrder",
groupID), typeof (Channel));
return ObjectFactory.GetCollection<Channel>(ManualJoinSQL.Execute()) as List<Channel>;
}
示例8: GetChannelsInGroup
public IList<Channel> GetChannelsInGroup(ChannelGroup group)
{
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
SqlStatement origStmt = sb.GetStatement(true);
string sql = "select c.* from channel c inner join groupmap gm on (c.idChannel = gm.idChannel and gm.idGroup =" +
group.IdGroup + ") order by gm.SortOrder asc";
SqlStatement statement = new SqlStatement(StatementType.Select, origStmt.Command, sql,
typeof (Channel));
return ObjectFactory.GetCollection<Channel>(statement.Execute());
}
示例9: GetTuningDetailsByName
public IList<TuningDetail> GetTuningDetailsByName(string name, int channelType)
{
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail));
sb.AddConstraint(Operator.Equals, "name", name);
sb.AddConstraint(Operator.Equals, "channelType", channelType);
SqlStatement stmt = sb.GetStatement(true);
IList<TuningDetail> details = ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());
return details;
}
示例10: GetTuningDetail
public TuningDetail GetTuningDetail(String url, int channelType)
{
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TuningDetail));
sb.AddConstraint(Operator.Equals, "url", url);
sb.AddConstraint(Operator.Equals, "channelType", channelType);
SqlStatement stmt = sb.GetStatement(true);
IList<TuningDetail> details = ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());
if (details == null)
{
return null;
}
if (details.Count == 0)
{
return null;
}
return details[0];
}
示例11: IsChannelMappedToCard
public bool IsChannelMappedToCard(Channel dbChannel, Card card, bool forEpg)
{
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelMap));
SqlStatement origStmt = sb.GetStatement(true);
string sql = "select cm.* from ChannelMap cm where cm.idChannel =" +
dbChannel.IdChannel + " and cm.idCard=" + card.IdCard + (forEpg ? "" : " and cm.epgOnly=0");
SqlStatement statement = new SqlStatement(StatementType.Select, origStmt.Command, sql,
typeof (Channel));
IList<ChannelMap> maps = ObjectFactory.GetCollection<ChannelMap>(statement.Execute());
return maps != null && maps.Count > 0;
}
示例12: GetGroupByName
public ChannelGroup GetGroupByName(string aGroupName, int aSortOrder)
{
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
sb.AddConstraint(Operator.Like, "groupName", "%" + aGroupName + "%");
// use like here since the user might have changed the casing
if (aSortOrder > -1)
{
sb.AddConstraint(Operator.Equals, "sortOrder", aSortOrder);
}
SqlStatement stmt = sb.GetStatement(true);
Log.Debug(stmt.Sql);
IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
if (groups == null)
{
return null;
}
if (groups.Count == 0)
{
return null;
}
return groups[0];
}
示例13: RemoveAllPrograms
public void RemoveAllPrograms(int idChannel)
{
SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof (Program));
sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
SqlStatement stmt = sb.GetStatement(true);
ObjectFactory.GetCollection<Program>(stmt.Execute());
}
示例14: RemoveOldPrograms
public void RemoveOldPrograms(int idChannel)
{
SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof (Program));
DateTime dtToKeep = DateTime.Now.AddHours(-EpgKeepDuration);
IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
sb.AddConstraint(String.Format("endTime < '{0}'", dtToKeep.ToString(GetDateTimeString(), mmddFormat)));
SqlStatement stmt = sb.GetStatement(true);
ObjectFactory.GetCollection<Program>(stmt.Execute());
}
示例15: GetLinkagesForChannel
public IList<ChannelLinkageMap> GetLinkagesForChannel(Channel channel)
{
IList<ChannelLinkageMap> pmap = channel.ReferringLinkedChannels();
if (pmap != null)
{
if (pmap.Count > 0)
return pmap;
}
SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelLinkageMap));
sb.AddConstraint(Operator.Equals, "idLinkedChannel", channel.IdChannel);
SqlStatement stmt = sb.GetStatement(true);
return ObjectFactory.GetCollection<ChannelLinkageMap>(stmt.Execute());
}