本文整理汇总了C#中DataStore.GetFilteredData方法的典型用法代码示例。如果您正苦于以下问题:C# DataStore.GetFilteredData方法的具体用法?C# DataStore.GetFilteredData怎么用?C# DataStore.GetFilteredData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore.GetFilteredData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBaseData
/// <summary>Get the base data that is in scope.</summary>
public DataTable GetBaseData(string tableName)
{
if (tables.ContainsKey(tableName))
return tables[tableName];
else if (tableName != null)
{
Simulation parentSimulation = Apsim.Parent(this, typeof(Simulation)) as Simulation;
Zone parentZone = Apsim.Parent(this, typeof(Zone)) as Zone;
Experiment parentExperiment = Apsim.Parent(this, typeof(Experiment)) as Experiment;
string baseFilter = null;
// If the graph is in a zone then just graph the zone.
if (parentZone != null && !(parentZone is Simulation))
{
// in a zone.
baseFilter = string.Format("SimulationName='{0}' and ZoneName='{1}'", parentSimulation.Name, parentZone.Name);
}
else
{
List<string> simulationNames = new List<string>();
if (parentSimulation != null)
simulationNames.Add(parentSimulation.Name); // in a simulation.
else if (parentExperiment != null)
simulationNames.AddRange(parentExperiment.Names());
else
{
// Must be in a folder at the top level or at the top level of the .apsimx file.
IModel parentOfGraph = this.Parent;
// Look for experiments.
foreach (Experiment experiment in Apsim.ChildrenRecursively(parentOfGraph, typeof(Experiment)))
simulationNames.AddRange(experiment.Names());
// Look for simulations if we didn't find any experiments.
foreach (Simulation simulation in Apsim.ChildrenRecursively(parentOfGraph, typeof(Simulation)))
{
if (simulation.Parent is Experiment)
{ }
else
simulationNames.Add(simulation.Name);
}
}
// convert simulationNames to a filter.
foreach (string simulationName in simulationNames)
{
if (baseFilter != null)
baseFilter += ",";
baseFilter += "'" + simulationName + "'";
}
baseFilter = "SimulationName IN (" + baseFilter + ")";
}
DataStore dataStore = new DataStore(this);
DataTable data = dataStore.GetFilteredData(tableName, baseFilter);
dataStore.Disconnect();
tables.Add(tableName, data);
return data;
}
return null;
}