本文整理汇总了C#中OrderItem类的典型用法代码示例。如果您正苦于以下问题:C# OrderItem类的具体用法?C# OrderItem怎么用?C# OrderItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrderItem类属于命名空间,在下文中一共展示了OrderItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOrder
/// <summary>
/// 创建订单
/// </summary>
private Order CreateOrder( Guid? orderId = null, Guid? itemId = null , Guid? itemId2 = null) {
Order order;
if ( orderId == null )
order = new Order();
else
order = new Order( orderId.SafeValue() );
order.Name = "order";
//添加订单项1
OrderItem orderItem;
if( itemId == null )
orderItem = new OrderItem();
else
orderItem = new OrderItem( order.Id, itemId.SafeValue() );
orderItem.Name = "a";
order.Add( orderItem );
//添加订单项2
OrderItem orderItem2;
if ( itemId == null )
orderItem2 = new OrderItem();
else
orderItem2 = new OrderItem( order.Id, itemId2.SafeValue() );
orderItem2.Name = "b";
order.Add( orderItem2 );
return order;
}
示例2: OrderItem
public OrderItem(OrderItem item)
{
Name = item.Name;
Quantity = item.Quantity;
Price = item.Price;
Remarks = item.Remarks;
}
示例3: CalculateTax
public static float CalculateTax(OrderItem orderItem, TaxElement tax, float discountPercent)
{
switch (tax.Type)
{
case RateType.LumpSum:
return tax.RegionalRates.Count > 0 ? tax.RegionalRates.First().Rate : tax.FederalRate;
case RateType.Proportional:
{
float returnTax = tax.RegionalRates.Count > 0 ? tax.RegionalRates.First().Rate : tax.FederalRate;
if (tax.ShowInPrice)
{
returnTax = returnTax * (orderItem.Price - orderItem.Price * discountPercent/100) * orderItem.Amount / (100.0F + returnTax);
}
else
{
returnTax = returnTax * (orderItem.Price - orderItem.Price * discountPercent / 100) * orderItem.Amount / 100.0F;
}
return returnTax;
}
default:
throw new NotImplementedException("This tax type does not exist");
}
}
示例4: ProcessRequest
public void ProcessRequest(HttpContext context)
{
var responseText = string.Empty;
if (!string.IsNullOrEmpty(context.Request.QueryString["OrderItem"]))
{
try
{
var oi = new OrderItem();
var jsonSerializer = new JavaScriptSerializer();
responseText = jsonSerializer.Serialize(oi);
}
catch (Exception ex)
{
responseText = $"{{ \"result\": \"error\", \"error_msg\": \"{ex.Message}\" }}";
}
}
//responseText = "{ \"result\": \"success\", \"ProductGuid\": \"cyrano\" }";
context.Response.Clear();
context.Response.ContentType = "text/plain";
context.Response.Write(responseText);
context.Response.End();
}
示例5: Initialize
public void Initialize()
{
//New instance of Order Item
_orderItem = new OrderItem()
{
Id = 123456L,
LastUpdatedUtc = new DateTime(1969, 7, 21),
BasePricePerItem = 3.14159265D,
Discount = 3.14159265D,
OrderId = "test",
ProductId = "test",
ItemType = ProductItemType.Apparel,
VariantId = "test",
ProductName = "test",
ProductSku = "test",
Quantity = 123,
ProductShortDescription = "test",
ShipFromAddress = new Address(),
ShippingSchedule = new DateTime(1969, 7, 21),
ProductShippingHeight = 3.14159265D,
ProductShippingLength = 3.14159265D,
ProductShippingWeight = 3.14159265D,
ProductShippingWidth = 3.14159265D,
ShipFromNotificationId = "test"
};
}
示例6: AddOrderItem
public AddOrderItem(
Guid orderId,
OrderItem item)
{
OrderId = orderId;
Item = item;
}
示例7: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
var oi = new OrderItem();
if (OrderItemID > 0)
{
oi = repo.Single<OrderItem>(OrderItemID);
}
if (!string.IsNullOrEmpty(tbMemberID.Text.Trim()))
oi.MemberID = Convert.ToInt32(tbMemberID.Text.Trim());
else
throw new Exception("Member ID can't be empty");
oi.MemberName = tbMemberName.Text.Trim();
oi.CreateTime = DateTime.Parse(tbCreateTime.Text.Trim());
oi.OrderID = Convert.ToInt32(tbOrderID.Text.Trim());
oi.IsActive = cbIsActive.Checked;
if (!string.IsNullOrEmpty(tbCode.Text.Trim()))
oi.Code = tbCode.Text.Trim();
else
throw new Exception("OrderItem Code can't be empty");
oi.ProductGuid = new Guid(tbProductGuid.Text.Trim());
oi.ProductName = tbProductName.Text.Trim();
oi.Size = tbSize.Text.Trim();
oi.UnitPrice = Convert.ToSingle(tbUnitPrice.Text.Trim());
oi.Quantity = Convert.ToInt32(tbQuantity.Text.Trim());
if (!string.IsNullOrEmpty(tbSale.Text.Trim()))
oi.Sale = Convert.ToSingle(tbSale.Text.Trim());
else
oi.Sale = null;
oi.Remark = tbRemark.Text.Trim();
if (OrderItemID > 0)
{
repo.Update(oi);
ClientScript.RegisterClientScriptBlock(typeof (string), "succeed",
"alert('更新成功');window.location.href=window.location.href", true);
}
else
{
repo.Insert(oi);
ClientScript.RegisterClientScriptBlock(typeof (string), "succeed",
"alert('添加成功');window.location.href = 'AdminOrderItem.aspx'", true);
}
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(typeof (string), "failed", $"alert('{ex.Message}')", true);
}
}
示例8: AddToBill
public IOrderItem AddToBill(IProduct product)
{
var orderItem = new OrderItem(product);
_orderItems.Add(orderItem);
return orderItem;
}
示例9: AddOrderItem
public void AddOrderItem(OrderItem orderItem)
{
var order = _entities.Orders.FirstOrDefault(o => o.OrderId == orderItem.OrderId);
order.OrderTotal += orderItem.OrderItemTotal;
_entities.OrderItems.Add(orderItem);
_entities.Entry<Order>(order).State = EntityState.Modified;
_entities.SaveChanges();
}
示例10: CalculatePrice
public decimal CalculatePrice(OrderItem item)
{
decimal total = 0m;
total += item.Quantity * 1m;
int setsOfFive = item.Quantity / 5;
total -= setsOfFive * 1m;
return total;
}
示例11: Build
public OrderItem Build()
{
var orderItem = new OrderItem(_product, _unitPrice, _quantity);
if (_discountPercentage.HasValue) orderItem.DiscountPercentage = _discountPercentage.Value;
return orderItem;
}
示例12: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.CalculatePartialTotal() >= 100)
{
discount = orderItem.CalculatePartialTotal() * 10 / 100;
}
return discount;
}
示例13: OrderBeingPrepared
public OrderBeingPrepared(
Guid orderId,
DiningLocation diningLocation,
OrderItem[] orderItems)
{
OrderId = orderId;
DiningLocation = diningLocation;
OrderItems = orderItems;
}
示例14: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.ItemAmount() >= 100)
{
discount = orderItem.ItemAmount() * 10 / 100;
}
return discount;
}
示例15: OrderDelivered
public OrderDelivered(
Guid orderId,
DiningLocation diningLocation,
OrderItem[] orderItems)
{
OrderId = orderId;
DiningLocation = diningLocation;
OrderItems = orderItems;
}