public virtual void CheckRelatedWarehousesDontExist(int?[] branchIDs, string exceptionMessage) { if (branchIDs == null || branchIDs.IsEmpty()) { return; } INSite[] sites = PXSelectReadonly <INSite, Where <INSite.branchID, In <Required <INSite.branchID> > > > .SelectWindowed(Graph, 0, EntityCountInErrorMessage + 1, branchIDs) .RowCast <INSite>() .ToArray(); if (sites.Any()) { IEnumerable <Branch> branches = BranchMaint.FindBranchesByID(Graph, sites.Take(EntityCountInErrorMessage).Select(a => a.BranchID).ToArray()); throw new PXSetPropertyException(exceptionMessage, branches.Select(b => b.BranchCD.Trim()).ToArray().JoinIntoStringForMessage(), sites.Select(s => s.SiteCD.Trim()).ToArray().JoinIntoStringForMessage(EntityCountInErrorMessage)); } }
public virtual void CheckRelatedCashAccountsDontExist(int?[] branchIDs) { if (branchIDs == null || branchIDs.IsEmpty()) { return; } CA.CashAccount[] cashAccounts = PXSelectReadonly <CA.CashAccount, Where <CA.CashAccount.branchID, In <Required <CA.CashAccount.branchID> >, And <CA.CashAccount.restrictVisibilityWithBranch, Equal <boolTrue> > > > .SelectWindowed(Graph, 0, EntityCountInErrorMessage + 1, branchIDs) .RowCast <CA.CashAccount>() .ToArray(); if (cashAccounts.Any()) { IEnumerable <Branch> branches = BranchMaint.FindBranchesByID(Graph, branchIDs).ToArray(); throw new PXException(Messages.CashAccountsForBranch, branches.Select(b => b.BranchCD.Trim()).ToArray().JoinIntoStringForMessage(), cashAccounts.Select(a => a.CashAccountCD.Trim()).ToArray().JoinIntoStringForMessage(EntityCountInErrorMessage)); } }