Created
July 12, 2016 02:58
-
-
Save smarenich/b15c4aa289b5d114561ac457804c5d9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public PXAction<MultiPayment> Release; | |
[PXProcessButton] | |
[PXUIField(DisplayName = "Release")] | |
protected virtual void release() | |
{ | |
this.Actions.PressSave(); | |
PXLongOperation.StartOperation(this, delegate () | |
{ | |
CreatePayment(row); | |
}); | |
} | |
public static void CreatePayment(MultiPayment multi) | |
{ | |
ReleaseInfo info = new ReleaseInfo(); | |
//.... | |
try | |
{ | |
//Do all processing | |
} | |
catch(Exception ex) | |
{ | |
info.details[line.Key] = ex; | |
} | |
//.... | |
PXLongOperation.SetCustomInfo(info); | |
} | |
public class ReleaseInfo : IPXCustomInfo | |
{ | |
public Dictionary<string, Exception> details = new Dictionary<string, Exception>(); | |
public void Complete(PXLongRunStatus status, PXGraph graph) | |
{ | |
if (status == PXLongRunStatus.Aborted && graph is MultiPaymentEntry) | |
{ | |
((MultiPaymentEntry)graph).RowSelected.AddHandler<MultiPaymentLine>((sender, e) => | |
{ | |
MultiPaymentLine line = e.Row as MultiPaymentLine; | |
if (line != null) | |
{ | |
if (details.ContainsKey(line.Key)) | |
{ | |
Exception ex = details[line.Key]; | |
if (ex != null) sender.RaiseExceptionHandling<MultiPaymentLine.key>(line, line.Key, | |
new PXSetPropertyException(ex.Message, PXErrorLevel.RowError)); | |
} | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment