protected void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del) { // Event handler body before the base BLC event handler collection if (del != null) { del(sender, e); } // Event handler body after the base BLC event handler collection if (e.Row != null) { InventoryItemExt ext = PXCache <InventoryItem> .GetExtension <InventoryItemExt>((InventoryItem)e.Row); if (ext != null) { if (ext.UsrIsAircraft != null) { PXUIFieldAttribute.SetEnabled <InventoryItemExt.usrTapeModelID>(sender, e.Row, (bool)ext.UsrIsAircraft); } else { PXUIFieldAttribute.SetEnabled <InventoryItemExt.usrTapeModelID>(sender, e.Row, false); } } } }
//Requires a model if IsAircraft is checked in the Inventory Items screen protected void InventoryItem_RowPersisting(PXCache sender, PXRowPersistingEventArgs e, PXRowPersisting del) { var row = (InventoryItem)e.Row; if (row != null) { InventoryItemExt ext = PXCache <InventoryItem> .GetExtension <InventoryItemExt>(row); if (ext != null) { if ((bool)ext.UsrIsAircraft && ext.UsrTapeModelID == null) { throw new PXSetPropertyException <InventoryItemExt.usrTapeModelID>( "Enter a Model.", PXErrorLevel.Error); } } } del(sender, e); }
//Defaults the Manufacturer from the model selection in the Inventory Items screen protected virtual void InventoryItem_UsrTapeModelID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { var row = (InventoryItem)e.Row; if (row != null) { InventoryItemExt inventoryEX = PXCache <InventoryItem> .GetExtension <InventoryItemExt>(row); if (inventoryEX != null) { PXCache hCache = Base.ItemSettings.Cache; InventoryItem hdr = Base.ItemSettings.Current; CAMPTapeModel model = (CAMPTapeModel)PXSelectorAttribute.Select <InventoryItemExt.usrTapeModelID>(hCache, hdr); if (model != null) { inventoryEX.UsrManufacturerID = model.ManufacturerID; } else { inventoryEX.UsrManufacturerID = null; } } } }