/// <summary> /// Add a <c>Quote product</c> to <c>Quote</c> with existing <c>Product</c>. /// </summary> /// <param name="quoteId"><c>Quote</c> Id</param> /// <param name="productId"><c>Product</c> Id</param> /// <param name="uomId"><c>UoM</c> Id</param> /// <param name="quantity"><c>Quantity</c></param> /// <param name="price"><c>Price</c></param> /// <param name="discountAmount"><c>Discount amount</c> by currency</param> /// <param name="tax"><c>Tax amount</c>by currency</param> /// <returns>Created record Id (<see cref="Guid"/>)</returns> public Guid Add(Guid quoteId, Guid productId, Guid uomId, decimal quantity, decimal?price, decimal?discountAmount, decimal?tax) { ExceptionThrow.IfGuidEmpty(quoteId, "quoteId"); ExceptionThrow.IfGuidEmpty(productId, "productId"); ExceptionThrow.IfGuidEmpty(uomId, "uomId"); ExceptionThrow.IfNegative(quantity, "quantity"); var entity = XProduct.Create(this.EntityName, "quote", quoteId, productId, uomId, "", quantity, price, discountAmount, tax); return(this.OrganizationService.Create(entity)); }
/// <summary> /// Add a <c>Quote product</c> to <c>Quote</c> with manual product information. /// </summary> /// <param name="quoteId"><c>Quote</c> Id</param> /// <param name="productName"><c>Product Name</c></param> /// <param name="quantity"><c>Quantity</c></param> /// <param name="price"><c>Price</c></param> /// <param name="discountAmount"><c>Discount amount</c> by currency</param> /// <param name="tax"><c>Tax amount</c>by currency</param> /// <returns>Created record Id (<see cref="Guid"/>)</returns> public Guid Add(Guid quoteId, string productName, decimal quantity, decimal price, decimal?discountAmount, decimal?tax) { ExceptionThrow.IfGuidEmpty(quoteId, "quoteId"); ExceptionThrow.IfNullOrEmpty(productName, "productName"); ExceptionThrow.IfNegative(quantity, "quantity"); ExceptionThrow.IfNegative(price, "price"); var entity = XProduct.Create(this.EntityName, "quote", quoteId, null, null, productName, quantity, price, discountAmount, tax); return(this.OrganizationService.Create(entity)); }