Ejemplo n.º 1
0
        protected virtual void _(Events.RowPersisted <APTran> e)
        {
            if (e.Row == null)
            {
                return;
            }

            APTran apTranRow = (APTran)e.Row;

            // We call here cache.GetStateExt for every field when the transaction is aborted
            // to set the errors in the fields and then the Generate Invoice screen can read them
            if (e.TranStatus == PXTranStatus.Aborted && IsInvoiceProcessRunning == true)
            {
                MessageHelper.GetRowMessage(e.Cache, apTranRow, false, false);
            }
        }
Ejemplo n.º 2
0
        public static List <ErrorInfo> GetErrorInfo <TranType, TranExtensionType>(PXCache headerCache, IBqlTable headerRow, PXSelectBase <TranType> detailView)
            where TranType : class, IBqlTable, new()
            where TranExtensionType : PXCacheExtension <TranType>, IPostDocLineExtension
        {
            List <ErrorInfo> errorList = new List <ErrorInfo>();
            ErrorInfo        errorInfo = null;

            string headerErrorMessage = MessageHelper.GetRowMessage(headerCache, headerRow, true, false);

            if (string.IsNullOrEmpty(headerErrorMessage) == false)
            {
                errorInfo = new ErrorInfo()
                {
                    HeaderError   = true,
                    SOID          = null,
                    AppointmentID = null,
                    ErrorMessage  = headerErrorMessage
                };

                errorList.Add(errorInfo);
            }

            foreach (TranType row in detailView.Select())
            {
                string errorMessage = MessageHelper.GetRowMessage(detailView.Cache, row, true, false);

                if (string.IsNullOrEmpty(errorMessage) == false)
                {
                    TranExtensionType rowExtension = detailView.Cache.GetExtension <TranExtensionType>(row);

                    errorInfo = new ErrorInfo()
                    {
                        HeaderError   = false,
                        SOID          = rowExtension.SOID,
                        AppointmentID = rowExtension.AppointmentID,
                        ErrorMessage  = errorMessage + ", "
                    };

                    errorList.Add(errorInfo);
                }
            }

            return(errorList);
        }