Пример #1
0
 protected T InsertWith <T>(PXGraph graph, T row, PXRowInserted handler)
     where T : class, IBqlTable, new()
 {
     graph.RowInserted.AddHandler <T>(handler);
     try
     {
         return(PXCache <T> .Insert(graph, row));
     }
     finally
     {
         graph.RowInserted.RemoveHandler <T>(handler);
     }
 }
    protected virtual void AMWC_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted del)
    {
        if (del != null)
        {
            del(sender, e);
        }

        var row = (AMWC)e.Row;

        if (string.IsNullOrWhiteSpace(row?.WcID) || Base.IsImport || Base.IsContractBasedAPI || Base.WCShifts.Cache.Inserted.Any_())
        {
            return;
        }

        Base.WCShifts.Insert(new AMShift
        {
            WcID = row.WcID
        });
    }
Пример #3
0
        protected virtual void Batch_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted bs)
        {
            if (bs != null)
            {
                bs(sender, e);
            }

            if (Base.IsWithinContext)
            {
                string vb   = Base.GetContextValue <GLVoucherBatch.voucherBatchNbr>();
                string wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                this.VoucherBatch.Current = this.VoucherBatch.Select(wbID, vb);
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (!String.IsNullOrEmpty(vb))
                {
                    Guid?noteID = PXNoteAttribute.GetNoteID <Batch.noteID>(sender, e.Row);
                    this.Voucher.Insert(new GLVoucher());
                    this.Voucher.Cache.IsDirty        = false;
                    Base.Caches[typeof(Note)].IsDirty = false;
                }
                if (wb.DefaultDescription != null && (e.Row as Batch)?.Description == null)
                {
                    sender.SetValueExt <Batch.description>(e.Row, wb.DefaultDescription);
                }
            }
        }
        protected virtual void APQuickCheck_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted bs)
        {
            if (bs != null)
            {
                bs(sender, e);
            }
            bool isWithinContext = Base.IsWithinContext;

            if (isWithinContext)
            {
                string vb   = Base.GetContextValue <GLVoucherBatch.voucherBatchNbr>();
                string wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                this.VoucherBatch.Current = this.VoucherBatch.Select(wbID, vb);
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (!String.IsNullOrEmpty(vb))
                {
                    Guid?noteID = PXNoteAttribute.GetNoteID <AP.Standalone.APQuickCheck.noteID>(sender, e.Row);
                    this.Voucher.Insert(new GLVoucher());
                    this.Voucher.Cache.IsDirty        = false;
                    Base.Caches[typeof(Note)].IsDirty = false;
                }

                var row = (AP.Standalone.APQuickCheck)e.Row;

                if (wb.DefaultDescription != null && row.DocDesc == null)
                {
                    sender.SetValueExt <AP.Standalone.APQuickCheck.docDesc>(e.Row, wb.DefaultDescription);
                }

                if (wb.DefaultBAccountID != null && row.VendorID == null)
                {
                    sender.SetValueExt <AP.Standalone.APQuickCheck.vendorID>(e.Row, wb.DefaultBAccountID);

                    if (wb.DefaultLocationID != null)
                    {
                        sender.SetValueExt <AP.Standalone.APQuickCheck.vendorLocationID>(e.Row, wb.DefaultLocationID);
                    }
                }
            }
        }
        protected virtual void CAAdj_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted bs)
        {
            if (bs != null)
            {
                bs(sender, e);
            }
            bool isWithinContext = Base.IsWithinContext;

            if (isWithinContext)
            {
                string vb   = Base.GetContextValue <GLVoucherBatch.voucherBatchNbr>();
                string wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                this.VoucherBatch.Current = this.VoucherBatch.Select(wbID, vb);
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (!String.IsNullOrEmpty(vb))
                {
                    Guid?noteID = PXNoteAttribute.GetNoteID <CAAdj.noteID>(sender, e.Row);
                    this.Voucher.Insert(new GLVoucher());
                    this.Voucher.Cache.IsDirty        = false;
                    Base.Caches[typeof(Note)].IsDirty = false;
                }

                var row = (CAAdj)e.Row;

                if (wb.DefaultDescription != null && row.TranDesc == null)
                {
                    sender.SetValueExt <CAAdj.tranDesc>(e.Row, wb.DefaultDescription);
                }
                if (wb.DefaultCashAccountID != null && row.CashAccountID == null)
                {
                    sender.SetValueExt <CAAdj.cashAccountID>(e.Row, wb.DefaultCashAccountID);
                }
                if (wb.DefaultEntryTypeID != null && row.EntryTypeID == null)
                {
                    sender.SetValueExt <CAAdj.entryTypeID>(e.Row, wb.DefaultEntryTypeID);
                }
            }
        }
        public void POReceiptLineSplit_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted BaseInvoke)
        {
            if (BaseInvoke != null)
            {
                BaseInvoke(sender, e);
            }

            AssociateAttributeToLotSerial((POReceiptLineSplit)e.Row);
        }
        protected virtual void SOShipLine_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted baseHandler)
        {
            if (!(e.Row is SOShipLine))
            {
                return;
            }
            baseHandler?.Invoke(sender, e);
            SOShipLine row    = e.Row as SOShipLine;
            SOLine     soLine = KCSOLineByLineNbrAndOrderNbr.SelectSingle(row.OrigLineNbr, row.OrigOrderNbr);

            if (soLine != null && row.OrigOrderQty != soLine.Qty)
            {
                row.OrigOrderQty     = soLine.Qty;
                row.BaseOrigOrderQty = soLine.Qty;
                Base.Transactions.Update(row);
            }
            var extrows = Base.Transactions.Cache.GetExtension <SOShipLinePCExt>(row);

            if (extrows.UsrKNMasterLineNbr == row.OrigLineNbr)
            {
                extrows.UsrKNCompositeInventory = KCMessages.CompositeItemLinePlaceholder;
            }
        }