public static bool FixedAssetHasTransactions(int?assetID, PXGraph graph, string tranType, bool isReleased, string origin = null) { PXSelectBase <FATran> bql = new PXSelectReadonly <FATran, Where <FATran.assetID, Equal <Required <FixedAsset.assetID> >, And <FATran.tranType, Equal <Required <FATran.tranType> > > > >(graph); if (isReleased) { bql.WhereAnd <Where <FATran.released, Equal <True> > >(); } else { bql.WhereAnd <Where <FATran.released, NotEqual <True> > >(); } if (origin != null) { bql.WhereAnd <Where <FATran.origin, Equal <Required <FATran.origin> > > >(); return(bql.SelectSingle(assetID, tranType, origin) != null); } else { return(bql.SelectSingle(assetID, tranType) != null); } }
protected virtual void Contact_BAccountID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { Contact contact = (Contact)e.Row; if (contact.BAccountID != (int?)e.NewValue && contact.ContactID > 0) { CRCase crCase = Cases.SelectSingle(); CROpportunity op = Opportunities.SelectSingle(); if (crCase != null || op != null) { throw new PXSetPropertyException(Messages.CannotChangeBAccount); } } }
protected virtual bool HasTemplateWithChild(int?itemClassID, bool clearQueryCache) { var childItemSelect = new PXSelectReadonly <InventoryItem, Where <InventoryItem.itemClassID, Equal <Required <IN.InventoryItem.itemClassID> >, And <InventoryItem.isTemplate, Equal <False>, And <InventoryItem.templateItemID, IsNotNull> > > >(Base); if (clearQueryCache) { childItemSelect.Cache.ClearQueryCache(); } InventoryItem childItem = childItemSelect.SelectSingle(itemClassID); return(childItem != null); }
private void CreateCustomerProcessingCenterRecord(CustomerPaymentMethod customerPM, CCSynchronizeCard syncCard) { PXCache customerProcessingCenterCache = Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CreditCardsFilter.processingCenterId> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(this); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(syncCard.CCProcessingCenterID, syncCard.BAccountID, syncCard.CustomerCCPID); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = syncCard.BAccountID; cProcessingCenter.CCProcessingCenterID = syncCard.CCProcessingCenterID; cProcessingCenter.CustomerCCPID = syncCard.CustomerCCPID; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
protected void CreateCustomerProcessingCenterRecord(V2.TranProfile input) { PXCache customerProcessingCenterCache = Base.Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CustomerProcessingCenterID.cCProcessingCenterID> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(Base); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(SelectedProcessingCenter, SelectedBAccount, input.CustomerProfileId); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = SelectedBAccount; cProcessingCenter.CCProcessingCenterID = SelectedProcessingCenter; cProcessingCenter.CustomerCCPID = input.CustomerProfileId; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
protected virtual void CCProcessingCenter_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { CCProcessingCenter row = e.Row as CCProcessingCenter; if (row == null) { return; } if (e.Operation == PXDBOperation.Insert) { if (CheckUseAimPlugin(row)) { throw new PXRowPersistingException(typeof(CCProcessingCenter.processingTypeName).Name, null, Messages.ProcessingCenterAimPluginNotAllowed); } } if (e.Operation == PXDBOperation.Update) { var query = new PXSelectReadonly <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > >(this); CCProcessingCenter res = query.SelectSingle(row.ProcessingCenterID); if (res?.ProcessingTypeName != row.ProcessingTypeName) { if (CheckUseAimPlugin(row)) { throw new PXRowPersistingException(typeof(CCProcessingCenter.processingTypeName).Name, null, Messages.ProcessingCenterAimPluginNotAllowed); } } } if ((e.Operation & PXDBOperation.Command) != PXDBOperation.Delete && row.IsActive.GetValueOrDefault() && string.IsNullOrEmpty(row.ProcessingTypeName)) { if (sender.RaiseExceptionHandling <CCProcessingCenter.processingTypeName>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(CCProcessingCenter.processingTypeName).Name))) { throw new PXRowPersistingException(typeof(CCProcessingCenter.processingTypeName).Name, null, ErrorMessages.FieldIsEmpty, typeof(CCProcessingCenter.processingTypeName).Name); } } }