本文整理汇总了C#中Update.AddCriterion方法的典型用法代码示例。如果您正苦于以下问题:C# Update.AddCriterion方法的具体用法?C# Update.AddCriterion怎么用?C# Update.AddCriterion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Update
的用法示例。
在下文中一共展示了Update.AddCriterion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeFormulaYear
public string ChangeFormulaYear(string tableName,IList<FormulaYear> deleteItems, IList<FormulaYear> updateItems, IList<FormulaYear> insertItems)
{
try
{
foreach (var item in deleteItems)
{
Delete delete = new Delete(tableName);
delete.AddCriterions("KeyID","myKeyID", item.KeyID, CriteriaOperator.Equal);
delete.AddCriterions("ID","myID", item.ID, CriteriaOperator.Equal);
delete.AddSqlOperator(SqlOperator.AND);
dataFactory.Remove(delete);
}
foreach (var item in updateItems)
{
Update<FormulaYear> update = new Update<FormulaYear>(tableName, item);
update.AddCriterion("KeyID", "myKeyID",item.KeyID, CriteriaOperator.Equal);
update.AddCriterion("ID", "myID",item.ID, CriteriaOperator.Equal);
update.AddSqlOperator(SqlOperator.AND);
update.AddExcludeField("Id");
dataFactory.Save<FormulaYear>(update);
}
foreach (var item in insertItems)
{
Insert<FormulaYear> insert = new Insert<FormulaYear>(tableName, item);
insert.AddExcludeField("Id");
dataFactory.Save<FormulaYear>(insert);
}
}
catch
{
return "0";
}
return "1";
}
示例2: SavePVFValues
public void SavePVFValues(IList<PVFItem> inserted, IList<PVFItem> updated, IList<PVFItem> deleted)
{
using (TransactionScope scope = new TransactionScope())
{
foreach (var item in inserted)
{
Insert<PVFItem> insert = new Insert<PVFItem>("PeakValleyFlat", item);
insert.AddExcludeField("ID");
dataFactory.Save<PVFItem>(insert);
}
foreach (var item1 in updated)
{
Update<PVFItem> update = new Update<PVFItem>("PeakValleyFlat", item1);
update.AddCriterion("ID", "ID", item1.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
update.AddExcludeField("ID");
dataFactory.Save<PVFItem>(update);
}
foreach (var item2 in deleted)
{
Delete delete = new Delete("PeakValleyFlat");
delete.AddCriterions("ID", "ID",item2.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
dataFactory.Remove(delete);
}
scope.Complete();
}
}
示例3: Save
/////////////////////////////////////////////////////////////////////////////////
public void Save(ProductLine entity)
{
Update<ProductLine> update = new Update<ProductLine>("ProductLine", entity);
update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
update.AddExcludeField("ID");
dataFactory.Save<ProductLine>(update);
}
示例4: Save
///////////////////////////////////////////////////////////////////////////
public void Save(Report entity)
{
Update<Report> update = new Update<Report>("Report", entity);
update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
update.AddExcludeField("ID");
dataFactory.Save<Report>(update);
}
示例5: Save
/********************************************************************************************/
public void Save(TZ entity)
{
Update<TZ> update = new Update<TZ>("TZ", entity);
update.AddCriterion("KeyID", entity.Id, CriteriaOperator.Equal);
update.AddExcludeField("KeyID");
dataFactory.Save<TZ>(update);
}