コード例 #1
0
        public StartDocumentUploadReturnValue StartNewDocumentUploadForMatter(Guid logonId, Guid projectId,
                                                                              string FileName, DateTime ModifiedDate, long Size, byte[] Hash
                                                                              /* TODO Insert parameters here that ILB requires to store the document */)
        {
            StartDocumentUploadReturnValue ReturnValue = new StartDocumentUploadReturnValue();

            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    switch (ApplicationSettings.Instance.UserType)
                    {
                    case DataConstants.UserType.Staff:
                        // Can do everything
                        break;

                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        if (!SrvMatterCommon.WebAllowedToAccessMatter(projectId))
                        {
                            throw new Exception("Access denied");
                        }
                        break;

                    default:
                        throw new Exception("Unknown UserType");
                    }

                    DocumentStorageData DocumentStorageData = Host.GetDocumentStorageData(logonId);

                    DocumentStorageData.ExitingDocument = false;
                    DocumentStorageData.ProjectId       = projectId;
                    // TODO set other properties on DocumentStorageData so we know everything needed to store the document
                    // when it has finished uploading
                    //DocumentStorageData.othervalue = .....

                    ReturnValue.MaxChunkSize = Host.FileTransferChunkSize;

                    ReturnValue.TransferId = FileTransfer.StartFileUpload(logonId, FileName, ModifiedDate, Size, Hash);
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (Exception ex)
            {
                ReturnValue.Success = false;
                ReturnValue.Message = ex.Message;
            }

            return(ReturnValue);
        }
コード例 #2
0
        /// <summary>
        /// Start a document download
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="DocumentId"></param>
        /// <returns></returns>
        public StartDocumentDownloadReturnValue StartDocumentDownloadForMatter(Guid logonId, Guid projectId,
                                                                               int DocumentId /* TODO Replace this or add extra parameters needed to identify the document required */)
        {
            StartDocumentDownloadReturnValue ReturnValue = new StartDocumentDownloadReturnValue();

            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    switch (ApplicationSettings.Instance.UserType)
                    {
                    case DataConstants.UserType.Staff:
                        // Can do everything
                        break;

                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        if (!SrvMatterCommon.WebAllowedToAccessMatter(projectId))
                        {
                            throw new Exception("Access denied");
                        }
                        break;

                    default:
                        throw new Exception("Unknown UserType");
                    }

                    // TODO this is just a test file name, you must put the ILB document extraction code here
                    // and set SourceFileName appropriately
                    string SourceFileName = @"c:\work\SetupWebLinkDemo.exe";

                    FileDownloadInfo FileInfoData = FileTransfer.StartFileDownload(logonId, SourceFileName, false);

                    ReturnValue.TransferId   = FileInfoData.TransferId;
                    ReturnValue.FileName     = FileInfoData.FileName;
                    ReturnValue.Size         = FileInfoData.Size;
                    ReturnValue.ModifiedDate = FileInfoData.ModifiedDate;
                    ReturnValue.Hash         = FileInfoData.Hash;
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (Exception ex)
            {
                ReturnValue.Success = false;
                ReturnValue.Message = ex.Message;
            }

            return(ReturnValue);
        }