}// End updateQANameScoreDictionaryWithNewEntry /// <summary> /// This method receives the int key to a line in the QANameScoreDictionary /// it calls that line and replaces the 3rd item with the transmitted /// "examResults"></param> /// It is called by: AnswerQuestionsForm.UpdateExamData() Method /// </summary> /// <param name="qaKeyInt"></param> /// <param name="examResults"></param> public static void updateQAFileNameScoresExamResults(int qaKeyInt, string examResults) { string desiredQALine = QANameScoreDictionary[qaKeyInt]; string correctedLine = StringHelperClass.replaceNthItemInDelimitedString(desiredQALine, '^', 3, examResults); QANameScoreDictionary[qaKeyInt] = correctedLine; }// End updateQAQNameScoreDictionaryWithExamResults
/// <summary> /// This method is called when the SubjectTreeForm renames a qaNode /// </summary> /// <param name="nodeName"></param> /// <param name="newNodeText"></param> public static void reTextQANode(string nodeName, string newNodeText) { // Create a temporary holding dictionary Dictionary <string, string> tempCumulativeResultsDictionary = cumulativeResultsDictionary; string delimitedResults = cumulativeResultsDictionary[nodeName]; string newDelimitedResults = StringHelperClass.replaceNthItemInDelimitedString(delimitedResults, '^', 1, newNodeText); tempCumulativeResultsDictionary[nodeName] = newDelimitedResults; cumulativeResultsDictionary = new Dictionary <string, string>(); cumulativeResultsDictionary = tempCumulativeResultsDictionary; }// End reTextQANode
}// End updateQAQNameScoreDictionaryWithExamResults public static void reTextNameScores(string nodeName, string oldNodeText, string newNodeText) { // Create dummy dictionary to hold changed values Dictionary <Int32, string> tempQANAmeScoredictionary = new Dictionary <int, string>(); // Create a string[] valueArray to hold the component of the value string[] valueArray = new string[4]; // Cycle thru QANameScoreDictionary foreach (KeyValuePair <Int32, string> kvp in QANameScoreDictionary) { int Key = kvp.Key; string value = kvp.Value; valueArray = value.Split('^'); string qaFileText = valueArray[0]; string parentsString = valueArray[1]; string qaFileName = valueArray[2]; string testResults = valueArray[3]; // Determine if the nodeName is at the beginning of the qaFileName if (qaFileName.IndexOf(nodeName) == 0) { // First convert Parents into a string [] string[] parentsArray = parentsString.Split('<'); // Next get the number of parents int numParents = parentsArray.Length; // Next convert the nodeName into a string[] string[] nodeItems = nodeName.Split('.'); // Next get the number of nodeItems int numNodeItems = nodeItems.Length; // Get the item number of parentsArray to replace from int itemToReplace = numParents - numNodeItems; // Repalce the itemToReplace - th item in parents String with newNodeText if (itemToReplace != -1) { parentsString = StringHelperClass.replaceNthItemInDelimitedString(parentsString, '<', itemToReplace, newNodeText); // Reassemble the value with the updated parentsString value = qaFileText + '^' + parentsString + '^' + qaFileName + '^' + testResults; } else { // This is a QA file value = newNodeText + '^' + parentsString + '^' + qaFileName + '^' + testResults; } // Insert this new value in the QANameScoreDictionary }// End if (qaFileText.IndexOf(nodeName) == 0 // Insert this new value in the QANameScoreDictionary tempQANAmeScoredictionary[Key] = value; }// End foreach (KeyValuePair<Int32, string> kvp // Delete the old version of QANameScoreDictionary QANameScoreDictionary = new Dictionary <int, string>(); QANameScoreDictionary = tempQANAmeScoredictionary; }// End reTextNameScores