コード例 #1
0
        protected virtual void FixedAsset_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            FixedAsset asset = (FixedAsset)e.Row;

            // AssetID can be <0 when the datasource inserts a temporary record on redirect from selector
            if (asset == null || asset.AssetID < 0)
            {
                return;
            }

            FADetailsTransfer det = PXSelect <FADetailsTransfer, Where <FADetailsTransfer.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset });

            try
            {
                AssetProcess.ThrowDisabled_Transfer(this, asset, det);
            }
            catch (PXException exc)
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning));
            }

            if (string.IsNullOrEmpty(det.TransferPeriodID))
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FADetailsTransfer.transferPeriodID>(asset, null, new PXSetPropertyException(Messages.NextPeriodNotGenerated));
            }
        }