/// <summary> /// Download a single assignment from the eJournalServer. /// </summary> public static string DownloadAssignment( ejsSessionToken sessionToken, string path, ejsService.ejsAssignment assignment) { EjsPublicServiceClient _client = null; try { _client = new EjsPublicServiceClient(); _client.Endpoint.Address = new EndpointAddress(ejsBridgeManager.EjsAddress); byte[] data = _client.GetAssignment(sessionToken, assignment); FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write); BinaryWriter br = new BinaryWriter(fs); br.Write(data); br.Flush(); br.Close(); fs.Close(); return(path); } catch (FaultException <ejsFailureReport> ex) { if (ex.Detail._failureCode == 7) { sessionToken._isAuthenticated = false; } throw new ApplicationException(ex.Detail._header + "\n" + ex.Detail._message); } catch (Exception) { sessionToken._isAuthenticated = false; //throw new ApplicationException(Properties.Resources.EX_EjsConnectionFailed); throw; } finally { if (_client != null) { _client.Close(); } } }