protected void _(Events.FieldDefaulting <SOLineExt.usrProjectNbr> e) { var row = e.Row as SOLine; if (row == null) { return; } SOLineExt extension = row.GetExtension <SOLineExt>(); List <FLXProject> list = SelectFrom <FLXProject> .Where <FLXProject.status.IsNotEqual <ProjectStatus.hold> .And <FLXProject.customerID.IsEqual <P.AsInt> .And <FLXProject.endCustomerID.IsEqual <P.AsInt> .And <FLXProject.nonStockItem.IsEqual <P.AsInt> > > > > .View.Select(Base, row.CustomerID, extension.UsrEndCustomerID, extension.UsrNonStockItem).RowCast <FLXProject>().ToList <FLXProject>(); e.NewValue = list.Count == 1 ? list[0].ProjectNbr : null; ///<remarks> The following modification is added due to customizing the new standard that affects SO upgrades using drop-ship logic. </remarks> if (e.NewValue == null && extension.UsrNonStockItem != null && extension.UsrEndCustomerID != null) { Base.Transactions.SetValueExt <SOLine.pOCreate>(row, false); } }
protected void _(Events.RowInserted <SOLine> e) { foreach (InvoiceSplits invoiceSplits in this.Base.invoicesplits.Cache.Inserted) { SOLineExt extension1 = ((SOLine)SelectFrom <SOLine> .Where <SOLine.orderType.IsEqual <P.AsString> .And <SOLine.orderNbr.IsEqual <P.AsString> .And <SOLine.lineNbr.IsEqual <P.AsInt> > > > .View.Select(Base, invoiceSplits.OrderTypeSOLine, invoiceSplits.OrderNbrSOLine, invoiceSplits.LineNbrSOLine)).GetExtension <SOLineExt>(); SOLineExt extension2 = e.Row.GetExtension <SOLineExt>(); extension2.UsrNonStockItem = extension1.UsrNonStockItem; extension2.UsrEndCustomerID = extension1.UsrEndCustomerID; extension2.UsrProjectNbr = extension1.UsrProjectNbr; extension2.UsrCustLineNbr = extension1.UsrCustLineNbr; } foreach (SOLine soLine in this.Base.Transactions.Cache.Updated) { if (soLine.Operation == SOOperation.Receipt)// && soLine.InvoiceNbr != null) { SOLineExt extension1 = soLine.GetExtension <SOLineExt>(); SOLineExt extension2 = e.Row.GetExtension <SOLineExt>(); extension2.UsrNonStockItem = extension1.UsrNonStockItem; extension2.UsrEndCustomerID = extension1.UsrEndCustomerID; extension2.UsrProjectNbr = extension1.UsrProjectNbr; extension2.UsrCustLineNbr = extension1.UsrCustLineNbr; } } }
protected void _(Events.FieldDefaulting <SOLine.inventoryID> e) { var row = e.Row as SOLine; if (row == null) { return; } SOLineExt extension = row.GetExtension <SOLineExt>(); if (!string.IsNullOrEmpty(extension.UsrProjectNbr)) { e.NewValue = SelectFrom <FLXProject> .Where <FLXProject.projectNbr.IsEqual <P.AsString> > .View.Select(Base, extension.UsrProjectNbr).TopFirst.StockItem; } }