本文整理汇总了C#中Filter.AddOrderByColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Filter.AddOrderByColumn方法的具体用法?C# Filter.AddOrderByColumn怎么用?C# Filter.AddOrderByColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter.AddOrderByColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateScriptObjects
//.........这里部分代码省略.........
if (oldScriptObject == null || oldScriptObject.IsUserDefined)
{
continue;
}
// Find old user defined filters
Filter[] userDefinedFilters = GetUserDefinedFilters(oldScriptObject.Filters);
foreach (Filter oldFilter in userDefinedFilters)
{
Interfaces.Events.RaiseObjectBeingProcessedEvent(oldFilter.Name, "Filter");
Filter newFilter = new Filter(oldFilter.Name, oldFilter.IsUserDefined, newScriptObject, oldFilter.IsReturnTypeCollection, oldFilter.CreateStoredProcedure,
oldFilter.UseCustomWhere, oldFilter.CustomWhere, oldFilter.Key);
newFilter.Alias = oldFilter.Alias;
newFilter.Name = oldFilter.Name;
newFilter.CustomWhere = oldFilter.CustomWhere;
newFilter.CreateStoredProcedure = oldFilter.CreateStoredProcedure;
newFilter.Enabled = oldFilter.Enabled;
newFilter.IsReturnTypeCollection = oldFilter.IsReturnTypeCollection;
foreach (Filter.FilterColumn oldFilterColumn in oldFilter.FilterColumns)
{
Column newFilterColumnColumn = GetNewScriptBase(newDatabase.AllScriptObjects, oldFilter, oldFilterColumn.Column);
Filter.FilterColumn newFilterColumn = new Filter.FilterColumn(newFilterColumnColumn, oldFilterColumn.LogicalOperator, oldFilterColumn.CompareOperator, oldFilterColumn.Alias);
newFilter.AddFilterColumn(newFilterColumn);
}
foreach (Filter.OrderByColumn oldOrderByColumn in oldFilter.OrderByColumns)
{
Column newOrderByColumnColumn = GetNewScriptBase(newDatabase.AllScriptObjects, oldFilter, oldOrderByColumn.Column);
Filter.OrderByColumn newOrderByColumn = new Filter.OrderByColumn(newOrderByColumnColumn, oldOrderByColumn.SortOperator);
newFilter.AddOrderByColumn(newOrderByColumn);
}
newScriptObject.AddFilter(newFilter);
}
}
#endregion
#region Relationship
Interfaces.Events.RaiseObjectBeingProcessedEvent("", "Updating Relationships");
// Update new script objects with old properties
foreach (ScriptObject newScriptObject in newDatabase.AllScriptObjects)
{
if ((newScriptObject.IsTable && !processTables) ||
(newScriptObject.IsStoredProcedure && !processStoredProcedures) ||
(newScriptObject.IsView && !processViews))
{
continue;
}
// Find old script object if it exists
ScriptObject oldScriptObject = Search.GetScriptObject(oldDatabase.AllScriptObjects, newScriptObject, newScriptObject.GetType(), false);
if (oldScriptObject == null)// || oldScriptObject.IsUserDefined)
{
continue;
}
// Find old user defined relationships
Relationship[] userDefinedRelationships = GetUserDefinedRelationships(oldScriptObject.Relationships);
foreach (Relationship oldRelationship in userDefinedRelationships)
{
示例2: InitialCreateFilters
private static void InitialCreateFilters(IList<Model.Table> tables)
{
foreach (Model.Table table in tables)
{
// Get All Filter
string allAlias = "Get" + table.AliasPlural;
Filter allFilter = new Filter(allAlias, false, table, true, true, false, "", null);
foreach (Column primaryKeyColumn in table.PrimaryKeyColumns)
{
Filter.OrderByColumn orderByColumn = new Filter.OrderByColumn(primaryKeyColumn, "ASC");
allFilter.AddOrderByColumn(orderByColumn);
}
// Filter[0]
table.AddFilter(allFilter);
// Filter[1]
foreach (Key key in table.Keys)
{
if (key.Type == DatabaseConstant.KeyType.Primary)
{
//string filterAlias = Helper.GetFilterAlias(key);
bool isReturnTypeCollection = false;
Filter filter = new Filter(key.Name, false, key.Parent, isReturnTypeCollection, true, false, "", key);
foreach (Column column in key.Columns)
{
string logicalOperator = "";
if (filter.FilterColumns.Length > 0)
{
logicalOperator = "And";
}
Filter.FilterColumn filterColumn = new Filter.FilterColumn(column, logicalOperator, null, null);
filter.AddFilterColumn(filterColumn);
}
table.AddFilter(filter);
}
}
// Remaing filters
foreach (Key key in table.Keys)
{
if (key.Type == DatabaseConstant.KeyType.Foreign ||
key.Type == DatabaseConstant.KeyType.Unique ||
key.Type == DatabaseConstant.KeyType.None
)
{
//string filterAlias = Helper.GetFilterAlias(key);
bool isReturnTypeCollection = false;
if (key.Type == DatabaseConstant.KeyType.Foreign ||
key.Type == DatabaseConstant.KeyType.None
)
{
isReturnTypeCollection = true;
}
Filter filter = new Filter(key.Name, false, key.Parent, isReturnTypeCollection, true, false, "", key);
foreach (Column column in key.Columns)
{
string logicalOperator = "";
if (filter.FilterColumns.Length > 0)
{
logicalOperator = "And";
}
Filter.FilterColumn filterColumn = new Filter.FilterColumn(column, logicalOperator, null, null);
filter.AddFilterColumn(filterColumn);
}
if (isReturnTypeCollection)
{
foreach (Column primaryKeyColumn in table.PrimaryKeyColumns)
{
Filter.OrderByColumn orderByColumn = new Filter.OrderByColumn(primaryKeyColumn, "ASC");
filter.AddOrderByColumn(orderByColumn);
}
}
table.AddFilter(filter);
}
}
/*foreach (Index index in table.Indexes)
{
if (index.Type == DatabaseConstant.IndexType.Unique ||
index.Type == DatabaseConstant.IndexType.None)
{
string filterAlias = Helper.GetFilterAlias(index);
bool isReturnTypeCollection = false;
if (index.Type == DatabaseConstant.KeyType.None)
{
isReturnTypeCollection = true;
}
Filter filter = new Filter(index.Name, filterAlias, false, index.Parent, isReturnTypeCollection, true, false, "");
foreach (Column column in index.Columns)
//.........这里部分代码省略.........
示例3: SyncFilterProperties
//.........这里部分代码省略.........
}
#endregion
#region OrderByColumns
for (int orderColumnCounter = newFilter.OrderByColumns.Length - 1; orderColumnCounter >= 0; orderColumnCounter--)
{
Filter.OrderByColumn newColumn = newFilter.OrderByColumns[orderColumnCounter];
bool found = false;
foreach (Filter.OrderByColumn oldColumn in oldFilter.OrderByColumns)
{
if (newColumn.Column.Name == oldColumn.Column.Name &&
newColumn.Column.Parent.Name == oldColumn.Column.Parent.Name)
{
newColumn.SortOperator = oldColumn.SortOperator;
found = true;
break;
}
}
if (!found)
{
newFilter.RemoveOrderByColumn(newColumn);
}
}
#endregion
#region Add missing FilterColumns
foreach (Filter.FilterColumn oldColumn in oldFilter.FilterColumns)
{
bool found = false;
foreach (Filter.FilterColumn newColumn in newFilter.FilterColumns)
{
if (newColumn.Column.Name == oldColumn.Column.Name &&
newColumn.Column.Parent.Name == oldColumn.Column.Parent.Name)
{
found = true;
break;
}
}
if (!found)
{
bool success = false;
foreach (Column column in newFilter.Parent.Columns)
{
if (column.Name == oldColumn.Column.Name &&
column.Parent.Name == oldColumn.Column.Parent.Name)
{
Filter.FilterColumn filterColumn = new Filter.FilterColumn(column, oldColumn.LogicalOperator, oldColumn.CompareOperator, oldColumn.Alias);
newFilter.AddFilterColumn(filterColumn);
success = true;
break;
}
}
if (!success)
{
//sb.AppendLine(string.Format("Filter column is missing and couldn't be updated. Filter:{0}, Column:{1}.{2}", newFilter.Alias, oldColumn.Column.Parent.Name, oldColumn.Column.Alias));
}
}
}
#endregion
#region Add missing OrderByColumns
foreach (Filter.OrderByColumn oldColumn in oldFilter.OrderByColumns)
{
bool found = false;
foreach (Filter.OrderByColumn newColumn in newFilter.OrderByColumns)
{
if (newColumn.Column.Name == oldColumn.Column.Name &&
newColumn.Column.Parent.Name == oldColumn.Column.Parent.Name)
{
found = true;
break;
}
}
if (!found)
{
bool success = false;
foreach (Column column in newFilter.Parent.Columns)
{
if (column.Name == oldColumn.Column.Name &&
column.Parent.Name == oldColumn.Column.Parent.Name)
{
Filter.OrderByColumn orderByColumn = new Filter.OrderByColumn(column, oldColumn.SortOperator);
newFilter.AddOrderByColumn(orderByColumn);
success = true;
break;
}
}
if (!success)
{
sb.AppendLine(string.Format("OrderBy column is missing and couldn't be updated. Filter:{0}, Column:{1}", newFilter.Alias, oldColumn.Column.Parent.Name + oldColumn.Column.Alias));
}
}
}
#endregion
}