public string ScanHasBeenUploadedTo(string URL) { string methodStatus = String.Empty; Uri URI = new Uri(URL); string newFileName = URI.Segments[URI.Segments.Length - 1]; Facade.Form facScanForm = new Orchestrator.Facade.Form(); Entities.Scan scan = facScanForm.GetForScannedFormForScannedFormPDF(newFileName); if (scan == null) { throw new ApplicationException("ScanHasBeenUploadedTo - Scan not found for filename " + newFileName); } scan.IsUploaded = true; scan.ScannedFormPDF = URL; try { // update the IsUploaded flag on the scannedForm facScanForm.Update(scan, scan.CreateUserID); } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploadedTo - Update ScanForm failed", ex); } //If the scan is a POD email it if (scan.FormTypeId == eFormTypeId.POD) { //Email the POD to the client Facade.IPOD facPod = new Facade.POD(); //Make the call to send the email async as it will //have to download the attachment MethodCall <string, int> asyncSendClientPod = facPod.SendClientPod; asyncSendClientPod.BeginInvoke(scan.ScannedFormId, r => { try { asyncSendClientPod.EndInvoke(r); } catch (Exception ex) { WebUI.Global.UnhandledException(ex); } }, null); } return(methodStatus); }
public string ScanHasBeenUploadedToWithId(string URL, int scannedFormId) { var methodStatus = String.Empty; var facScanForm = new Facade.Form(); var scan = facScanForm.GetForScannedFormId(scannedFormId); if (scan == null) { // If scan is null try and use the old method based on file name. ScanHasBeenUploadedTo(URL); return(methodStatus); } scan.IsUploaded = true; scan.ScannedFormPDF = URL; try { // update the IsUploaded flag on the scannedForm facScanForm.Update(scan, scan.CreateUserID); } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploadedTo - Update ScanForm failed", ex); } //If the scan is a POD email it if (scan.FormTypeId == eFormTypeId.POD) { //Email the POD to the client Facade.IPOD facPod = new Facade.POD(); //Make the call to send the email async as it will //have to download the attachment MethodCall <string, int> asyncSendClientPod = facPod.SendClientPod; asyncSendClientPod.BeginInvoke(scan.ScannedFormId, r => { try { asyncSendClientPod.EndInvoke(r); } catch (Exception ex) { WebUI.Global.UnhandledException(ex); } }, null); } return(methodStatus); }
public HeartbeatAsyncResult(MakeConnection poll, IClient client, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.Poll = poll; this.Timeout = timeout; this.Tags = new RdlTagCollection(); this.Client = client; if (client != null) { this.SessionId = client.SessionId.ToString(); } MethodCall method = HeartbeatAsyncResult.PollClient; method.BeginInvoke(this.Client, this.Timeout, (ar) => { var tags = method.EndInvoke(ar); var result = ar.AsyncState as HeartbeatAsyncResult; result.Tags.AddRange(tags); result.Complete(ar.CompletedSynchronously); }, this); }