Пример #1
0
        public static ejpAssignment CreateEmpty(string title, ejpStudent ownerUser, bool isManagedByEJournalServer,
                                                string tempFilePath)
        {
            try
            {
                //SiliconStudio.DebugManagers.DebugReporter.Report(
                //	SiliconStudio.DebugManagers.MessageType.Information,
                //	"EjpLib - ejpAssignment",
                //	"Creating Empty Assignment" +
                //	"\nTitle: " + title +
                //	"\nTemp File Path: " + tempFilePath);

                //TODO: Improve.
                ejpAssignment a = new ejpAssignment(Helpers.IdManipulation.GetNewGuid(), title,
                                                    isManagedByEJournalServer, ownerUser.Id);

                AssignmentOperations.LocalAssignmentFileOperations.SaveTemporaryAssignment(a, tempFilePath);
                a.Dispose();

                ejpAssignment b = AssignmentOperations.LocalAssignmentFileOperations.ImportAssignment(tempFilePath, true);
                b.tempFilePath    = tempFilePath;
                b.FilePackagePath = "";

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

                return(null);
            }
        }
Пример #2
0
        public static ejpAssignment CreateEmpty(string title, ejpStudent ownerUser, bool isManagedByEJournalServer,
                                                string tempFilePath)
        {
            try
            {
                //TODO: Improve.
                ejpAssignment a = new ejpAssignment(Helpers.IdManipulation.GetNewGuid(), title,
                                                    isManagedByEJournalServer, ownerUser.Id);

                AssignmentOperations.LocalAssignmentFileOperations.SaveTemporaryAssignment(a, tempFilePath);
                a.Dispose();

                ejpAssignment b = AssignmentOperations.LocalAssignmentFileOperations.ImportAssignment(tempFilePath, true);
                b.tempFilePath    = tempFilePath;
                b.FilePackagePath = "";

                return(b);
            }
            catch (Exception)
            {
                return(null);
            }
        }