本文整理汇总了C#中DataBase.OrderInsert方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.OrderInsert方法的具体用法?C# DataBase.OrderInsert怎么用?C# DataBase.OrderInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.OrderInsert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OrderGetAll
public void OrderGetAll()
{
DataBase dataBase = new DataBase();
string itemTypeName = Guid.NewGuid().ToString();
ItemType itemType = new ItemType {Name = itemTypeName,};
dataBase.ItemTypeInsert(itemType);
ItemType itemTypeGet = dataBase.ItemTypeGet(itemTypeName);
Assert.IsNotNull(itemTypeGet);
string itemName = Guid.NewGuid().ToString();
Item item = new Item
{
Name = itemName,
ItemTypeId = itemTypeGet.Id,
};
dataBase.ItemInsert(item);
Item itemGet = dataBase.ItemGet(itemName);
Assert.IsNotNull(itemGet);
string itemStatusName = Guid.NewGuid().ToString();
ItemStatus itemStatus = new ItemStatus {Name = itemStatusName};
dataBase.ItemStatusInsert(itemStatus);
ItemStatus itemStatusGet = dataBase.ItemStatusGet(itemStatusName);
Assert.IsNotNull(itemStatusGet);
string personInfoName = Guid.NewGuid().ToString();
string personInfoSurName = Guid.NewGuid().ToString();
PersonInfo personInfo = new PersonInfo {Name = personInfoName, SurName = personInfoSurName,};
dataBase.PersonInfoInsert(personInfo);
PersonInfo personInfoGet = dataBase.PersonInfoGet(personInfoName, personInfoSurName);
Assert.IsNotNull(personInfoGet);
Order order = new Order
{
ItemId = itemGet.Id,
Count = 1,
ItemStatusId = itemStatusGet.Id,
LegalEntity = true,
PersonInfoId = personInfoGet.Id,
Postage = 0M.DecimalToString(),
Price = 1M.DecimalToString(),
BankId = -1,
};
int rowsInserted = dataBase.OrderInsert(order);
Assert.AreEqual(1, rowsInserted);
List<Order> orders = dataBase.OrderGetAll();
Assert.IsNotNull(orders);
Order find = orders.Find(o => o.ItemId == itemGet.Id);
Assert.IsNotNull(find);
}
示例2: 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);
}
示例3: 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);
}
示例4: OrderInsert
public void OrderInsert()
{
DataBase dataBase = new DataBase();
Order order = new Order
{
ItemId = 1,
Count = 1,
ItemStatusId = 1,
LegalEntity = true,
PersonInfoId = 1,
Postage = 0M.DecimalToString(),
Price = 1M.DecimalToString(),
};
int rowsInserted = dataBase.OrderInsert(order);
Assert.AreEqual(1, rowsInserted);
}
示例5: OrderGetByPersonId
public void OrderGetByPersonId()
{
DataBase dataBase = new DataBase();
const int personInfoId = 5;
int rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 1,
Count = 2,
ItemStatusId = 3,
LegalEntity = true,
PersonInfoId = 4,
Postage = 5M.DecimalToString(),
Price = 6.00M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 10,
Count = 20,
ItemStatusId = 3,
LegalEntity = false,
PersonInfoId = personInfoId,
Postage = 10M.DecimalToString(),
Price = 2.99M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
const decimal price = 7.123M;
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 2,
Count = 3,
ItemStatusId = 4,
LegalEntity = false,
PersonInfoId = personInfoId,
Postage = 6M.DecimalToString(),
Price = price.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
List<Order> orders = dataBase.OrderGetByPersonInfo(personInfoId);
Assert.IsNotNull(orders);
orders = dataBase.OrderGetByItemStatus(4);
Assert.IsNotNull(orders);
Order findLast = orders.FindLast(o => o.Price == price.DecimalToString());
Assert.IsNotNull(findLast);
Assert.AreEqual(price.DecimalToString(), findLast.Price);
}
示例6: OrderGetByLegalEntity
public void OrderGetByLegalEntity()
{
DataBase dataBase = new DataBase();
const decimal @decimal = 6.00M;
int rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 1,
Count = 2,
ItemStatusId = 3,
LegalEntity = true,
PersonInfoId = 4,
Postage = 5M.DecimalToString(),
Price = @decimal.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 10,
Count = 20,
ItemStatusId = 3,
LegalEntity = false,
PersonInfoId = 5,
Postage = 10M.DecimalToString(),
Price = 2.99M.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
const decimal price = 7.123M;
rowsInserted = dataBase.OrderInsert(new Order
{
ItemId = 2,
Count = 3,
ItemStatusId = 4,
LegalEntity = false,
PersonInfoId = 5,
Postage = 6M.DecimalToString(),
Price = price.DecimalToString(),
});
Assert.AreEqual(1, rowsInserted);
List<Order> orders = dataBase.OrderGetByLegalEntity();
Assert.IsNotNull(orders);
Assert.AreEqual(true, orders[0].LegalEntity);
List<Order> list = orders.FindAll(o => o.Price == @decimal.DecimalToString());
Assert.IsNotNull(list);
Assert.IsTrue(list.Count > 0);
}
示例7: 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);
}