Esempio n. 1
0
        public virtual void CheckRelatedGLTranDoesNotExist(int?[] branchIDs)
        {
            if (branchIDs == null || branchIDs.IsEmpty())
            {
                return;
            }

            GLTran tran = PXSelectReadonly <GLTran,
                                            Where <GLTran.branchID, In <Required <GLTran.branchID> > > >
                          .SelectSingleBound(Graph, null, branchIDs);

            if (tran != null)
            {
                Branch branch = BranchMaint.FindBranchByID(Graph, tran.BranchID);

                throw new PXException(Messages.TheBranchOrBranchesCannotBeDeletedBecauseTheRelatedTransactionHasBeenPosted,
                                      branch.BranchCD.Trim(),
                                      tran.ToString());
            }
        }
Esempio n. 2
0
        public virtual void CheckRelatedGLHistoryDoesNotExist(int?[] branchIDs)
        {
            if (branchIDs == null || branchIDs.IsEmpty())
            {
                return;
            }

            GLHistory history = GLUtility.GetRelatedToBranchGLHistory(Graph, branchIDs);

            if (history != null)
            {
                Branch branch = BranchMaint.FindBranchByID(Graph, history.BranchID);

                if (branch != null)
                {
                    throw new PXException(Messages.BranchCanNotBeDeletedBecausePostedGLTransExist,
                                          branch.BranchCD.Trim());
                }
            }
        }