本文整理汇总了C#中OrderItem类的典型用法代码示例。如果您正苦于以下问题:C# OrderItem类的具体用法?C# OrderItem怎么用?C# OrderItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderItem类属于命名空间,在下文中一共展示了OrderItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:NetUtil,项目名称:Util,代码行数:31,代码来源:AggregateTest.cs
示例2: OrderItem
public OrderItem(OrderItem item)
{
Name = item.Name;
Quantity = item.Quantity;
Price = item.Price;
Remarks = item.Remarks;
}
开发者ID:sadowskik,项目名称:advanced-cqrs-class,代码行数:7,代码来源:OrderItem.cs
示例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");
}
}
开发者ID:AzarinSergey,项目名称:learn,代码行数:27,代码来源:TaxServices.cs
示例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();
}
开发者ID:CyranoChen,项目名称:Arsenalcn,代码行数:26,代码来源:ServerOrderItemCheck.ashx.cs
示例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"
};
}
开发者ID:ajayanandgit,项目名称:Web.Commerce,代码行数:26,代码来源:OrderItemTest.cs
示例6: AddOrderItem
public AddOrderItem(
Guid orderId,
OrderItem item)
{
OrderId = orderId;
Item = item;
}
开发者ID:GunioRobot,项目名称:cqrs,代码行数:7,代码来源:AddOrderItem.cs
示例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);
}
}
开发者ID:CyranoChen,项目名称:Arsenalcn,代码行数:59,代码来源:AdminOrderItemView.aspx.cs
示例8: AddToBill
public IOrderItem AddToBill(IProduct product)
{
var orderItem = new OrderItem(product);
_orderItems.Add(orderItem);
return orderItem;
}
开发者ID:sbarski,项目名称:shopveyor,代码行数:8,代码来源:Bill.cs
示例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();
}
开发者ID:carolynlschroeder,项目名称:OnlineOrdering,代码行数:8,代码来源:OrderRepository.cs
示例10: CalculatePrice
public decimal CalculatePrice(OrderItem item)
{
decimal total = 0m;
total += item.Quantity * 1m;
int setsOfFive = item.Quantity / 5;
total -= setsOfFive * 1m;
return total;
}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:8,代码来源:Buy4GetOneFree.cs
示例11: Build
public OrderItem Build()
{
var orderItem = new OrderItem(_product, _unitPrice, _quantity);
if (_discountPercentage.HasValue) orderItem.DiscountPercentage = _discountPercentage.Value;
return orderItem;
}
开发者ID:kjellski,项目名称:nhibernatetraining,代码行数:8,代码来源:OrderItemBuilder.cs
示例12: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.CalculatePartialTotal() >= 100)
{
discount = orderItem.CalculatePartialTotal() * 10 / 100;
}
return discount;
}
开发者ID:snahider,项目名称:Code-Smells-and-Refactoring,代码行数:9,代码来源:AccessoriesDiscount.cs
示例13: OrderBeingPrepared
public OrderBeingPrepared(
Guid orderId,
DiningLocation diningLocation,
OrderItem[] orderItems)
{
OrderId = orderId;
DiningLocation = diningLocation;
OrderItems = orderItems;
}
开发者ID:GunioRobot,项目名称:cqrs,代码行数:9,代码来源:OrderBeingPrepared.cs
示例14: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.ItemAmount() >= 100)
{
discount = orderItem.ItemAmount() * 10 / 100;
}
return discount;
}
开发者ID:snahider,项目名称:Refactoring-Golf,代码行数:9,代码来源:AccessoriesDiscount.cs
示例15: OrderDelivered
public OrderDelivered(
Guid orderId,
DiningLocation diningLocation,
OrderItem[] orderItems)
{
OrderId = orderId;
DiningLocation = diningLocation;
OrderItems = orderItems;
}
开发者ID:GunioRobot,项目名称:cqrs,代码行数:9,代码来源:OrderDelivered.cs
示例16: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.Quantity > 2)
{
discount = orderItem.Product.UnitPrice;
}
return discount;
}
开发者ID:snahider,项目名称:Refactoring-Golf,代码行数:9,代码来源:CloathingDiscount.cs
示例17: CalculateDiscount
public decimal CalculateDiscount(OrderItem orderItem)
{
decimal discount = 0;
if (orderItem.UnitPricePerQuantity() >= 100)
{
discount = orderItem.UnitPricePerQuantity() * 10 / 100;
}
return discount;
}
开发者ID:snahider,项目名称:Refactoring-Golf,代码行数:9,代码来源:AccessoriesDiscount.cs
示例18: CalculatePrice
public decimal CalculatePrice(OrderItem item)
{
decimal total = 0m;
// $0.40 each; 3 for a $1.00
total += item.Quantity*.4m;
int setsOfThree = item.Quantity/3;
total -= setsOfThree*.2m;
return total;
}
开发者ID:AlexandreRoba,项目名称:OCPCommerceProject,代码行数:9,代码来源:SpecialPriceRule.cs
示例19: CompleteCheckout
public void CompleteCheckout(string CreditCard)
{
try
{
if (Context.User.IsInRole("User"))
{
User myLoggedUser = new UsersLogic().RetrieveUserByUsername(Context.User.Identity.Name);
List<ShoppingCart> myShoppingCartItems = new ShoppingCartLogic().RetrieveAllShoppingCartItems(myLoggedUser.Id).ToList();
List<OrderItem> myOrderItems = new List<OrderItem>();
foreach (ShoppingCart myShoppingCartItem in myShoppingCartItems)
{
UserTypeProduct myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myLoggedUser.UserTypeFK, myShoppingCartItem.ProductFK);
OrderItem myOrderItem = new OrderItem();
myOrderItem.Id = myShoppingCartItem.ProductFK;
double myPrice = 0;
if (myPriceType != null)
{
myPrice = myPriceType.Price;
double? NewPrice = 0;
if ((myPriceType.DiscountDateFrom != null) && (myPriceType.DiscountDateTo != null) && (myPriceType.DiscountPercentage != null))
{
if ((DateTime.Now >= myPriceType.DiscountDateFrom) && (DateTime.Now <= myPriceType.DiscountDateTo))
{
NewPrice = myPriceType.Price - ((myPriceType.DiscountPercentage / 100) * myPriceType.Price);
myPrice = Convert.ToDouble(NewPrice);
}
}
}
myOrderItem.Price = myPrice;
myOrderItem.Quantity = myShoppingCartItem.Quantity;
myOrderItems.Add(myOrderItem);
}
//if (
new OrdersLogic().AddOrder(null, myLoggedUser.Id, CreditCard.Trim(), myOrderItems);
//{
//new UsersLogic().InsertCreditCardNumber(CreditCard.Trim(), myLoggedUser.Id);
//new ShoppingCartLogic().EmptyCart(myLoggedUser.Id);
//}
}
}
catch (Exception Exception)
{
throw Exception;
}
}
开发者ID:divyang4481,项目名称:ASP-Shopping-Cart-Website,代码行数:56,代码来源:checkout.asmx.cs
示例20: AddOrderItems
public ActionResult AddOrderItems(OrderItem item)
{
List<Order> myOrderList = new List<Order>();
// await order = myHandler.GetOrdersList().Single(ord => ord.DataModified == DateTime.Now);
TryUpdateModel(item);
myHandler = new BusinessLogicHandler();
myHandler.AddOrderItem(item);
return Json(new { success = true });
}
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:10,代码来源:OrderController.cs
注:本文中的OrderItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论