private void Loop2(CalculationDictionary dictionary, string[] groupIDs) { foreach (var groupID in groupIDs) { //Create group Group currentGroup = new Group(_views, groupID); foreach (var document in _views.MainForm.datasetBilling.Documents) { //If (Doc has one-way or not one-way code form Group) Then dictionary[groupID,ED_ENC_NUM] = Green var icdInStandard = currentGroup.DocumentHaveICDInStandardWithoutOneWay(document); if (icdInStandard.Length > 0) { // I would like to check here if dictionary already has an entry for groupID, document.ED_ENC_NUM which is green // If it does then - let's leave the entry from Loop 1 because the reason there is more complete - it also indicates // that DISC has the code. Can we do that? Ok? Looks good - let's try // Looks good // One thing: in the reason, it is important to see DISC: first // we should probably change that in Loop1 - possible? var dictionaryKey = new DictionaryKey() { GroupID = groupID, ED_ENC_NUM = document.ED_ENC_NUM }; //If dictionary have this key if (dictionary.GetDictionary().ContainsKey(dictionaryKey)) { //Check for the color of the entry with this key if (dictionary.GetDictionary()[dictionaryKey].Color != "GREEN") { //Make it green var reason = "EDMD: " + icdInStandard; dictionary.Add(groupID, document.ED_ENC_NUM, "GREEN", reason); } } else { //Add new entry with color GREEN var reason = "EDMD: " + icdInStandard; dictionary.Add(groupID, document.ED_ENC_NUM, "GREEN", reason); } } } } }
public void Add(string groupID, double ed_enc_no, string color, string reason) { var colorReason = new ColorReason() { Color = color, Reason = reason }; var key = new DictionaryKey() { ED_ENC_NUM = ed_enc_no, GroupID = groupID }; if (dictionary.ContainsKey(key)) { dictionary[key] = colorReason; } else { dictionary.Add(key, colorReason); } }
public override bool Equals(object obj) { DictionaryKey other = obj as DictionaryKey; return(other != null && other.ED_ENC_NUM == this.ED_ENC_NUM && other.GroupID == this.GroupID); }