예제 #1
0
        public virtual IEnumerable delete(PXAdapter adapter)
        {
            GLVoucherBatch batch = VoucherBatches.Current;

            if (batch == null)
            {
                throw new PXException(Messages.NoBatchesForDelete);
            }
            if (VoucherBatches.Ask(PXMessages.LocalizeFormatNoPrefixNLA(Messages.BatchDeleteConfirmation, batch.VoucherBatchNbr), MessageButtons.OKCancel) == WebDialogResult.OK)
            {
                if (batch.Released == true)
                {
                    throw new PXException(Messages.BatchDeleteReleased);
                }
                List <GLVoucherBatch> fullList = new List <GLVoucherBatch>();
                foreach (GLVoucherBatch voucherBatch in VoucherBatches.Select())                //create list to show all records during processing
                {
                    fullList.Add(voucherBatch);
                }
                PXLongOperation.ClearStatus(this.UID);
                PXLongOperation.StartOperation(this, delegate() { DeleteBatch(batch, fullList.ToArray <object>()); });
                VoucherBatches.View.RequestRefresh();
            }
            return(adapter.Get());
        }