예제 #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>
        /// Get document storage data associated with the current file transfer
        /// </summary>
        /// <param name="logonId"></param>
        /// <returns></returns>
        public static DocumentStorageData GetDocumentStorageData(Guid logonId)
        {
            Object Data = GetFileTransferData(logonId).AssociatedData;

            if (Data == null)
            {
                Data = new DocumentStorageData();
            }

            return((DocumentStorageData)Data);
        }
예제 #3
0
        public ReturnValue DocumentUploadComplete(Guid logonId, Guid TransferId)
        {
            ReturnValue ReturnValue = new ReturnValue();

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

                try
                {
                    FileUploadInfo FileUploadInfo = FileTransfer.UploadComplete(logonId, TransferId);

                    DocumentStorageData DocumentStorageData = Host.GetDocumentStorageData(logonId);

                    // DocumentStorageData holds all the information needed to know how to store the document

                    // TODO this is just test code.  You should replace this with code to store the file
                    // in the ILB document management system.
                    // FileUploadInfo.TempFileName holds the full path to the actual file that has been uploaded
                    // FileUploadInfo.FileName holds the original file name (excluding path) of the file that has been uploaded
                    // The file will need moving to the correct location in the document management system.
                    File.Move(FileUploadInfo.TempFileName, @"c:\Work\Uploaded\" + FileUploadInfo.FileName);

                    FileTransfer.UploadReset(logonId, TransferId);
                }
                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);
        }