private void TransferPosition(SvenTechCollection <SalesOrderPosition> target, SvenTechCollection <SalesOrderPosition> source, SalesOrderPosition item, int Quantity) { if (target.IsNull() || source.IsNull() || item.IsNull() || Quantity <= 0) { return; } if (Quantity == item.Quantity) { if (target.SingleOrDefault(x => x.SalesOrderPositionId == item.SalesOrderPositionId) != null) { target.SingleOrDefault(x => x.SalesOrderPositionId == item.SalesOrderPositionId).Quantity += Quantity; } else { target.Add(item); } source.Remove(item); } else { SalesOrderPosition itemClone = item.Clone(); itemClone.Quantity = Quantity; if (target.SingleOrDefault(x => x.SalesOrderPositionId == item.SalesOrderPositionId) != null) { target.SingleOrDefault(x => x.SalesOrderPositionId == item.SalesOrderPositionId).Quantity += Quantity; } else { target.Add(itemClone); } source.SingleOrDefault(x => x.SalesOrderPositionId == item.SalesOrderPositionId).Quantity -= Quantity; } }
public void AddToInvoiceDrop(IDropEventArgs e) { if (e.GridControl.Name != "OrderPositions") { e.Handled = true; return; } if (e.Items?.Count > 0 && e.Items[0] is SalesOrderPosition) { SalesOrderPosition item = (SalesOrderPosition)e.Items[0]; if (item.Quantity > 1) { Messenger.Default.Send(new OpenQuantityWindowMessage((int)item.Quantity)); } else { _Quantity = 1; } TransferPosition(ProductsOnInvoice, OrderedProducts, item, _Quantity); e.Handled = true; } }
public static bool Update(SalesOrderPosition SalesOrderPosition) { return(WebApi <bool> .PutAsync(controllerName, SalesOrderPosition, "Put").Result); }
public static int Insert(SalesOrderPosition SalesOrderPosition) { return(WebApi <int> .PostAsync(controllerName, SalesOrderPosition, "SinglePost").Result); }