Beispiel #1
0
 private void MaintainLienWaiverRecipientsLinks(LienWaiverRecipient lienWaiverRecipient)
 {
     if (lienWaiverRecipient.Selected != true)
     {
         LienWaiverRecipientProjects.Delete(lienWaiverRecipient);
     }
 }
        protected override void SyncWithDocumentCart(ScanHeader header, ScanLine line, INCartSplit cartSplit, decimal?qty)
        {
            INRegisterCart registerCart = RegisterCart.Current;

            if (registerCart == null)
            {
                registerCart = RegisterCart.Insert();
            }

            RegisterCart.Cache.SetValue <INRegisterCart.docType>(registerCart, Register.DocType);
            RegisterCart.Cache.SetValue <INRegisterCart.refNbr>(registerCart, Register.RefNbr);

            SyncWithDocumentCartLine(header, line, cartSplit, qty);

            if (IsEmptyCart)
            {
                RegisterCart.Delete(registerCart);
            }
        }
        protected virtual void SyncWithDocumentCartLine(ScanHeader header, ScanLine line, INCartSplit cartSplit, decimal?qty)
        {
            bool emptyLine = line.Qty.GetValueOrDefault() == 0;

            INRegisterCartLine docCartLine = RegisterCartLines.Search <INRegisterCartLine.lineNbr>(line.LineNbr);

            if (docCartLine == null)
            {
                if (qty <= 0)
                {
                    throw new PXArgumentException(nameof(qty));
                }
                docCartLine = RegisterCartLines.Insert();
                RegisterCartLines.Cache.SetValue <INRegisterCartLine.cartSplitLineNbr>(docCartLine, cartSplit.SplitLineNbr);
            }
            docCartLine      = (INRegisterCartLine)RegisterCartLines.Cache.CreateCopy(docCartLine);
            docCartLine.Qty += qty;
            RegisterCartLines.Cache.Update(docCartLine);

            if (docCartLine.Qty == 0)
            {
                RegisterCartLines.Delete(docCartLine);
            }
        }