public void StoreResult() { if (checkSuccessful) { try { // return results of comparision string checkResults = compareResults(); //Load checkResults into XMLDom string element = string.Empty; XmlDocument doc = new XmlDocument(); doc.LoadXml(checkResults); //load the string as xml XPathNavigator nav = ((IXPathNavigable)doc).CreateNavigator(); XPathNodeIterator xpni; xpni = nav.Select("/GradingResults/ResultCode"); xpni.MoveNext(); element = xpni.Current.Value.ToString(); studentAssignment.CheckResultCode = element; xpni = nav.Select("/GradingResults/Details/ActualResults"); xpni.MoveNext(); element = xpni.Current.Value.ToString(); if (element != "<![CDATA[]]>") { studentAssignment.CheckDetails = element; } else { studentAssignment.CheckDetails = String.Empty; } if (checkSuccessful) { studentAssignment.AutoGradeStatus = Constants.AUTOGRADE_SUCCESSFUL_STATUS; studentAssignment.CheckResultCode = Constants.GRADE_SUCCESSFUL_RESULT_CODE.ToString(); } else { studentAssignment.AutoGradeStatus = Constants.AUTOGRADE_FAILURE_STATUS; studentAssignment.CheckResultCode = Constants.GRADE_FAILED_RESULT_CODE.ToString(); } studentAssignment.Update(); } catch (Exception ex) { SharedSupport.HandleError(ex); } } else { studentAssignment.AutoGradeStatus = Constants.AUTOGRADE_FAILURE_STATUS; studentAssignment.CheckDetails = errorString; studentAssignment.LastUpdatedDate = System.DateTime.Now; studentAssignment.CheckResultCode = Constants.GRADE_FAILED_RESULT_CODE.ToString(); studentAssignment.Update(); } }
public void StoreResult() { // copy the resulting exe file(s) to the root of the working directory for use in checking if build successful if (buildSuccessful) { string binDirectory = SharedSupport.AddBackSlashToDirectory(workingDirectory) + buildPath; ServerAction.CopyDirectories(binDirectory, sourceLocation, true, false); //store the failure studentAssignment.BuildDetails = buildResults; studentAssignment.LastUpdatedDate = System.DateTime.Now; studentAssignment.AutoCompileStatus = Constants.AUTOCOMPILE_SUCCESSFUL_STATUS; studentAssignment.BuildResultCode = Constants.AUTOCOMPILE_RETURN_CODE_SUCCESS.ToString(); studentAssignment.Update(); } else { //store the failure studentAssignment.BuildDetails = buildResults; studentAssignment.LastUpdatedDate = System.DateTime.Now; studentAssignment.AutoCompileStatus = Constants.AUTOCOMPILE_FAILURE_STATUS; studentAssignment.BuildResultCode = Constants.AUTOCOMPILE_RETURN_CODE_FAILURE.ToString(); studentAssignment.Update(); } }
private void deleteUserAssignmentDetails(int userAssignmentId, int detailType) { try { StudentAssignmentM stuAssign = StudentAssignmentM.Load(userAssignmentId); stuAssign.BuildDetails = ""; stuAssign.BuildResultCode = ""; stuAssign.AutoCompileStatus = Constants.AUTOCOMPILE_PENDING_STATUS; stuAssign.CheckDetails = ""; stuAssign.CheckResultCode = ""; stuAssign.Update(); } catch (Exception ex) { SharedSupport.HandleError(ex); } }