当前位置: 首页>>代码示例>>C#>>正文


C# Query.AddUpdateSetting方法代码示例

本文整理汇总了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);
        }
开发者ID:BlackMael,项目名称:SubSonic-2.0,代码行数:21,代码来源:QueryTest.cs

示例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);
 }
开发者ID:montyclift,项目名称:dashcommerce-3,代码行数:17,代码来源:OrderController.cs

示例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);
            }

        }
开发者ID:howgoo,项目名称:SubSonic-2.0,代码行数:24,代码来源:TransactionWithDtcOffTests.cs

示例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();";
    }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:22,代码来源:Examples.aspx.cs


注:本文中的Query.AddUpdateSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。