/// <summary>
 /// Deprecated Method for adding a new object to the SalePaymentItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSalePaymentItems(SalePaymentItem salePaymentItem)
 {
     base.AddObject("SalePaymentItems", salePaymentItem);
 }
 /// <summary>
 /// Create a new SalePaymentItem object.
 /// </summary>
 /// <param name="code">Initial value of the Code property.</param>
 /// <param name="terminalCode">Initial value of the TerminalCode property.</param>
 /// <param name="salePaymentHeaderCode">Initial value of the SalePaymentHeaderCode property.</param>
 /// <param name="terminalToCode">Initial value of the TerminalToCode property.</param>
 /// <param name="paymentInstrumentCode">Initial value of the PaymentInstrumentCode property.</param>
 /// <param name="quantity">Initial value of the Quantity property.</param>
 public static SalePaymentItem CreateSalePaymentItem(global::System.Int32 code, global::System.Int32 terminalCode, global::System.Int32 salePaymentHeaderCode, global::System.Int32 terminalToCode, global::System.Int32 paymentInstrumentCode, global::System.Double quantity)
 {
     SalePaymentItem salePaymentItem = new SalePaymentItem();
     salePaymentItem.Code = code;
     salePaymentItem.TerminalCode = terminalCode;
     salePaymentItem.SalePaymentHeaderCode = salePaymentHeaderCode;
     salePaymentItem.TerminalToCode = terminalToCode;
     salePaymentItem.PaymentInstrumentCode = paymentInstrumentCode;
     salePaymentItem.Quantity = quantity;
     return salePaymentItem;
 }
 public void RemovePaymentInstrument(SalePaymentItem payment)
 {
     SalePaymentItems.Remove(payment);
     RefreshTotalQuantity();
 }
 private void AddPaymentInstrument(object parameter)
 {
     var paymentInstrument = new PaymentInstrumentSelectionViewModel(Sale);
     Terminal.Instance.Client.ShowDialog(paymentInstrument.View,null,
     (canAddPayment) =>
         {
             if (canAddPayment)
             {
                 var payment =
                     Sale.SalePaymentHeader.SalePaymentItems.
                         FirstOrDefault(item =>item.PaymentInstrumentCode == paymentInstrument.SelectedItem.Code);
                 Sale.SalePaymentHeader.Change = paymentInstrument.SelectedQuantity - Sale.SalePaymentHeader.RestToPay;
                 if (payment == null)
                 {
                     var newItem = new SalePaymentItem(Sale.SalePaymentHeader, paymentInstrument.SelectedItem,
                         Sale.SalePaymentHeader.Change > 0 ? Sale.SalePaymentHeader.RestToPay : paymentInstrument.SelectedQuantity);
                     Sale.SalePaymentHeader.AddPaymentInstrument(newItem);
                     SalePaymentItemsSource.Add(new SalePaymentItemViewModel
                                                     {
                                                         PaymentItem = newItem,
                                                         DeleteCommand = new ZeroActionDelegate(RemovePaymentInstrument)
                                                     });
                     Sale.UpdatePrintMode();
                 }
                 else
                 {
                     payment.Quantity += Sale.SalePaymentHeader.Change > 0 ? Sale.SalePaymentHeader.RestToPay : paymentInstrument.SelectedQuantity;
                 }
             }
             addPaymnentInstrumentCommand.RaiseCanExecuteChanged();
         });
 }
 public void AddPaymentInstrument(SalePaymentItem payment)
 {
     SalePaymentItems.Add(payment);
     RefreshTotalQuantity();
 }