protected virtual void Account_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e) { if (e.NewRow == null) { return; } var account = (Account)e.NewRow; try { ValidateAccountGroupID(sender, account); } catch (PXSetPropertyException ex) { if (ex.ErrorLevel == PXErrorLevel.Error) { PM.PMAccountGroup item = (PM.PMAccountGroup)PXSelectorAttribute.Select <Account.accountGroupID>(sender, account); sender.RaiseExceptionHandling <Account.accountGroupID>(account, item.GroupCD, ex); } else { sender.RaiseExceptionHandling <Account.accountGroupID>(account, account.AccountGroupID, ex); } } }
protected virtual void Account_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { Account row = (Account)e.Row; try { ValidateAccountGroupID(sender, row); } catch (PXSetPropertyException ex) { if (ex.ErrorLevel == PXErrorLevel.Error) { PM.PMAccountGroup item = (PM.PMAccountGroup)PXSelectorAttribute.Select <Account.accountGroupID>(sender, row); sender.RaiseExceptionHandling <Account.accountGroupID>(row, item.GroupCD, ex); throw ex; } } if (!string.IsNullOrEmpty(row.CuryID)) { CASetup casetup = PXSelect <CASetup> .Select(this); if (casetup != null && casetup.TransitAcctId != null && casetup.TransitAcctId == row.AccountID) { PXException exception = new PXException(CA.Messages.CashInTransitAccountCanNotBeDenominated); sender.RaiseExceptionHandling <Account.curyID>(row, row.CuryID, exception); throw exception; } string newCuryid; if (e.Operation == PXDBOperation.Update) { newCuryid = row.CuryID; byte[] timestamp = PXDatabase.SelectTimeStamp(); PXDatabase.Update <GLHistory>(new PXDataFieldAssign("CuryID", newCuryid), new PXDataFieldRestrict("AccountID", ((Account)e.Row).AccountID), new PXDataFieldRestrict("CuryID", PXDbType.VarChar, 5, null, PXComp.ISNULL), new PXDataFieldRestrict("tstamp", PXDbType.Timestamp, 8, timestamp, PXComp.LE)); } } }