예제 #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;
            }

            FADetails assetdet = PXSelect <FADetails, Where <FADetails.assetID, Equal <Required <FADetails.assetID> > > > .Select(this, asset.AssetID);

            try
            {
                AssetProcess.ThrowDisabled_Dispose(this, asset, assetdet, fasetup.Current, (DateTime)Filter.Current.DisposalDate, Filter.Current.DisposalPeriodID, Filter.Current.DeprBeforeDisposal == true);
            }
            catch (PXException exc)
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning));
            }
            if (Filter.Current.DisposalAmtMode == DisposalFilter.disposalAmtMode.Manual && asset.Selected == true && asset.DisposalAmt == null)
            {
                sender.RaiseExceptionHandling <FixedAsset.disposalAmt>(asset, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXUIFieldAttribute.GetDisplayName <FixedAsset.disposalAmt>(sender)));
            }
        }