本文整理汇总了C#中DataBase.OrderGetByItemId方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.OrderGetByItemId方法的具体用法?C# DataBase.OrderGetByItemId怎么用?C# DataBase.OrderGetByItemId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.OrderGetByItemId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OrderDelete
public void OrderDelete()
{
DataBase dataBase = new DataBase();
Order order = new Order
{
ItemId = 555,
Count = 1,
ItemStatusId = 1,
LegalEntity = true,
PersonInfoId = 1,
Postage = 0M.DecimalToString(),
Price = 1M.DecimalToString(),
};
int rowsInserted = dataBase.OrderInsert(order);
Assert.AreEqual(1, rowsInserted);
List<Order> list = dataBase.OrderGetByItemId(555);
Assert.IsNotNull(list);
Assert.AreEqual(555, list[0].ItemId);
int rowsDeleted = dataBase.OrderDelete(list[0].Id);
Assert.AreEqual(1, rowsDeleted);
list = dataBase.OrderGetByItemId(555);
Assert.IsNull(list);
}
示例2: OrderGetById
public void OrderGetById()
{
DataBase dataBase = new DataBase();
List<Order> orderGetByItemId = dataBase.OrderGetByItemId(1);
int rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 1,
Count = 1,
ItemStatusId = 1,
LegalEntity = true,
PersonInfoId = 1,
Postage = 0M.DecimalToString(),
Price = 1.00M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
List<Order> orders = dataBase.OrderGetByItemId(1);
Assert.IsNotNull(orders);
Assert.AreEqual(orderGetByItemId == null ? 1 : orderGetByItemId.Count + 1, orders.Count);
}
示例3: OrderGetByItemId
public void OrderGetByItemId()
{
DataBase dataBase = new DataBase();
const int itemId = 1;
int rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = itemId,
Count = 1,
ItemStatusId = 1,
LegalEntity = true,
PersonInfoId = 1,
Postage = 0M.DecimalToString(),
Price = 1.00M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = itemId,
Count = 2,
ItemStatusId = 1,
LegalEntity = true,
PersonInfoId = 1,
Postage = 0M.DecimalToString(),
Price = 2.99M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 2,
Count = 3,
ItemStatusId = 4,
LegalEntity = false,
PersonInfoId = 5,
Postage = 6M.DecimalToString(),
Price = 7.123M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
List<Order> orders = dataBase.OrderGetByItemId(itemId);
Assert.IsNotNull(orders);
orders = dataBase.OrderGetByItemId(2);
Assert.IsNotNull(orders);
}