本文整理汇总了C#中Query.AddUpdateSetting方法的典型用法代码示例。如果您正苦于以下问题:C# Query.AddUpdateSetting方法的具体用法?C# Query.AddUpdateSetting怎么用?C# Query.AddUpdateSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.AddUpdateSetting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Query_Updates
public void Query_Updates()
{
Query qry = new Query(Product.Schema);
qry.AddUpdateSetting("Discontinued", true);
qry.AddWhere(Product.Columns.ProductName, "Unit Test Product 3");
qry.Execute();
//verify
qry = new Query(Product.Schema);
qry.AddWhere(Product.Columns.ProductName, "Unit Test Product 3");
ProductCollection coll = new ProductCollection();
using(IDataReader rdr = qry.ExecuteReader())
{
coll.Load(rdr);
rdr.Close();
}
foreach(Product prod in coll)
Assert.IsTrue(prod.Discontinued);
}
示例2: AdjustQuantity
/// <summary>
/// Adjusts the quantity.
/// </summary>
/// <param name="orderId">The order id.</param>
/// <param name="orderItemId">The order item id.</param>
/// <param name="quantity">The quantity.</param>
/// <param name="userName">Name of the user.</param>
public void AdjustQuantity(int orderId, int orderItemId, int quantity, string userName)
{
Query query = new Query(OrderItem.Schema);
query.AddWhere(OrderItem.Columns.OrderItemId, orderItemId);
query.AddUpdateSetting(OrderItem.Columns.Quantity, quantity);
query.AddUpdateSetting(OrderItem.Columns.ModifiedOn, DateTime.UtcNow.ToString());
query.AddUpdateSetting(OrderItem.Columns.ModifiedBy, userName);
query.Execute();
ResetShippingAndTaxAndDiscount(orderId, userName);
}
示例3: MultiThreadRepeat
public void MultiThreadRepeat()
{
lock(thisLock)
{
var qcc = new QueryCommandCollection();
int threadId = Thread.CurrentThread.ManagedThreadId;
Debug.WriteLine("MultiThreadRepeat: thread id = " + threadId);
int count = 0;
for(int n = 0; n < 10; n++)
{
Query qry1 = new Query(Product.Schema);
qry1.QueryType = QueryType.Update;
qry1.AddWhere(Product.Columns.ProductID, n);
qry1.AddUpdateSetting("ProductName", threadId + ": unit test ");
QueryCommand cmd = qry1.BuildUpdateCommand();
qcc.Add(cmd);
count++;
}
DataService.ExecuteTransaction(qcc);
var p1 = new Product(1);
Assert.AreEqual(p1.ProductName, threadId + ": unit test ", StringComparison.InvariantCultureIgnoreCase);
}
}
示例4: lnkBatchUpdate_Click
protected void lnkBatchUpdate_Click(object sender, EventArgs e)
{
Query qry = new Query(Product.Schema);
qry.AddUpdateSetting(Product.Columns.UnitPrice, 100);
qry.AddWhere(Product.Columns.UnitPrice, Comparison.GreaterThan, 20);
qry.Execute();
qry = new Query(Product.Schema);
GridView1.DataSource = qry.ExecuteReader();
GridView1.DataBind();
lblExampleName.Text = "Batch Update";
lblCode.Text =
@" Query qry = new Query(Product.Schema);
qry.AddUpdateSetting(Product.Columns.UnitPrice, 100);
qry.AddWhere(Product.Columns.UnitPrice, Comparison.GreaterThan, 20);
qry.Execute();
qry = new Query(Product.Schema);
GridView1.DataSource = qry.ExecuteReader();
GridView1.DataBind();";
}