本文整理汇总了C#中WhereClause.iAND方法的典型用法代码示例。如果您正苦于以下问题:C# WhereClause.iAND方法的具体用法?C# WhereClause.iAND怎么用?C# WhereClause.iAND使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereClause
的用法示例。
在下文中一共展示了WhereClause.iAND方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWhereClause
public virtual WhereClause CreateWhereClause()
{
// This CreateWhereClause is used for loading the data.
UOMTable.Instance.InnerFilter = null;
WhereClause wc = new WhereClause();
// CreateWhereClause() Compose the WHERE clause consiting of:
// 1. Static clause defined at design time.
// 2. User selected search criteria.
// 3. User selected filter criteria.
if (MiscUtils.IsValueSelected(this.UOMDescriptionFilter)) {
wc.iAND(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(this.UOMDescriptionFilter, this.GetFromSession(this.UOMDescriptionFilter)), false, false);
}
if (MiscUtils.IsValueSelected(this.UOMNameFilter)) {
wc.iAND(UOMTable.UOMName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(this.UOMNameFilter, this.GetFromSession(this.UOMNameFilter)), false, false);
}
if (MiscUtils.IsValueSelected(this.UOMSearch)) {
// Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.
if (this.UOMSearch.Text.StartsWith("...")) {
this.UOMSearch.Text = this.UOMSearch.Text.Substring(3,this.UOMSearch.Text.Length-3);
}
if (this.UOMSearch.Text.EndsWith("...")) {
this.UOMSearch.Text = this.UOMSearch.Text.Substring(0,this.UOMSearch.Text.Length-3);
// Strip the last word as well as it is likely only a partial word
int endindex = this.UOMSearch.Text.Length - 1;
while (!Char.IsWhiteSpace(UOMSearch.Text[endindex]) && endindex > 0) {
endindex--;
}
if (endindex > 0) {
this.UOMSearch.Text = this.UOMSearch.Text.Substring(0, endindex);
}
}
string formatedSearchText = MiscUtils.GetSelectedValue(this.UOMSearch, this.GetFromSession(this.UOMSearch));
// After stripping "..." see if the search text is null or empty.
if (MiscUtils.IsValueSelected(this.UOMSearch)) {
// These clauses are added depending on operator and fields selected in Control's property page, bindings tab.
WhereClause search = new WhereClause();
search.iOR(UOMTable.UOMName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, true, false);
search.iOR(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.Contains, formatedSearchText, true, false);
wc.iAND(search);
}
}
return wc;
}
示例2: CreateWhereClause
public virtual WhereClause CreateWhereClause(String searchText, String fromSearchControl, String AutoTypeAheadSearch, String AutoTypeAheadWordSeparators)
{
// This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature.
EstimateLineTable.Instance.InnerFilter = null;
WhereClause wc = new WhereClause();
// Compose the WHERE clause consiting of:
// 1. Static clause defined at design time.
// 2. User selected search criteria.
// 3. User selected filter criteria.
String appRelativeVirtualPath = (String)HttpContext.Current.Session["AppRelativeVirtualPath"];
string selectedRecordInScopeRecordControl = HttpContext.Current.Session["EstimateLineTableControlWhereClause"] as string;
if (selectedRecordInScopeRecordControl != null && KeyValue.IsXmlKey(selectedRecordInScopeRecordControl))
{
KeyValue selectedRecordKeyValue = KeyValue.XmlToKey(selectedRecordInScopeRecordControl);
if (selectedRecordKeyValue != null && selectedRecordKeyValue.ContainsColumn(EstimateLineTable.ScopeID))
{
wc.iAND(EstimateLineTable.ScopeID, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(EstimateLineTable.ScopeID).ToString());
}
}
// Adds clauses if values are selected in Filter controls which are configured in the page.
return wc;
}
示例3: CreateWhereClause
// To customize, override this method in ReportRecordControl.
public virtual WhereClause CreateWhereClause()
{
WhereClause wc;
ReportTable.Instance.InnerFilter = null;
wc = new WhereClause();
// Compose the WHERE clause consiting of:
// 1. Static clause defined at design time.
// 2. User selected search criteria.
// 3. User selected filter criteria.
// Retrieve the record id from the URL parameter.
string recId = this.Page.Request.QueryString["Report"];
if (recId == null || recId.Length == 0) {
return null;
}
recId = ((BaseApplicationPage)(this.Page)).Decrypt(recId);
if (recId == null || recId.Length == 0) {
return null;
}
HttpContext.Current.Session["QueryString in AddReport"] = recId;
if (KeyValue.IsXmlKey(recId)) {
// Keys are typically passed as XML structures to handle composite keys.
// If XML, then add a Where clause based on the Primary Key in the XML.
KeyValue pkValue = KeyValue.XmlToKey(recId);
wc.iAND(ReportTable.ReportID, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(ReportTable.ReportID));
}
else {
// The URL parameter contains the actual value, not an XML structure.
wc.iAND(ReportTable.ReportID, BaseFilter.ComparisonOperator.EqualsTo, recId);
}
return wc;
}
示例4: CreateWhereClause
protected virtual WhereClause CreateWhereClause()
{
WhereClause whereClause = new WhereClause();
BaseClasses.Data.BaseColumn displayCol = this.GetTable().TableDefinition.ColumnList.GetByAnyName(this.DisplayField);
if (MiscUtils.IsValueSelected(this.StartsWith))
{
// Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.
if (this.StartsWith.Text.StartsWith("...")) {
this.StartsWith.Text = this.StartsWith.Text.Substring(3, this.StartsWith.Text.Length - 3);
}
if (this.StartsWith.Text.EndsWith("...")) {
this.StartsWith.Text = this.StartsWith.Text.Substring(0, this.StartsWith.Text.Length - 3);
}
this.StartsWith.Text = this.StartsWith.Text.Trim();
if (displayCol != null)
{
whereClause.iAND(displayCol, BaseFilter.ComparisonOperator.Starts_With, this.StartsWith.Text, true, false);
}
else
{
List<BaseClasses.Data.BaseColumn> dfkaColumns = GetDFKAColumns();
WhereClause wc = new WhereClause();
if (dfkaColumns != null)
{
if (dfkaColumns.Count > 0)
{
foreach (BaseClasses.Data.BaseColumn col in dfkaColumns)
{
if (col.ColumnType.Equals(BaseColumn.ColumnTypes.String))
wc.iOR(col, BaseFilter.ComparisonOperator.Starts_With, this.StartsWith.Text, true, false);
}
whereClause.iAND(wc);
}
}
}
}
if (MiscUtils.IsValueSelected(this.Contains))
{
// Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.
if (this.Contains.Text.StartsWith("...")) {
this.Contains.Text = this.Contains.Text.Substring(3, this.Contains.Text.Length - 3);
}
if (this.StartsWith.Text.EndsWith("...")) {
this.Contains.Text = this.Contains.Text.Substring(0, this.Contains.Text.Length - 3);
}
this.Contains.Text = this.Contains.Text.Trim();
if (displayCol != null)
{
whereClause.iAND(displayCol, BaseFilter.ComparisonOperator.Contains, this.Contains.Text, true, false);
}
else
{
WhereClause wc = new WhereClause();
List<BaseClasses.Data.BaseColumn> dfkaColumns = GetDFKAColumns();
foreach (BaseClasses.Data.BaseColumn col in dfkaColumns)
{
if (col.ColumnType.Equals(BaseColumn.ColumnTypes.String))
wc.iOR(col, BaseFilter.ComparisonOperator.Contains, this.Contains.Text, true, false);
}
whereClause.iAND(wc);
}
}
return whereClause;
}
示例5: GetColumnValues
/// <summary>
/// Return an array of values from the database. The values returned are DISTINCT values.
/// For example, GetColumnValues("Employees", "City") will return a list of all Cities
/// from the Employees table. There will be no duplicates in the list.
/// This function adds a Where Clause. So you can say something like "Country = 'USA'" and in this
/// case only cities in the US will be returned.
/// You can use the IN operator to compare the values. You can also use the resulting array to display
/// such as String.Join(", ", GetColumnValues("Employees", "City", "Country = 'USA'")
/// to display: New York, Chicago, Los Angeles, San Francisco
/// </summary>
/// <returns>An array of values for the given field as an Object.</returns>
public static string[] GetColumnValues(string tableName, string fieldName, string whereStr)
{
// Find the
PrimaryKeyTable bt = null;
bt = (PrimaryKeyTable)DatabaseObjects.GetTableObject(tableName);
if (bt == null)
{
throw new Exception("GETCOLUMNVALUES(" + tableName + ", " + fieldName + ", " + whereStr + "): " + Resource("Err:NoRecRetrieved"));
}
BaseColumn col = bt.TableDefinition.ColumnList.GetByCodeName(fieldName);
if (col == null)
{
throw new Exception("GETCOLUMNVALUES(" + tableName + ", " + fieldName + ", " + whereStr + "): " + Resource("Err:NoRecRetrieved"));
}
string[] values = null;
try
{
// Always start a transaction since we do not know if the calling function did.
SqlBuilderColumnSelection sqlCol = new SqlBuilderColumnSelection(false, true);
sqlCol.AddColumn(col);
WhereClause wc = new WhereClause();
if (!(whereStr == null) && whereStr.Trim().Length > 0)
{
wc.iAND(whereStr);
}
BaseClasses.Data.BaseFilter join = null;
values = bt.GetColumnValues(sqlCol, join, wc.GetFilter(), null, null, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE);
}
catch
{
}
// The value can be null. In this case, return an empty array since
// that is an acceptable value.
if (values == null)
{
values = new string[0];
}
return values;
}
示例6: CreateWhereClause
public virtual WhereClause CreateWhereClause(String searchText, String fromSearchControl, String AutoTypeAheadSearch, String AutoTypeAheadWordSeparators)
{
// This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature.
VwPropSBondBudgetView.Instance.InnerFilter = null;
WhereClause wc = new WhereClause();
// Compose the WHERE clause consiting of:
// 1. Static clause defined at design time.
// 2. User selected search criteria.
// 3. User selected filter criteria.
String appRelativeVirtualPath = (String)HttpContext.Current.Session["AppRelativeVirtualPath"];
// Adds clauses if values are selected in Filter controls which are configured in the page.
String deptidFilter2SelectedValue = (String)HttpContext.Current.Session[HttpContext.Current.Session.SessionID + appRelativeVirtualPath + "deptidFilter2_Ajax"];
if (MiscUtils.IsValueSelected(deptidFilter2SelectedValue)) {
wc.iAND(VwPropSBondBudgetView.DeptID, BaseFilter.ComparisonOperator.EqualsTo, deptidFilter2SelectedValue, false, false);
}
return wc;
}