本文整理汇总了C#中Query.AND方法的典型用法代码示例。如果您正苦于以下问题:C# Query.AND方法的具体用法?C# Query.AND怎么用?C# Query.AND使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.AND方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: objdsOrders_Selecting
/// <summary>
/// pass filter field AND contact id for selecting by user
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void objdsOrders_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
Int32 _userid = Page.Session["user"] != null ? (Int32)((UserClass)Page.Session["user"]).UserId : -1;
Int32 _companyid = Page.Session["user"] != null ? (Int32)((UserClass)Page.Session["user"]).CompanyId : -1;
//e.InputParameters["ContactID"] = _userid;
Query _qry = new Query(PublishipAdvanceOrderTable.Schema);
if (this.dxcbofields.Text.ToString() != string.Empty && this.txtQuickSearch.Text.ToString() != string.Empty)
{
string _fieldname = this.dxcbofields.SelectedItem.GetValue("fieldname").ToString();
string _txtsearch = this.txtQuickSearch.Text.ToLower();
_qry.AND(_fieldname, Comparison.Equals, _txtsearch);
}
if (!string.IsNullOrEmpty((string)this.dxcbocompany.Value))
{
_qry.AND("CompanyID", Comparison.Equals, this.dxcbocompany.Value.ToString());
}
e.InputParameters["qry"] = _qry;
}
示例2: get_datatable_subsonic
//
public DataTable get_datatable_subsonic()
{
//using a collection as it's the only way to directly apply a query string!
//query to grid
//Int32 _page = this.gridOrder.PageIndex;
//Int32 _pagesize = this.gridOrder.SettingsPager.PageSize;
//
String _companyid = "";
String _filter = "";
//check to see if we have a company id
//user MUST be logged in for advanced searches
Query _qry = new Query(Views.ViewOrder);
//need to switch this off when we are testing!
Page.Session.Remove("user");
if (Page.Session["user"] != null)
{
_companyid = ((UserClass)Page.Session["user"]).CompanyId.ToString();
_qry.WHERE("CompanyID = " + _companyid);
//_query = "WHERE CompanyId = " + _companyid;
}
if (Session["filter"] != null)
{
_filter = Session["filter"].ToString();
if (_companyid != string.Empty) { _qry.AND(_filter); } else { _qry.WHERE(_filter); }
//if (_companyid != string.Empty) { _query+= "AND " + _filter; } else {_query = " WHERE " + _filter ; }
}
//InlineQuery _qry = new InlineQuery();
//_qry.PageIndex = _page+1; //gridview page is 0 based, but subsonic is 1 based
//_qry.PageSize = _pagesize;
ViewOrderCollection _order = new ViewOrderCollection();
_order.LoadAndCloseReader(_qry.ExecuteReader());
DataTable _dt = (DataTable)_order.ToDataTable();
return _dt;
}
示例3: GetQuery
public static Query GetQuery(int hostID, int? userID, Nullable<ActionType> actionType, int? storyID, int? chatID)
{
Query query = new Query(UserAction.Schema).WHERE(UserAction.Columns.HostID, hostID).ORDER_BY(UserAction.Columns.CreatedOn, "DESC");
if (userID.HasValue)
query = query.AND(UserAction.Columns.UserID, userID);
if (actionType.HasValue)
query = query.AND(UserAction.Columns.UserActionTypeID, (int)actionType.Value);
if (storyID.HasValue)
query = query.AND(UserAction.Columns.StoryID, storyID);
if (chatID.HasValue)
query = query.AND(UserAction.Columns.ChatID, chatID);
return query;
}