public virtual void OnPersist(IEnumerable <Organization> organizations)
            {
                OrganizationMaint organizationMaint = CreateInstance <OrganizationMaint>();

                PXCache organizationCache = organizationMaint.OrganizationView.Cache;

                PXDBTimestampAttribute timestampAttribute = organizationCache
                                                            .GetAttributesOfType <PXDBTimestampAttribute>(null, nameof(Organization.tstamp))
                                                            .First();

                timestampAttribute.RecordComesFirst = true;

                foreach (Organization organization in organizations)
                {
                    organizationMaint.Clear();

                    organizationMaint.BAccount.Current = organizationMaint.BAccount.Search <OrganizationBAccount.bAccountID>(organization.BAccountID);

                    organizationCache.Clear();
                    organizationCache.ClearQueryCache();

                    if (organization.ActualLedgerID < 0)
                    {
                        organization.ActualLedgerID = LedgerIDMap[organization.ActualLedgerID].LedgerID;
                    }

                    organizationCache.Current = organization;
                    organizationCache.SetStatus(organizationMaint.OrganizationView.Current, PXEntryStatus.Updated);

                    organizationMaint.Actions.PressSave();
                }
            }
예제 #2
0
 protected virtual void INTranSplit_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
 {
     //for cluster only. SelectQueries sometimes does not contain all the needed records after failed Save operation
     if (e.TranStatus == PXTranStatus.Aborted && PX.Common.WebConfig.IsClusterEnabled)
     {
         sender.ClearQueryCache();
     }
 }