Пример #1
0
        /// <summary>
        /// Create a new Assignment with a study based on an XPS document.
        /// </summary>
        /// <remarks>UC-36</remarks>
        /// <param name="title">Title of the Assignment.</param>
        /// <param name="firstXPSDocumentPath">Path to the first XPS document to add to the Assignment.</param>
        /// <param name="owner">The owner of this Assignment.</param>
        /// <returns>A new Assignment Object.</returns>
        public static ejpAssignment Create(
            string title, string firstXPSDocumentPath, string firstXpsDocumentTitle,
            ejpUser owner, bool isManagedByEJournalServer,
            Guid xpsDocumentId, string tempFilePath)
        {
            try
            {
                //TODO: Improve.
                ejpAssignment a = new ejpAssignment(Helpers.IdManipulation.GetNewGuid(), title,
                                                    isManagedByEJournalServer, owner.Id);
                a.CreateNewStudy(firstXPSDocumentPath, firstXpsDocumentTitle, xpsDocumentId);

                //string tempFilePath = @"c:\Windows\Temp\TempEjpPackage"+DateTime.Now.Ticks.ToString()+".ejp";
                AssignmentOperations.LocalAssignmentFileOperations.SaveTemporaryAssignment(a, tempFilePath);
                a.Dispose();

                ejpAssignment b = AssignmentOperations.LocalAssignmentFileOperations.OpenAssignment(tempFilePath);
                b.tempFilePath    = tempFilePath;
                b.FilePackagePath = "";

                return(b);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// Create a new Assignment with a study based on an XPS document.
        /// </summary>
        /// <remarks>UC-36</remarks>
        /// <param name="title">Title of the Assignment.</param>
        /// <param name="firstXPSDocumentPath">Path to the first XPS document to add to the Assignment.</param>
        /// <param name="owner">The owner of this Assignment.</param>
        /// <returns>A new Assignment Object.</returns>
        public static ejpAssignment Create(
            string title, string firstXPSDocumentPath, string firstXpsDocumentTitle,
            ejpUser owner, bool isManagedByEJournalServer,
            Guid xpsDocumentId, string tempFilePath)
        {
            try
            {
                //SiliconStudio.DebugManagers.DebugReporter.Report(
                //	SiliconStudio.DebugManagers.MessageType.Information,
                //	"EjpLib - ejpAssignment",
                //	"Creating Assignment" +
                //	"\nTitle: " + title +
                //	"\nFirst XPS Document Path: " + firstXPSDocumentPath +
                //	"\nTemp File Path: " + tempFilePath);

                //TODO: Improve.
                ejpAssignment a = new ejpAssignment(Helpers.IdManipulation.GetNewGuid(), title,
                                                    isManagedByEJournalServer, owner.Id);
                a.CreateNewStudy(firstXPSDocumentPath, firstXpsDocumentTitle, xpsDocumentId);

                //string tempFilePath = @"c:\Windows\Temp\TempEjpPackage"+DateTime.Now.Ticks.ToString()+".ejp";
                AssignmentOperations.LocalAssignmentFileOperations.SaveTemporaryAssignment(a, tempFilePath);
                a.Dispose();

                ejpAssignment b = AssignmentOperations.LocalAssignmentFileOperations.OpenAssignment(tempFilePath);
                b.tempFilePath    = tempFilePath;
                b.FilePackagePath = "";

                return(b);
            }
            catch (Exception ex)
            {
                //SiliconStudio.DebugManagers.DebugReporter.Report(
                //	SiliconStudio.DebugManagers.MessageType.Error,
                //	"EjpLib - ejpAssignment",
                //	"Creating Assignment Failed" +
                //	"\nTitle: " + title +
                //	"\nFirst XPS Document Path: " + firstXPSDocumentPath +
                //	"\nTemp File Path: " + tempFilePath +
                //	"\nError :" + ex.Message);
                System.Diagnostics.Debug.WriteLine(ex.Message);

                return(null);
            }
        }