本文整理汇总了C#中Epi.CreateQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Epi.CreateQuery方法的具体用法?C# Epi.CreateQuery怎么用?C# Epi.CreateQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epi
的用法示例。
在下文中一共展示了Epi.CreateQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnMarkRelatedRecoredsAsDeleted
private void UnMarkRelatedRecoredsAsDeleted(Epi.Data.Services.CollectedDataProvider OutputDriver, View pView, List<int> pIDList)
{
Dictionary<string, bool> VisitedViews = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
string SQL = null;
StringBuilder InSQL = new StringBuilder();
InSQL.Append(" Where FKey In (");
foreach (int ID in pIDList)
{
pView.LoadRecord(ID);
pView.RecStatusField.CurrentRecordValue = 1;
pView.SaveRecord(ID);
InSQL.Append("'");
InSQL.Append(pView.CurrentGlobalRecordId);
InSQL.Append("',");
}
InSQL.Length = InSQL.Length - 1;
InSQL.Append(")");
foreach (Epi.Fields.Field field in pView.Fields)
{
if (field is Epi.Fields.RelatedViewField)
{
Epi.Fields.RelatedViewField rvf = field as Epi.Fields.RelatedViewField;
if (!VisitedViews.ContainsKey(rvf.ChildView.Name))
{
SQL = "Select UniqueKey From [" + rvf.ChildView.TableName + "] " + InSQL.ToString();
IDataReader reader = OutputDriver.ExecuteReader(OutputDriver.CreateQuery(SQL));
List<int> NewIdList = new List<int>();
while (reader.Read())
{
if (reader["UniqueKey"] != DBNull.Value)
{
NewIdList.Add((int)reader["UniqueKey"]);
}
}
VisitedViews.Add(rvf.ChildView.Name, true);
UnMarkRelatedRecoredsAsDeleted(OutputDriver, rvf.ChildView, NewIdList);
}
}
}
}
示例2: CascadePermanentDelete
private void CascadePermanentDelete(Epi.Data.Services.CollectedDataProvider OutputDriver, View pView, List<int> pIDList)
{
Dictionary<string, bool> VisitedViews = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
string SQL = null;
StringBuilder InSQL = new StringBuilder();
InSQL.Append(" (");
foreach (int ID in pIDList)
{
pView.LoadRecord(ID);
InSQL.Append("'");
InSQL.Append(pView.CurrentGlobalRecordId);
InSQL.Append("',");
}
InSQL.Length = InSQL.Length - 1;
InSQL.Append(")");
foreach (Epi.Fields.Field field in pView.Fields)
{
if (field is Epi.Fields.RelatedViewField)
{
Epi.Fields.RelatedViewField rvf = field as Epi.Fields.RelatedViewField;
if (!VisitedViews.ContainsKey(rvf.ChildView.Name))
{
SQL = "Select UniqueKey From [" + rvf.ChildView.TableName + "] Where FKey In " + InSQL.ToString();
IDataReader reader = OutputDriver.ExecuteReader(OutputDriver.CreateQuery(SQL));
List<int> NewIdList = new List<int>();
while (reader.Read())
{
if (reader["UniqueKey"] != DBNull.Value)
{
NewIdList.Add((int)reader["UniqueKey"]);
}
}
VisitedViews.Add(rvf.ChildView.Name, true);
CascadePermanentDelete(OutputDriver, rvf.ChildView, NewIdList);
}
}
else if(field is Epi.Fields.GridField)
{
Epi.Fields.GridField gf = field as Epi.Fields.GridField;
SQL = "Delete from [" + gf.TableName + "] Where FKey In " + InSQL.ToString();
OutputDriver.ExecuteNonQuery(OutputDriver.CreateQuery(SQL));
}
}
foreach (Epi.Page page in pView.Pages)
{
SQL = "Delete from [" + page.TableName + "] Where GlobalRecordId In " + InSQL.ToString();
OutputDriver.ExecuteNonQuery(OutputDriver.CreateQuery(SQL));
}
SQL = "Delete from [" + pView.TableName + "] Where GlobalRecordId In " + InSQL.ToString();
OutputDriver.ExecuteNonQuery(OutputDriver.CreateQuery(SQL));
}