本文整理汇总了C#中LineItem类的典型用法代码示例。如果您正苦于以下问题:C# LineItem类的具体用法?C# LineItem怎么用?C# LineItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineItem类属于命名空间,在下文中一共展示了LineItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PopulateFromApi
public virtual void PopulateFromApi(LineItem model)
{
string add1 = null;
string add2 = null;
string city = null;
string state = null;
string postalCode = null;
var response = this.SearchProApi(model);
if ((response != null) && (!response.IsFailure))
{
var bestMatch = response.Results.FirstOrDefault();
if (bestMatch != null)
{
var bestLocation = bestMatch.BestLocation;
if (bestLocation != null)
{
add1 = bestLocation.StandardAddressLine1;
add2 = bestLocation.StandardAddressLine2;
city = bestLocation.City;
state = bestLocation.StateCode;
postalCode = bestLocation.PostalCode;
}
}
}
model.StreetAddress1 = add1;
model.StreetAddress2 = add2;
model.City = city;
model.State = state;
model.PostalCode = postalCode;
}
开发者ID:anthonyrstevens,项目名称:Whitepages-Pro-API-Examples,代码行数:32,代码来源:HomeController.cs
示例2: Create
public ActionResult Create(LineItem lineitem)
{
lineitem.CartId = ExtentionMethods.GetCartId(this);
if (ModelState.IsValid)
{
var currentLineItem = db.LineItems.AsEnumerable().Where(l => l.Equals(lineitem)).SingleOrDefault();
if (currentLineItem != null)
{
currentLineItem.Quantity++;
db.Entry(currentLineItem).State = EntityState.Modified;
}
else
{
lineitem.Quantity = 1;
db.LineItems.Add(lineitem);
currentLineItem = lineitem;
}
db.SaveChanges();
if (Request.IsAjaxRequest())
{
var lineitems = db.LineItems.Include(l => l.Product).Where(l => l.CartId == lineitem.CartId);
ViewBag.CurrentItem = currentLineItem;
return PartialView("_Cart", lineitems);
}
else
{
return RedirectToAction("Index", "Home");
}
}
else
{
TempData["Notice"] = "Model state is invalid.";
return RedirectToAction("Index", "Home");
}
}
开发者ID:dw3w4at,项目名称:Mvc3Depot,代码行数:35,代码来源:CartController.cs
示例3: PopulateVariationInfo
private void PopulateVariationInfo(CatalogEntryDto.CatalogEntryRow entryRow, LineItem lineItem)
{
CatalogEntryDto.VariationRow variationRow = entryRow.GetVariationRows().FirstOrDefault();
if (variationRow != null)
{
lineItem.MaxQuantity = variationRow.MaxQuantity;
lineItem.MinQuantity = variationRow.MinQuantity;
CustomerContact customerContact = CustomerContext.Current.GetContactById(lineItem.Parent.Parent.CustomerId);
Money? newListPrice = GetItemPrice(entryRow, lineItem, customerContact);
if (newListPrice.HasValue)
{
Money oldListPrice = new Money(Math.Round(lineItem.ListPrice, 2), lineItem.Parent.Parent.BillingCurrency);
if (oldListPrice != newListPrice.Value)
{
AddWarningSafe(Warnings,
"LineItemPriceChange-" + lineItem.Parent.LineItems.IndexOf(lineItem).ToString(),
string.Format("Price for \"{0}\" has been changed from {1} to {2}.", lineItem.DisplayName, oldListPrice.ToString(), newListPrice.ToString()));
// Set new price on line item.
lineItem.ListPrice = newListPrice.Value.Amount;
if (lineItem.Parent.Parent.ProviderId.ToLower().Equals("frontend"))
{
lineItem.PlacedPrice = newListPrice.Value.Amount;
}
}
}
}
}
开发者ID:valdisiljuconoks,项目名称:Ascend15,代码行数:31,代码来源:ValidateLineItemsActivity.cs
示例4: CanAddItemToOrderAndCalculate
public void CanAddItemToOrderAndCalculate()
{
RequestContext c = new RequestContext();
MerchantTribeApplication app = MerchantTribeApplication.InstantiateForMemory(c);
c.CurrentStore = new Accounts.Store();
c.CurrentStore.Id = 1;
Order target = new Order();
LineItem li = new LineItem() { BasePricePerItem = 19.99m,
ProductName = "Sample Product",
ProductSku = "ABC123",
Quantity = 2 };
target.Items.Add(li);
app.CalculateOrder(target);
Assert.AreEqual(39.98m, target.TotalOrderBeforeDiscounts, "SubTotal was Incorrect");
Assert.AreEqual(39.98m, target.TotalGrand, "Grand Total was incorrect");
bool upsertResult = app.OrderServices.Orders.Upsert(target);
Assert.IsTrue(upsertResult, "Order Upsert Failed");
Assert.AreEqual(c.CurrentStore.Id, target.StoreId, "Order store ID was not set correctly");
Assert.AreNotEqual(string.Empty, target.bvin, "Order failed to get a bvin");
Assert.AreEqual(1, target.Items.Count, "Item count should be one");
Assert.AreEqual(target.bvin, target.Items[0].OrderBvin, "Line item didn't receive order bvin");
Assert.AreEqual(target.StoreId, target.Items[0].StoreId, "Line item didn't recieve storeid");
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:27,代码来源:OrderTest.cs
示例5: GetEntryRowForLineItem
/// <summary>
/// Get entry row from a line item
/// </summary>
/// <param name="lineItem">line item</param>
protected static CatalogEntryDto.CatalogEntryRow GetEntryRowForLineItem(LineItem lineItem)
{
var responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.Variations);
CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto(lineItem.Code, responseGroup);
return entryDto.CatalogEntry.FirstOrDefault();
}
开发者ID:valdisiljuconoks,项目名称:Ascend15,代码行数:11,代码来源:OrderGroupActivityBase.cs
示例6: GetCartContents
/// <summary>
/// This should return a list of "LineItem" objects for every item in the cart, but I don't yet know how to add items
/// to a cart after creating it, so this method currently will never return success.
/// </summary>
/// <param name="steamId"></param>
/// <returns></returns>
public async Task<List<LineItem>> GetCartContents(long steamId)
{
List<WebRequestParameter> requestParameters = new List<WebRequestParameter>();
WebRequestParameter steamIdParameter = new WebRequestParameter("steamid", steamId.ToString());
requestParameters.Add(steamIdParameter);
// send the request and wait for the response
JObject data = await PerformSteamRequestAsync("ISteamMicroTxn", "GetCartContents", 1, requestParameters);
bool success = TypeHelper.CreateBoolean(data["result"]["success"]);
if (!success)
throw new Exception(E_HTTP_RESPONSE_RESULT_FAILED);
try
{
List<LineItem> lineItems = new List<LineItem>();
foreach (JObject groupObject in data["result"]["lineitems"])
{
LineItem lineItem = new LineItem();
lineItems.Add(lineItem);
}
return lineItems;
}
catch
{
throw new Exception(E_JSON_DESERIALIZATION_FAILED);
}
}
开发者ID:babelshift,项目名称:SteamWebAPI,代码行数:37,代码来源:SteamMicroTransaction.cs
示例7: lineitem_null_description_fails
public void lineitem_null_description_fails()
{
Validator<LineItem> liValidator = new LineItemValidator();
LineItem li = new LineItem();
var results = liValidator.Validate(li);
Assert.Greater(results.Count, 0);
}
开发者ID:henzard,项目名称:XeroAPI.Net,代码行数:7,代码来源:LineItemValidationTests.cs
示例8: PopulateInventoryInfo
private void PopulateInventoryInfo(InventoryRecord inventoryRecord, LineItem lineItem)
{
lineItem.AllowBackordersAndPreorders = inventoryRecord.BackorderAvailableQuantity > 0 | inventoryRecord.PreorderAvailableUtc > SafeBeginningOfTime;
lineItem.BackorderQuantity = inventoryRecord.BackorderAvailableQuantity;
lineItem.InStockQuantity = inventoryRecord.PurchaseAvailableQuantity + inventoryRecord.AdditionalQuantity;
lineItem.PreorderQuantity = inventoryRecord.PreorderAvailableQuantity;
lineItem.InventoryStatus = inventoryRecord.IsTracked ? 1 : 0;
}
开发者ID:valdisiljuconoks,项目名称:Ascend15,代码行数:8,代码来源:ValidateLineItemsActivity.cs
示例9: CheckoutIndex
/// <summary>
/// CTR
/// </summary>
public CheckoutIndex()
{
LineItems = new LineItem[] { };
Countries = new Country[] { };
DeliveryAddress = new CreateOrderRequest.Address();
var url = new UrlHelper(HttpContext.Current.Request.RequestContext);
CheckoutShippingCostsUrl = url.Action(MVC.Store.Checkout.VariableCosts());
}
开发者ID:atitsbest,项目名称:llprk.net,代码行数:11,代码来源:CheckoutIndex.cs
示例10: DeleteInvalidItem
private static void DeleteInvalidItem(OrderForm[] orderForms, LineItem lineItem)
{
foreach (var form in orderForms)
{
form.RemoveLineItemFromShipments(lineItem);
}
lineItem.Delete();
}
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:8,代码来源:ValidateLineItemsActivity.cs
示例11: Add
public void Add(PropertyDescriptor property, PropertyMap map)
{
var index = GetIndex(property.NameId);
var line = _lines[index];
if (line == null)
_lines[index] = line = new LineItem();
line.Property = property;
line.Map = map;
}
开发者ID:reshadi2,项目名称:mcjs,代码行数:9,代码来源:PropertyCache.cs
示例12: TotalCostTest_promotionAvailable_returnsPromotionCostCalculation
public void TotalCostTest_promotionAvailable_returnsPromotionCostCalculation() {
LineItem lineItem = new LineItem(new Item("Apple"));
lineItem.PricePerUnit = 1.5;
lineItem.Quantity = 2;
Promotion promotion = new QuantityPricePromotion(new Item("Apple"), "[email protected]");
lineItem.Promotion = promotion;
Assert.AreEqual(promotion.GetPromotionAdjustedTotalCost(lineItem), lineItem.TotalCost);
}
开发者ID:mtqtran8182,项目名称:checkout,代码行数:10,代码来源:LineItemTests.cs
示例13: DeleteLineItemFromShipment
private void DeleteLineItemFromShipment(Shipment shipment, LineItem lineItem)
{
var orderForm = OrderGroup.OrderForms.ToArray().Where(of => of.LineItems.ToArray().Contains(lineItem)).FirstOrDefault();
if (orderForm != null)
{
var lineItemIndex = orderForm.LineItems.IndexOf(lineItem);
decimal shipmentQty = Shipment.GetLineItemQuantity(shipment, lineItem.LineItemId);
lineItem.Quantity -= shipmentQty;
shipment.RemoveLineItemIndex(lineItemIndex);
}
}
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:11,代码来源:CheckInstoreInventoryActivity.cs
示例14: CanGetLineTotalWithDiscounts
public void CanGetLineTotalWithDiscounts()
{
LineItem target = new LineItem();
target.BasePricePerItem = 39.99m;
target.DiscountDetails.Add(new Marketing.DiscountDetail(){ Amount = -20.01m});
target.DiscountDetails.Add(new Marketing.DiscountDetail() { Amount = -5m });
Decimal actual = target.LineTotal;
Assert.AreEqual((39.99m - 20.01m - 5m), actual, "Total was not correct.");
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:12,代码来源:LineItemTest.cs
示例15: GetCustomLineItemDiscountAmount
private decimal GetCustomLineItemDiscountAmount(LineItem lineItem)
{
decimal retVal = 0m;
foreach (LineItemDiscount lineItemDiscount in lineItem.Discounts)
{
if (lineItemDiscount.DiscountName.StartsWith("@"))
{
retVal += lineItemDiscount.DiscountValue;
}
}
return retVal;
}
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:12,代码来源:RemoveDiscountsActivity.cs
示例16: When_no_promotion_applies
public void When_no_promotion_applies()
{
var rule = new Mock<IPromotionalDiscountRule>();
rule.Setup(p => p.PromotionApplies(It.IsAny<LineItem>())).Returns(false);
var sut = new Promotions(new List<IPromotionalDiscountRule>() { rule.Object });
var productCatalog = new ProductCatalog();
productCatalog.AddProduct("apple", 0.75m);
var lineItem = new LineItem("apple", 7, productCatalog, sut);
var actual = sut.CalculatePromotionalCost(lineItem);
Assert.That(actual.DiscountedSubTotal, Is.EqualTo(lineItem.SubTotal));
Assert.That(actual.DiscountNote, Is.EqualTo(""));
}
开发者ID:BDDCloud,项目名称:GroceryCoKiosk,代码行数:13,代码来源:PromotionsTests.cs
示例17: IsGiftLineItem
/// <summary>
/// Determines whether [is gift line item] [the specified line item].
/// </summary>
/// <param name="lineItem">The line item.</param>
/// <returns>
/// <c>true</c> if [is gift line item] [the specified line item]; otherwise, <c>false</c>.
/// </returns>
public bool IsGiftLineItem(LineItem lineItem)
{
bool retVal = false;
foreach (LineItemDiscount discount in lineItem.Discounts)
{
if (discount.DiscountName.EndsWith(":Gift"))
{
retVal = true;
break;
}
}
return retVal;
}
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:20,代码来源:RemoveDiscountsActivity.cs
示例18: It_will_not_report_diff_if_content_is_the_same
public void It_will_not_report_diff_if_content_is_the_same()
{
var lineItem = new LineItem { Product = "Product A", Total = 2.00M };
var order = new Order() { Id = 1, LineItems = new[] { lineItem } };
var orderCopy = (Order)ObjectCloner.Clone(order);
Cross.diff(order, orderCopy, (left, right) =>
{
var report = Diff.ObjectValues(left, right);
Assert.IsFalse(report.DiffFound);
});
}
开发者ID:goeran,项目名称:ODiff,代码行数:13,代码来源:Diff_arrays.cs
示例19: When_constructed
public void When_constructed()
{
var productCatalog = new ProductCatalog();
productCatalog.AddProduct("apple", 0.75m);
productCatalog.AddProduct("banana", 1.00m);
var sut = new LineItem("apple", 2, productCatalog, new Promotions(new List<IPromotionalDiscountRule>()));
Assert.That(sut.Barcode, Is.EqualTo("apple"));
Assert.That(sut.Quantity, Is.EqualTo(2));
Assert.That(sut.PricePerUnit, Is.EqualTo(0.75m));
Assert.That(sut.SubTotal, Is.EqualTo(1.50m));
Assert.That(sut.DiscountNote, Is.EqualTo(""));
}
开发者ID:BDDCloud,项目名称:GroceryCoKiosk,代码行数:13,代码来源:RegularPriceLineItemTests.cs
示例20: When_promotion_applies
public void When_promotion_applies()
{
var productCatalog = new ProductCatalog();
productCatalog.AddAdditionalItemDiscount("apple", 1, 1, 100);
productCatalog.AddProduct("apple", 0.75m);
var sut = new AdditionalItemDiscountRule(productCatalog);
var promotions = new Promotions(new List<IPromotionalDiscountRule>() { sut });
var lineItem = new LineItem("apple", 7, productCatalog, promotions);
var actual = sut.PromotionApplies(lineItem);
Assert.That(actual, Is.True);
}
开发者ID:BDDCloud,项目名称:GroceryCoKiosk,代码行数:13,代码来源:AdditionalItemDiscountRuleTests.cs
注:本文中的LineItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论