Skip to content

Instantly share code, notes, and snippets.

@smarenich
Created July 12, 2016 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/b15c4aa289b5d114561ac457804c5d9e to your computer and use it in GitHub Desktop.
Save smarenich/b15c4aa289b5d114561ac457804c5d9e to your computer and use it in GitHub Desktop.
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