protected virtual void _(Events.FieldVerifying <PMTimeActivity, PMTimeActivity.projectID> e) { if (e.NewValue != null && e.NewValue is int) { PMProject proj = PXSelect <PMProject> .Search <PMProject.contractID>(this, e.NewValue); if (proj != null) { if (proj.IsCompleted == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCompleted); ex.ErrorValue = proj.ContractCD; throw ex; } if (proj.IsCancelled == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCanceled); ex.ErrorValue = proj.ContractCD;; throw ex; } if (proj.Status == CT.Contract.status.Expired) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsSuspended); ex.ErrorValue = proj.ContractCD;; throw ex; } } } }
protected virtual void PMTimeActivity_ProjectTaskID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { PMTimeActivity row = (PMTimeActivity)e.Row; if (row == null) { return; } if (e.NewValue != null && e.NewValue is int) { PMTask task = PXSelect <PMTask> .Search <PMTask.taskID>(sender.Graph, e.NewValue); if (task != null) { if (task.IsCompleted == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectTaskIsCompleted); ex.ErrorValue = task.TaskCD; throw ex; } if (task.IsCancelled == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectTaskIsCanceled); ex.ErrorValue = task.TaskCD; throw ex; } } } }
protected virtual void PMBudget_UOM_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { PMBudget row = e.Row as PMBudget; if (row == null || string.IsNullOrEmpty(row.UOM)) { return; } var select = new PXSelect <PMTran, Where <PMTran.projectID, Equal <Current <PMBudget.projectID> >, And <PMTran.taskID, Equal <Current <PMBudget.projectTaskID> >, And <PMTran.costCodeID, Equal <Current <PMBudget.costCodeID> >, And <PMTran.inventoryID, Equal <Current <PMBudget.inventoryID> >, And2 <Where <PMTran.accountGroupID, Equal <Current <PMBudget.accountGroupID> >, Or <PMTran.offsetAccountGroupID, Equal <Current <PMBudget.accountGroupID> > > >, And <PMTran.released, Equal <True>, And <PMTran.uOM, NotEqual <Required <PMTran.uOM> > > > > > > > > >(this); string uom = (string)e.NewValue; if (!string.IsNullOrEmpty(uom)) { PMTran tranInOtherUOM = select.SelectWindowed(0, 1, uom); if (tranInOtherUOM != null) { var ex = new PXSetPropertyException(Messages.OtherUomUsedInTransaction); ex.ErrorValue = uom; throw ex; } } }
protected virtual void PMTimeActivityFilter_ProjectID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { PMTimeActivityFilter row = (PMTimeActivityFilter)e.Row; if (row == null) { return; } PMProject proj = PXSelect <PMProject> .Search <PMProject.contractID>(sender.Graph, e.NewValue); if (proj != null) { if (proj.IsCompleted == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCompleted); ex.ErrorValue = proj.ContractCD; throw ex; } if (proj.IsCancelled == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCanceled); ex.ErrorValue = proj.ContractCD; throw ex; } if (proj.Status == Contract.status.Expired) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsSuspended); ex.ErrorValue = proj.ContractCD; throw ex; } } }
/// <summary> /// Verify tax reverse reporting group types on tax update. Called on <see cref="Tax_RowUpdated(PXCache, PXRowUpdatedEventArgs)"/>. /// </summary> /// <param name="newTax">The new tax.</param> /// <param name="oldTax">The old tax.</param> public virtual void VerifyTaxRevReportingGroupTypesOnTaxUpdate(Tax newTax, Tax oldTax) { bool isDeductibleVATSet = newTax.TaxType == CSTaxType.VAT && newTax.DeductibleVAT == true && newTax.DeductibleVAT != oldTax.DeductibleVAT; bool isWithholdingSet = newTax.TaxType == CSTaxType.Withholding && newTax.TaxType != oldTax.TaxType; if (!isDeductibleVATSet && !isWithholdingSet) { return; } PXSetPropertyException deductibleVATException = new PXSetPropertyException(Messages.DeductibleVATWithOutputReportingGroupError); PXSetPropertyException withholdingException = new PXSetPropertyException(Messages.WithholdingTaxWithInputReportingGroupError); foreach (TaxRev taxRev in TaxRevisions.Select()) { if (isDeductibleVATSet && taxRev.TaxType == TaxType.Sales) { TaxRevisions.Cache.RaiseExceptionHandling <TaxRev.taxType>(taxRev, taxRev.TaxType, deductibleVATException); TaxRevisions.Cache.RaiseExceptionHandling <TaxRev.taxBucketID>(taxRev, null, deductibleVATException); } if (isWithholdingSet && taxRev.TaxType == TaxType.Purchase) { TaxRevisions.Cache.RaiseExceptionHandling <TaxRev.taxType>(taxRev, taxRev.TaxType, withholdingException); TaxRevisions.Cache.RaiseExceptionHandling <TaxRev.taxBucketID>(taxRev, null, withholdingException); } } }
public static void RaiseException(this PXCache cache, string fieldName, object row, string message, object newValue = null, PXErrorLevel errorLevel = PXErrorLevel.Error) { var exception = new PXSetPropertyException(message, errorLevel); cache.RaiseExceptionHandling(fieldName, row, newValue, exception); }
public virtual void VerifyExchangeRateExistsForProject(int?newProjectID) { if (!PXAccess.FeatureInstalled <FeaturesSet.projectMultiCurrency>()) { return; } if (!IsCommitmentsEnabled()) { return; } PMProject project; if (ProjectDefaultAttribute.IsProject(Base, newProjectID, out project) && Base.Document.Current != null) { var curySettings = PMCommitmentAttribute.GetCurrencySettings(Base, newProjectID, Base.Document.Current.CuryID); if (!curySettings.UseBaseCurrency && curySettings.ConverionRequired) { CM.Extensions.IPXCurrencyService currencyService = ServiceLocator.Current.GetInstance <Func <PXGraph, CM.Extensions.IPXCurrencyService> >()(Base); var rate = currencyService.GetRate(curySettings.FromCuryID, curySettings.ToCuryID, curySettings.RateTypeID, Base.Document.Current.OrderDate.GetValueOrDefault(DateTime.Now)); if (rate == null) { var ex = new PXSetPropertyException(Messages.ConversionRateNotDefinedForCommitment, curySettings.FromCuryID, curySettings.ToCuryID, curySettings.RateTypeID, Base.Document.Current.OrderDate.GetValueOrDefault(DateTime.Now)); ex.ErrorValue = project.ContractCD; throw ex; } } } }
public override void _(Events.RowPersisting <EntityWithTaxCalcMode> e) { if (SkipValidation || Taxes.Count() == 0) { return; } PXSetPropertyException pex = null; foreach (EPExpenseClaimDetails row in Base.ExpenseClaimDetails.Select()) { try { VerifyTransactions(row.TaxCalcMode, Base.Tax_Rows.Select(row.ClaimDetailID).RowCast <Tax>()); } catch (PXException ex) { pex = new PXSetPropertyException(ex.Message); Base.ExpenseClaimDetails.Cache.RaiseExceptionHandling <EPExpenseClaimDetails.curyTaxTotal>(row, row.CuryTaxTotal, pex); } } if (pex != null) { throw pex; } }
protected virtual void FAOrganizationBook_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { FAOrganizationBook book = (FAOrganizationBook)e.Row; if (book == null) { return; } PXSetPropertyException disableRowException = null; FABookYearSetup setup = PXSelect <FABookYearSetup, Where <FABookYearSetup.bookID, Equal <Current <FAOrganizationBook.bookID> > > > .SelectSingleBound(this, new object[] { book }); if (setup == null && book.UpdateGL != true) { disableRowException = new PXSetPropertyException(Messages.CalendarSetupNotFound, PXErrorLevel.RowWarning, book.BookCode); } OrganizationFinYear nearestFinYear = FinPeriodRepository.FindNearestOrganizationFinYear(book.OrganizationID, "1900"); if (disableRowException == null && book.OrganizationID != FinPeriod.organizationID.MasterValue && book.UpdateGL == true && nearestFinYear == null) { disableRowException = new PXSetPropertyException(GL.Messages.OrganizationCalendarDoesNotExist, PXErrorLevel.RowWarning, PXAccess.GetOrganizationCD(book.OrganizationID)); } if (disableRowException != null) { PXUIFieldAttribute.SetEnabled <FAOrganizationBook.selected>(sender, book, false); sender.RaiseExceptionHandling <FAOrganizationBook.selected>(book, null, disableRowException); } }
private bool ValidateDuplicateMap <BranchField>(PXCache sender, PXView view, object row, object oldrow) where BranchField : IBqlField { int? branch = (int?)sender.GetValue <BranchField>(row); string fromMask = (string)sender.GetValue <BranchAcctMap.fromAccountCD>(row); string toMask = (string)sender.GetValue <BranchAcctMap.toAccountCD>(row); if (string.IsNullOrEmpty(fromMask) || string.IsNullOrEmpty(toMask)) { return(false); } PXSetPropertyException ex = null; if (string.Compare(fromMask, toMask, true) > 0) { ex = new PXSetPropertyException(Messages.MapAccountError); } if (ex == null) { foreach (var item in view.SelectMulti()) { if (item == row || item == oldrow) { continue; } int?itemBranch = (int?)sender.GetValue <BranchField>(item); if (branch == itemBranch) { // same branch string itemFromMask = (string)sender.GetValue <BranchAcctMap.fromAccountCD>(item); string itemToMask = (string)sender.GetValue <BranchAcctMap.toAccountCD>(item); if (string.Compare(fromMask, itemToMask, true) < 0 && string.Compare(itemFromMask, toMask, true) < 0) { ex = new PXSetPropertyException(Messages.MapAccountDuplicate); break; } } } } if (ex != null) { if (!sender.ObjectsEqual <BranchAcctMapFrom.toAccountCD>(row, oldrow) || (oldrow == null && sender.GetValue <BranchAcctMap.toAccountCD>(row) != null)) { sender.RaiseExceptionHandling <BranchAcctMapFrom.toAccountCD>(row, sender.GetValue <BranchAcctMap.toAccountCD>( row), ex); } else { sender.RaiseExceptionHandling <BranchAcctMapFrom.fromAccountCD>(row, sender.GetValue <BranchAcctMap.fromAccountCD>( row), ex); } } return(ex == null); }
protected void ShowErrorMessage <TField>(object entity, object fieldValue, string format, params object[] args) where TField : IBqlField { var cache = Graph.Caches[entity.GetType()]; var exception = new PXSetPropertyException(format, args); cache.RaiseExceptionHandling <TField>(entity, fieldValue, exception); }
public static void RaiseException <TField>(this PXCache cache, object row, string message, object newValue = null, PXErrorLevel errorLevel = PXErrorLevel.Error) where TField : IBqlField { var exception = new PXSetPropertyException(message, errorLevel); cache.RaiseExceptionHandling <TField>(row, newValue, exception); }
private static void RaiseExceptionForRelatedField <TField>(PXCache cache, object entity, string errorMessage, PXErrorLevel errorLevel) where TField : IBqlField { var exception = new PXSetPropertyException <TField>(errorMessage, errorLevel); cache.RaiseExceptionHandling <TField>(entity, cache.GetValue <TField>(entity), exception); }
private static void RaiseExceptionForComplianceFields <TField>(PXCache cache, ComplianceDocument document, object fieldValue, string warningMessage) where TField : IBqlField { var exception = new PXSetPropertyException <TField>(warningMessage, PXErrorLevel.Warning); cache.RaiseExceptionHandling <TField>(document, fieldValue, exception); }
private void ValidateOvertimeBillable(PXCache sender, EPActivity row) { sender.RaiseExceptionHandling <EPActivity.overtimeBillable>(row, null, null); if (row.OvertimeBillable != null && row.OvertimeBillable > row.OvertimeSpent) { var exception = new PXSetPropertyException(CR.Messages.OvertimeBillableCannotBeGreaterThanOvertimeSpent); sender.RaiseExceptionHandling <EPActivity.overtimeBillable>(row, row.OvertimeBillable, exception); } }
private static void RaiseSingleIsExpiredException <TField>(PXCache cache, ComplianceDocument document, object fieldValue, PXErrorLevel errorLevel) where TField : IBqlField { var exception = new PXSetPropertyException <TField>( ComplianceMessages.ComplianceDocumentIsExpiredMessage, errorLevel); cache.RaiseExceptionHandling <TField>(document, fieldValue, exception); }
protected virtual void INKitSpecStkDet_CompInventoryID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { INKitSpecStkDet row = e.Row as INKitSpecStkDet; if (row != null) { PXSelectBase <INKitSpecStkDet> select = new PXSelect <INKitSpecStkDet, Where <INKitSpecStkDet.kitInventoryID, Equal <Current <INKitSpecHdr.kitInventoryID> >, And <INKitSpecStkDet.revisionID, Equal <Current <INKitSpecHdr.revisionID> >, And <INKitSpecStkDet.compInventoryID, Equal <Required <INKitSpecStkDet.compInventoryID> >, And <INKitSpecStkDet.compSubItemID, Equal <Required <INKitSpecStkDet.compSubItemID> > > > > > >(this); PXResultset <INKitSpecStkDet> res = select.Select(e.NewValue, row.CompSubItemID); if (res.Count > 0) { InventoryItem component = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(this, row.CompInventoryID); var ex = new PXSetPropertyException(Messages.KitItemMustBeUniqueAccrosSubItems); ex.ErrorValue = component?.InventoryCD; RaiseOnKitNotUniqueException(e, ex); } PXSelectBase <InventoryItem> selectItemWithLotSerClass = new PXSelectJoin <InventoryItem, LeftJoin <INLotSerClass, On <INLotSerClass.lotSerClassID, Equal <InventoryItem.lotSerClassID> > >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > >(this); foreach (PXResult <InventoryItem, INLotSerClass> kitRes in selectItemWithLotSerClass.Select(Hdr.Current.KitInventoryID)) //single record { InventoryItem kit = (InventoryItem)kitRes; INLotSerClass kitLotSerClass = (INLotSerClass)kitRes; foreach (PXResult <InventoryItem, INLotSerClass> compRes in selectItemWithLotSerClass.Select(e.NewValue)) //single record { INLotSerClass compLotSerClass = (INLotSerClass)compRes; InventoryItem component = (InventoryItem)compRes; //Serial number components are valid only for serial numbered kit validation: if (kit.StkItem == true && kitLotSerClass.LotSerTrack != INLotSerTrack.SerialNumbered && compLotSerClass.LotSerTrack == INLotSerTrack.SerialNumbered) { var ex = new PXSetPropertyException(Messages.SNComponentInSNKit); ex.ErrorValue = component.InventoryCD; RaiseSNComponentInSNKitException(e, ex); } //IsUnassigned components are not supported in kits. if (kit.StkItem != true && compLotSerClass.IsUnassigned) { var ex = new PXSetPropertyException(Messages.WhenUsedComponentInKit); ex.ErrorValue = component.InventoryCD; RaiseUnassignedComponentInKitException(e, ex); } } } } }
private void ShowErrorMessage <TField>( object entity, string format, params object[] args) where TField : IBqlField { var cache = graph.Caches[entity.GetType()]; var fieldValue = cache.GetValue <TField>(entity); var exception = new PXSetPropertyException(format, args); cache.RaiseExceptionHandling <TField>(entity, fieldValue, exception); throw new PXException(); }
private void VerifyReminder(EPActivity row) { if (row.IsReminderOn == true && row.ReminderDate == null) { var reminderDateDisplayName = PXUIFieldAttribute.GetDisplayName <EPActivity.reminderDate>(Tasks.Cache); var exception = new PXSetPropertyException(ErrorMessages.FieldIsEmpty, reminderDateDisplayName); if (Tasks.Cache.RaiseExceptionHandling <EPActivity.reminderDate>(row, null, exception)) { throw new PXRowPersistingException(typeof(EPActivity.reminderDate).Name, null, ErrorMessages.FieldIsEmpty, reminderDateDisplayName); } } }
protected virtual void INKitSpecStkDet_CompInventoryID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { INKitSpecStkDet row = e.Row as INKitSpecStkDet; if (row != null) { PXSelectBase <INKitSpecStkDet> select = new PXSelect <INKitSpecStkDet, Where <INKitSpecStkDet.kitInventoryID, Equal <Current <INKitSpecHdr.kitInventoryID> >, And <INKitSpecStkDet.revisionID, Equal <Current <INKitSpecHdr.revisionID> >, And <INKitSpecStkDet.compInventoryID, Equal <Required <INKitSpecStkDet.compInventoryID> >, And <INKitSpecStkDet.compSubItemID, Equal <Required <INKitSpecStkDet.compSubItemID> > > > > > >(this); PXResultset <INKitSpecStkDet> res = select.Select(e.NewValue, row.CompSubItemID); if (res.Count > 0) { InventoryItem component = InventoryItem.PK.Find(this, row.CompInventoryID); var ex = new PXSetPropertyException(Messages.KitItemMustBeUniqueAccrosSubItems); ex.ErrorValue = component?.InventoryCD; RaiseOnKitNotUniqueException(e, ex); } InventoryItem kit = InventoryItem.PK.Find(this, Hdr.Current.KitInventoryID); if (kit != null) { INLotSerClass kitLotSerClass = INLotSerClass.PK.Find(this, kit.LotSerClassID) ?? new INLotSerClass(); InventoryItem component = InventoryItem.PK.Find(this, (int?)e.NewValue); if (component != null) { INLotSerClass compLotSerClass = INLotSerClass.PK.Find(this, component.LotSerClassID) ?? new INLotSerClass(); //Serial number components are valid only for serial numbered kit validation: if (kit.StkItem == true && kitLotSerClass.LotSerTrack != INLotSerTrack.SerialNumbered && compLotSerClass.LotSerTrack == INLotSerTrack.SerialNumbered) { var ex = new PXSetPropertyException(Messages.SNComponentInSNKit); ex.ErrorValue = component.InventoryCD; RaiseSNComponentInSNKitException(e, ex); } //Manually assigned components are not supported in kits. if (kit.StkItem != true && compLotSerClass.IsManualAssignRequired == true) { var ex = new PXSetPropertyException(Messages.WhenUsedComponentInKit); ex.ErrorValue = component.InventoryCD; RaiseUnassignedComponentInKitException(e, ex); } } } } }
/// <summary> /// Handles the CA transaction detail row updating event. /// </summary> /// <param name="tranDetailsCache">The transaction details cache.</param> /// <param name="e">Row updating event arguments.</param> public static void OnCATranDetailRowUpdatingEvent(PXCache tranDetailsCache, PXRowUpdatingEventArgs e) { ICATranDetail oldTranDetail = e.Row as ICATranDetail; ICATranDetail newTranDetail = e.NewRow as ICATranDetail; if (newTranDetail == null || tranDetailsCache == null) { return; } UpdateNewTranDetailCuryTranAmtOrCuryUnitPrice(tranDetailsCache, oldTranDetail, newTranDetail); if (newTranDetail.AccountID == null) { return; } Account currentAcc = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > . Select(tranDetailsCache.Graph, newTranDetail.AccountID); if (currentAcc?.IsCashAccount != true) { return; } CashAccount cashAccount = GetCashAccount(tranDetailsCache.Graph, newTranDetail.AccountID, newTranDetail.SubID, newTranDetail.BranchID, doSearchWithSubsetsOfArgs: false); if (cashAccount == null) { PXSetPropertyException exception = new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error); string branchCD = (string)PXSelectorAttribute.GetField(tranDetailsCache, newTranDetail, nameof(ICATranDetail.BranchID), newTranDetail.BranchID, typeof(Branch.branchCD).Name); string subCD = (string)PXSelectorAttribute.GetField(tranDetailsCache, newTranDetail, nameof(ICATranDetail.SubID), newTranDetail.SubID, typeof(Sub.subCD).Name); tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.BranchID), newTranDetail, branchCD, exception); tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.SubID), newTranDetail, subCD, exception); e.Cancel = true; } }
protected virtual void OrganizationLedgerLink_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { var link = e.Row as OrganizationLedgerLink; if (e.Operation == PXDBOperation.Delete) { PXSetPropertyException ex = CanBeLinkDeleted(link); if (ex != null) { throw ex; } } }
protected virtual void OrganizationLedgerLink_RowDeleting(PXCache cache, PXRowDeletingEventArgs e) { var link = e.Row as OrganizationLedgerLink; PXSetPropertyException ex = CanBeLinkDeleted(link); if (ex != null) { cache.RaiseExceptionHandling(VisibleField.Name, link, cache.GetValueExt(link, VisibleField.Name), ex); e.Cancel = true; } }
public static void DisplayFieldWarning <TField>( this PXCache cache, object record, object newValue, string message, params object[] errorMessageArguments) where TField : IBqlField { PXSetPropertyException <TField> setPropertyException = new PXSetPropertyException <TField>(message, PXErrorLevel.Warning, errorMessageArguments); if (cache.RaiseExceptionHandling <TField>(record, newValue, setPropertyException)) { throw setPropertyException; } }
protected virtual void ValidateInsert(PXCache cache, Lazy <bool> hasTemplateWithChild, CSAttributeGroup row, bool throwException = false) { if (row.AttributeCategory == CSAttributeGroup.attributeCategory.Variant && row.IsActive == true && hasTemplateWithChild.Value) { var exception = new PXSetPropertyException <CSAttributeGroup.attributeCategory>(Messages.CantAddVariantAttributeForMatrixItem, row.AttributeID); if (!throwException) { cache.RaiseExceptionHandling <CSAttributeGroup.attributeCategory>(row, row.AttributeCategory, exception); } else { throw exception; } } }
public virtual void VerifyProjectLockCommitments(int?newProjectID) { if (!PXAccess.FeatureInstalled <FeaturesSet.changeOrder>()) { return; } PMProject project; if (ProjectDefaultAttribute.IsProject(Base, newProjectID, out project) && project.LockCommitments == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectCommintmentsLocked); ex.ErrorValue = project.ContractCD; throw ex; } }
private void ValidateNotMainRowLevelSources(PXCache cache, object oldRow, object newRow, bool externalCall, FinPeriod newMainOrgFinPeriod) { ValidationResult validationResult = ValidateRowLevelSources( CalendarOrganizationIDProvider, cache, newRow, organizationID => FinPeriodRepository .GetFinPeriodByMasterPeriodID(organizationID, newMainOrgFinPeriod.MasterFinPeriodID).IsSuccess, skipMain: true); if (validationResult.HasErrors) { foreach (var branchValue in validationResult.BranchValuesWithErrors) { if (branchValue.SpecificationItem.BranchSourceType != null && (branchValue.SpecificationItem.BranchSourceFormulaType != null || PXAccess.FeatureInstalled <FeaturesSet.branch>())) { PXCache branchCache = cache.Graph.Caches[BqlCommand.GetItemType(branchValue.SpecificationItem.BranchSourceType)]; object newBranch = branchCache.GetItemType().IsAssignableFrom(newRow.GetType()) ? newRow : branchCache.Current; object oldBranch = branchCache.GetItemType().IsAssignableFrom(oldRow.GetType()) ? oldRow : branchCache.Current; string organizationCD = PXAccess.GetOrganizationCD( PXAccess.GetParentOrganizationID(branchValue.SourceBranchIDs.Single())); var exception = new PXSetPropertyException( Messages.RelatedFinPeriodForMasterDoesNotExistForCompany, FormatForError(newMainOrgFinPeriod.MasterFinPeriodID), organizationCD); SetErrorAndResetToOldForField( branchCache, oldBranch, newBranch, branchValue.SpecificationItem.BranchSourceType.Name, exception, externalCall); } } } }
private void ValidateNonStockInventoryItem(POLine subcontractLine) { var cache = Caches[typeof(POLine)]; if (subcontractLine.InventoryID != null) { var inventoryItem = GetInventoryItem(subcontractLine.InventoryID); if (inventoryItem.NonStockReceipt.GetValueOrDefault() && inventoryItem.StkItem.GetValueOrDefault()) { var exceptionMessage = new PXSetPropertyException <POLine.inventoryID>( ScMessages.InvalidInventoryItemMessage, PXErrorLevel.Error); cache.RaiseExceptionHandling <POLine.inventoryID>(subcontractLine, inventoryItem.InventoryCD, exceptionMessage); } } }
protected virtual void INKitSpecStkDet_UOM_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { INKitSpecStkDet row = e.Row as INKitSpecStkDet; if (row != null) { InventoryItem component = InventoryItem.PK.Find(this, row.CompInventoryID); INLotSerClass lsClass = INLotSerClass.PK.Find(this, component?.LotSerClassID); if (lsClass != null && lsClass.LotSerTrack == INLotSerTrack.SerialNumbered && !string.Equals(component.BaseUnit, (string)e.NewValue, StringComparison.InvariantCultureIgnoreCase)) { var ex = new PXSetPropertyException(Messages.SerialNumberedComponentMustBeInBaseUnitOnly, component.BaseUnit); ex.ErrorValue = e.NewValue; RaiseSerialTrackedComponentIsNotInBaseUnitException(e, ex); } } }
protected virtual void RaiseAvailabilityException(PXCache sender, object row, Type field, string errorMessage, bool onPersist, params object[] args) { var propertyException = new PXSetPropertyException(errorMessage, args); if (onPersist) { object value = sender.GetValueExt(row, field.Name); bool raised = sender.RaiseExceptionHandling(field.Name, row, value, propertyException); if (raised) { throw new PXRowPersistingException(field.Name, value, errorMessage, args); } } else { throw propertyException; } }