Example #1
0
        /// <summary>
        /// Get a list of all the users assignments.
        /// </summary>
        internal static void GetAllAssignments(SqlConnection dBconnection, bool IncludeNotAvailable,
                                               ejsSessionToken sessionToken, ref List <ejsAssignment> result)
        {
            result.Clear();
            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            try
            {
                command.Connection  = dBconnection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "GetAllAssignmentsForUser";

                command.Parameters.Add("UserId", SqlDbType.UniqueIdentifier).Value = sessionToken.UserId;
                command.Parameters.Add("IncludeNotAvailable", SqlDbType.Bit).Value = IncludeNotAvailable;

                reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ejsAssignment assign = new ejsAssignment();
                        assign.EJSDatabaseId = reader.GetInt32(0);
                        assign.Title         = reader.GetString(1);
                        assign.Description   = reader.GetString(2);
                        assign.StudyCount    = reader.GetInt32(3);
                        assign.IsAvailable   = reader.GetBoolean(9);                       //Added 080829
                        //assign.OwnerUserId = sessionToken.UserId; //Removed 080318, replaced with the next line.
                        assign.OwnerUserId           = new Guid(reader.GetGuid(14).ToString());
                        assign.OriginalOwnerDbId     = reader.GetInt32(4);
                        assign.AssignmentContentType = reader.GetInt32(5);
                        assign.CreationDate          = reader.GetDateTime(6);
                        assign.LastModifiedDate      = reader.GetDateTime(7);
                        assign.Version      = reader.GetInt32(8);
                        assign.DataSize     = reader.GetInt64(10);
                        assign.CommentCount = reader.GetInt32(11);
                        assign.IsManagedByEJournalServer = true;
                        assign.OwnerName            = reader.GetString(13);
                        assign.CourseId             = reader.GetInt32(12);
                        assign.ExternalAssignmentId = new Guid(reader.GetGuid(15).ToString());                       //Added 080318
                        assign.ParentAssignmentId   = new Guid(reader.GetGuid(16).ToString());                       //Added 080318
                        result.Add(assign);
                    }
                }
            }
            finally
            {
                command.Dispose();
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Gets all the studies asc. with the given assignment.
        /// </summary>
        internal static void GetStudiesForAssignment(SqlConnection dBconnection, ejsSessionToken sessionToken,
                                                     ejsAssignment assignment, ref List <ejsStudyMetaData> result)
        {
            result.Clear();
            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            try
            {
                command.Connection  = dBconnection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "GetStudiesForAssignment";

                command.Parameters.Add("UserId", SqlDbType.Int).Value       = assignment.OriginalOwnerDbId;
                command.Parameters.Add("AssignmentId", SqlDbType.Int).Value = assignment.EJSDatabaseId;

                reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ejsStudyMetaData study = new ejsStudyMetaData();
                        study.Title              = reader.GetString(1);
                        study.Description        = reader.GetString(2);
                        study.ParentAssignmentId = reader.GetInt32(4);
                        study.CreationDate       = reader.GetDateTime(5);
                        study.LastModifiedDate   = reader.GetDateTime(6);
                        study.IsAvailable        = reader.GetBoolean(7);
                        study.CommentCount       = reader.GetInt32(8);
                        result.Add(study);
                    }
                }
            }
            finally
            {
                command.Dispose();
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Restores the given assignment in the EJS database.
        /// </summary>
        internal static int RestoreAssignment(SqlConnection dBconnection,
                                              ejsSessionToken Token, ejsAssignment Assignment)
        {
            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            try
            {
                command.Connection  = dBconnection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "RestoreAssignment";

                command.Parameters.Add("UserId", SqlDbType.UniqueIdentifier).Value = Token.UserId;
                command.Parameters.Add("AssignmentOwnerId", SqlDbType.Int).Value   = Assignment.OriginalOwnerDbId;
                command.Parameters.Add("AssignmentId", SqlDbType.Int).Value        = Assignment.EJSDatabaseId;

                SqlParameter returnValue = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
                returnValue.Direction = ParameterDirection.ReturnValue;
                command.Parameters.Add(returnValue);

                command.ExecuteNonQuery();
                int resultCode = (int)returnValue.Value;
                return(resultCode);
            }
            finally
            {
                command.Dispose();
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Example #4
0
        /// <summary>
        /// Gets a single assignment from the database.
        /// </summary>
        internal static byte[] GetAssignment(SqlConnection dBconnection,
                                             ejsAssignment assignment, ejsSessionToken Token, int dataBaseId)
        {
            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            try
            {
                byte[] result = new byte[assignment.DataSize];

                int          bufferSize = (int)assignment.DataSize;
                byte[]       outbyte    = new byte[bufferSize];
                MemoryStream ms         = new MemoryStream(bufferSize);
                BinaryWriter bw         = new BinaryWriter(ms);
                long         startIndex = 0;
                long         retval;

                command.Connection  = dBconnection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "GetAssignment";

                command.Parameters.Add("UserId", System.Data.SqlDbType.UniqueIdentifier).Value = Token.UserId;
                command.Parameters.Add("AssignmentOwnerId", System.Data.SqlDbType.Int).Value   = assignment.OriginalOwnerDbId;
                command.Parameters.Add("AssignmentId", System.Data.SqlDbType.Int).Value        = dataBaseId;

                reader = command.ExecuteReader(CommandBehavior.SequentialAccess);

                while (reader.Read())
                {
                    retval = reader.GetBytes(0, startIndex, outbyte, 0, bufferSize);

                    while (retval == bufferSize)
                    {
                        bw.Write(outbyte);
                        bw.Flush();

                        startIndex += bufferSize;
                        retval      = reader.GetBytes(0, startIndex, outbyte, 0, bufferSize);
                    }

                    bw.Write(outbyte, 0, (int)retval);
                    bw.Flush();
                    bw.Close();

                    ms.Close();
                    ms.Dispose();
                }

                result = ms.GetBuffer();
                return(result);
            }
            finally
            {
                command.Dispose();
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Example #5
0
        /// <summary>
        /// Pushes the given assignment into the EJS database.
        /// </summary>
        internal static int SaveAndUploadAssignment(SqlConnection dBconnection,
                                                    ejsSessionToken sessionToken, ejsAssignment assignment, byte[] Data)
        {
            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            try
            {
                command.Connection  = dBconnection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "UploadAndSaveAssignment";

                if (assignment.Title.Length > 49)
                {
                    assignment.Title = assignment.Title.Substring(0, 49);
                }
                if (assignment.Title == "")
                {
                    assignment.Title = "No Title";
                }
                if (assignment.Description == "")
                {
                    assignment.Description = "No Description";
                }


                command.Parameters.Add("UserId", SqlDbType.UniqueIdentifier).Value               = sessionToken.UserId;
                command.Parameters.Add("AssignmentTitle", SqlDbType.NVarChar, 50).Value          = assignment.Title;
                command.Parameters.Add("Description", System.Data.SqlDbType.NVarChar, 500).Value = assignment.Description;
                command.Parameters.Add("StudyCount", SqlDbType.Int).Value = assignment.StudyCount;
                command.Parameters.Add("Status", SqlDbType.Int).Value     = assignment.AssignmentContentType;
                command.Parameters.Add("CreationDate", System.Data.SqlDbType.DateTime).Value     = assignment.CreationDate;
                command.Parameters.Add("LastModifiedDate", System.Data.SqlDbType.DateTime).Value = assignment.LastModifiedDate;
                command.Parameters.Add("Version", SqlDbType.Int).Value = assignment.Version;
                command.Parameters.Add("IsAvailable", System.Data.SqlDbType.Bit).Value = 1;
                command.Parameters.Add("DataSize", System.Data.SqlDbType.BigInt).Value = Data.Length;
                command.Parameters.Add("Data", System.Data.SqlDbType.VarBinary, (int)Data.Length).Value = Data;
                command.Parameters.Add("CommentCount", SqlDbType.Int).Value = assignment.CommentCount;
                command.Parameters.Add("CourseId", SqlDbType.Int).Value     = assignment.CourseId;
                command.Parameters.Add("ExternalAssignmentId", SqlDbType.UniqueIdentifier).Value = assignment.ExternalAssignmentId;
                command.Parameters.Add("ParentAssignmentId", SqlDbType.UniqueIdentifier).Value   = assignment.ParentAssignmentId;

                SqlParameter returnValue = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
                returnValue.Direction = ParameterDirection.ReturnValue;
                command.Parameters.Add(returnValue);

                command.ExecuteNonQuery();
                int resultCode = (int)returnValue.Value;
                return(resultCode);
            }
            finally
            {
                command.Dispose();
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Example #6
0
        /// <summary>
        /// Gets the root assignment (of a CA tree) with the comments of all
        /// the child CAs merged into one file.
        /// This is currently a costly operation due to the fact that the
        /// database was not designed to accomodate this kind of operation.
        /// </summary>
        internal static byte[] GetMergedCommentedAssignment(SqlConnection dBconnection,
                                                            ejsAssignment assignment, ejsSessionToken Token, int dataBaseId, ejsAssignment[] childrenToBeMerged)
        {
            //Add the parentAssignment to the list of assignments
            //to download. Will seperate it out later.
            List <ejsAssignment> assignmentsToDownload =
                new List <ejsAssignment>(childrenToBeMerged);

            assignmentsToDownload.Add(assignment);

            string UserName =
                sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName;

            SqlCommand    command = new SqlCommand();
            SqlDataReader reader  = null;

            command.CommandTimeout = 60;

            List <string> assignmentsLocalPaths = new List <string>();

            foreach (ejsAssignment child in assignmentsToDownload)
            {
                try
                {
                    ejsLogHelper.LogMessage("User '" +
                                            UserName +
                                            "': MCA (DL): " + child.Title + ".", false);

                    byte[] assignmentBytes = new byte[child.DataSize];

                    int          bufferSize = (int)child.DataSize;
                    byte[]       outbyte    = new byte[bufferSize];
                    MemoryStream ms         = new MemoryStream(bufferSize);
                    BinaryWriter bw         = new BinaryWriter(ms);
                    long         startIndex = 0;
                    long         retval;

                    command.Parameters.Clear();

                    command.Connection  = dBconnection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "GetAssignment";

                    command.Parameters.Add("UserId", System.Data.SqlDbType.UniqueIdentifier).Value = Token.UserId;
                    command.Parameters.Add("AssignmentOwnerId", System.Data.SqlDbType.Int).Value   = child.OriginalOwnerDbId;
                    command.Parameters.Add("AssignmentId", System.Data.SqlDbType.Int).Value        = child.EJSDatabaseId;

                    reader = command.ExecuteReader(CommandBehavior.SequentialAccess);

                    while (reader.Read())
                    {
                        retval = reader.GetBytes(0, startIndex, outbyte, 0, bufferSize);

                        while (retval == bufferSize)
                        {
                            bw.Write(outbyte);
                            bw.Flush();

                            startIndex += bufferSize;
                            retval      = reader.GetBytes(0, startIndex, outbyte, 0, bufferSize);
                        }

                        bw.Write(outbyte, 0, (int)retval);
                        bw.Flush();
                        bw.Close();
                    }

                    assignmentBytes = ms.GetBuffer();

                    ms.Close();
                    ms.Dispose();

                    command.Dispose();
                    if (reader != null)
                    {
                        reader.Close();
                        reader.Dispose();
                    }

                    //Write the downloaded assignment to a temporary local copy
                    //string path = Program.TemporaryStorageLocation + Guid.NewGuid() + ".tejp";
                    //using (FileStream fs = new FileStream(
                    //	path,
                    //	FileMode.Create,
                    //	FileAccess.Write))
                    string newName = Guid.NewGuid() + ".tejp";
                    if (sessionManager._isoStore == null)
                    {
                        // user store doesn't always work especially if it runs under ASP.NET context.
                        // Should use GetMachineStoreForDomain() instead.
                        //sessionManager._isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.User, null, null);
                        sessionManager._isoStore = IsolatedStorageFile.GetMachineStoreForDomain();
                    }
                    using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream(newName, FileMode.Create, FileAccess.ReadWrite, sessionManager._isoStore))
                    {
                        using (BinaryWriter br = new BinaryWriter(fs))
                        {
                            br.Write(assignmentBytes);
                            br.Flush();
                            br.Close();
                        }
                        fs.Close();
                    }
                    assignmentsLocalPaths.Add(newName);                    //path);
                }
                catch (ArgumentException ae)
                {
                    System.Diagnostics.Debug.WriteLine(ae.Message);
                }
                catch (IsolatedStorageException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                finally
                {
                    command.Dispose();
                    if (reader != null)
                    {
                        reader.Close();
                        reader.Dispose();
                    }
                }
            }

            byte[] result = LocalAssignmentOperations.MergeCommentsInAssignments(
                Token, assignmentsLocalPaths, assignment);

            sessionManager.ClearTempFiles();

            return(result);
        }
Example #7
0
        /// <summary>
        /// Merges the comments of a set of assignments.
        /// Note that the list of assignments to merge also
        /// must contain the parent assignment to which all
        /// other assignments will be added.
        /// </summary>
        internal static byte[] MergeCommentsInAssignments(
            ejsSessionToken Token,
            List <string> pathsToAssignmentsToMerge,
            ejsAssignment parentAssignment)
        {
            ejsLogHelper.LogMessage("User '" +
                                    sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                    "': MCA (Merge).", true);

            //	instantiate IS helper stuff,
            AssignmentOperationWithStorage store = new AssignmentOperationWithStorage(sessionManager._isoStore);

            byte[] result = null;

            string pathToParentAssignment = "";

            List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpAssignment> assignments =
                new List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpAssignment>();

            List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpStudy> studies =
                new List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpStudy>();

            foreach (string path in pathsToAssignmentsToMerge)
            {
                try
                {
                    ejsLogHelper.LogMessage("User '" +
                                            sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                            "': MCA (Merge).\n" +
                                            "Mergeing " + path + ".\n", false);

                    SiliconStudio.Meet.EjpLib.BaseClasses.ejpAssignment a =
                        //SiliconStudio.Meet.EjpLib.AssignmentOperations.LocalAssignmentFileOperations.OpenAssignment(
                        //path);
                        store.OpenAssignment(path);

                    ejsLogHelper.LogMessage("User '" +
                                            sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                            "': MCA (Merge).\n" +
                                            "Assignment " + a.MetaData.Id + " was recreated.\n", false);

                    if (a.MetaData.Id == parentAssignment.ExternalAssignmentId)
                    {
                        pathToParentAssignment = path;
                        a.Close(false);
                    }
                    else
                    {
                        studies.AddRange(a.Studies);
                    }
                    a.Close(false);
                }
                catch (Exception ex)
                {
                    ejsLogHelper.LogMessage("User '" +
                                            sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                            "': MCA (Merge).\n" +
                                            "Failed to Merge " + path + ".\n" +
                                            ex.Message, false);
                }
            }

            if (pathToParentAssignment == "")
            {
                throw new ApplicationException("Could not find Parent Assignment in the list of Assignments to Merge");
            }

            SiliconStudio.Meet.EjpLib.BaseClasses.ejpAssignment parent =
                //SiliconStudio.Meet.EjpLib.AssignmentOperations.LocalAssignmentFileOperations.OpenAssignment(
                //pathToParentAssignment);
                store.OpenAssignment(pathToParentAssignment);

            foreach (
                SiliconStudio.Meet.EjpLib.BaseClasses.ejpStudy childStudy
                in studies
                )
            {
                try
                {
                    foreach (
                        SiliconStudio.Meet.EjpLib.BaseClasses.ejpStudy parentStudy
                        in parent.Studies
                        )
                    {
                        if (childStudy.MetaData.Id == parentStudy.MetaData.Id)
                        {
                            for (int i = 0; i < childStudy.KnowledgeMaps.Count; i++)
                            {
                                if (childStudy.KnowledgeMaps[i].Comments != null &&
                                    parentStudy.KnowledgeMaps[i].Comments != null)
                                {
                                    //Added 0901123
                                    bool belongsToParentCommentBox = false;
                                    foreach (var Ccomment in childStudy.KnowledgeMaps[i].Comments)
                                    {
                                        //Console.WriteLine(Ccomment.AuthorName);
                                        foreach (var Pcomment in parentStudy.KnowledgeMaps[i].Comments)
                                        {
                                            Ccomment.AuthorId   = Token.UserId;
                                            Ccomment.AuthorName = Token.LastName + " " + Token.FirstName;
                                            Pcomment.AuthorId   = Token.UserId;
                                            Pcomment.AuthorName = Token.LastName + " " + Token.FirstName;

                                            if (Ccomment.CommentId == Pcomment.CommentId)
                                            {
                                                foreach (var Cmess in Ccomment.Messages)
                                                {
                                                    bool add = true;
                                                    foreach (var Pmess in Pcomment.Messages)
                                                    {
                                                        if (Pmess.Message == Cmess.Message &&
                                                            Pmess.AuthorId == Cmess.AuthorId)
                                                        {
                                                            add = false;
                                                        }
                                                    }
                                                    if (add)
                                                    {
                                                        Pcomment.Messages.Add(Cmess);
                                                    }
                                                }
                                                //Pcomment.Messages.AddRange(Ccomment.Messages.ToArray());
                                                belongsToParentCommentBox = true;
                                            }
                                        }
                                    }
                                    if (!belongsToParentCommentBox)
                                    {
                                        parentStudy.KnowledgeMaps[i].Comments.AddRange(childStudy.KnowledgeMaps[i].Comments);
                                    }
                                }
                            }

                            for (int j = 0; j < childStudy.Reports.Count; j++)
                            {
                                if (childStudy.Reports[j].Comments != null &&
                                    parentStudy.Reports[j].Comments != null)
                                {
                                    //Added 0901123
                                    bool belongsToParentCommentBox = false;
                                    foreach (var Ccomment in childStudy.Reports[j].Comments)
                                    {
                                        foreach (var Pcomment in parentStudy.Reports[j].Comments)
                                        {
                                            Ccomment.AuthorId   = Token.UserId;
                                            Ccomment.AuthorName = Token.LastName + " " + Token.FirstName;
                                            Pcomment.AuthorId   = Token.UserId;
                                            Pcomment.AuthorName = Token.LastName + " " + Token.FirstName;

                                            if (Ccomment.CommentId == Pcomment.CommentId)
                                            {
                                                foreach (var Cmess in Ccomment.Messages)
                                                {
                                                    bool add = true;
                                                    foreach (var Pmess in Pcomment.Messages)
                                                    {
                                                        if (Pmess.Message == Cmess.Message &&
                                                            Pmess.AuthorId == Cmess.AuthorId)
                                                        {
                                                            add = false;
                                                        }
                                                    }
                                                    if (add)
                                                    {
                                                        Pcomment.Messages.Add(Cmess);
                                                    }
                                                }
                                                //Pcomment.Messages.AddRange(Ccomment.Messages.ToArray());
                                                belongsToParentCommentBox = true;
                                            }
                                        }
                                    }
                                    if (!belongsToParentCommentBox)
                                    {
                                        parentStudy.Reports[j].Comments.AddRange(childStudy.Reports[j].Comments);
                                    }
                                }
                            }

                            for (int k = 0; k < childStudy.ReportsNV.Count; k++)
                            {
                                if (childStudy.ReportsNV[k].Comments != null &&
                                    parentStudy.ReportsNV[k].Comments != null)
                                {
                                    //Added 0901123
                                    bool belongsToParentCommentBox = false;
                                    foreach (var Ccomment in childStudy.ReportsNV[k].Comments)
                                    {
                                        foreach (var Pcomment in parentStudy.ReportsNV[k].Comments)
                                        {
                                            Ccomment.AuthorId   = Token.UserId;
                                            Ccomment.AuthorName = Token.LastName + " " + Token.FirstName;
                                            Pcomment.AuthorId   = Token.UserId;
                                            Pcomment.AuthorName = Token.LastName + " " + Token.FirstName;

                                            if (Ccomment.CommentId == Pcomment.CommentId)
                                            {
                                                foreach (var Cmess in Ccomment.Messages)
                                                {
                                                    bool add = true;
                                                    foreach (var Pmess in Pcomment.Messages)
                                                    {
                                                        if (Pmess.Message == Cmess.Message &&
                                                            Pmess.AuthorId == Cmess.AuthorId)
                                                        {
                                                            add = false;
                                                        }
                                                    }
                                                    if (add)
                                                    {
                                                        Pcomment.Messages.Add(Cmess);
                                                    }
                                                }
                                                //Pcomment.Messages.AddRange(Ccomment.Messages.ToArray());
                                                belongsToParentCommentBox = true;
                                            }
                                        }
                                    }

                                    if (!belongsToParentCommentBox)
                                    {
                                        parentStudy.ReportsNV[k].Comments.AddRange(childStudy.ReportsNV[k].Comments);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ejsLogHelper.LogMessage("User '" +
                                            sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                            "': MCA (Merge).\n" +
                                            "Failed to Copy comments in " + childStudy.MetaData.Title + ".\n" +
                                            ex.Message, false);
                }
            }

            //090109
            try
            {
                // [shiniwa] We need to save this into IsolatedStorageOnce, and close the package explicitly.
                store.SaveAssignment(parent, AssignmentSaveMode.Save);
                //parent.Close(true);
                parent.Close(false);
            }
            catch (Exception ex)
            {
                ejsLogHelper.LogMessage("User '" +
                                        sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                        "': MCA (Merge).\n" +
                                        "Failed to close the Parent Assignment. Path was: " + pathToParentAssignment + ". " +
                                        ex.Message, false);
            }

            try
            {
                //read the bytes of the new file and return them to the caller.
                //using (FileStream fs = new FileStream(pathToParentAssignment, FileMode.Open))
                using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream(pathToParentAssignment, FileMode.Open, FileAccess.Read, sessionManager._isoStore))
                {
                    using (BinaryReader br = new BinaryReader(fs))
                    {
                        long fileSize = fs.Length;
                        result = br.ReadBytes((int)fileSize);
                    }
                }
            }
            catch (Exception ex)
            {
                ejsLogHelper.LogMessage("User '" +
                                        sessionManager.TokenPool.GetUserDataByTokenId(Token.Id).UserName +
                                        "': MCA (Merge).\n" +
                                        "Failed to read the bytes of the newly created Merged Assignment. Path was: " + pathToParentAssignment + ". " +
                                        ex.Message, false);
            }
            if (result != null)
            {
                return(result);
            }
            else
            {
                throw new ApplicationException("Failed to merge the provided Assignmets.");
            }
        }