private void Loop1(CalculationDictionary dictionary, string[] groupIDs) { foreach (var groupID in groupIDs) { Group currentGroup = new Group(_views, groupID); //Get all rows from billing table foreach (RegScoreCalc.Data.BillingDataSet.BillingRow billingRow in _views.MainForm.datasetBilling.Billing) { //Check if the billingROw have the ICD code if (billingRow.ICD9.Length > 0) { //Check if the ICD9Code of line is in current group - HERE WE do not need to check One-way if (currentGroup.IsICD9InGroupSingleWithoutOneWay(billingRow.ICD9)) { //Remember the billing code that is in the standard list var billingICD9Code = billingRow.ICD9; //Get document with ED_ENC_NUM var document = _views.MainForm.datasetBilling.Documents.FindByPrimaryKey(billingRow.ED_ENC_NUM); //If (Document with ED_ENC_NUM of line has single-code (one-way or not) in Group) //Then dictionary[groupID,ED_ENC_NUM] = Green var documentICDInStandard = currentGroup.DocumentHaveICDInStandardGroup(document); var documentICDInCombinations = currentGroup.DocumentHaveICDInCombinationGroup(document); if (documentICDInStandard.Length > 0) { //Make it green var reason = "DISC: " + billingICD9Code + " EDMD: " + documentICDInStandard; dictionary.Add(groupID, document.ED_ENC_NUM, "GREEN", reason); } else if (documentICDInCombinations.Length > 0)// If (Document with ED_ENC_NUM of line has combination in Group) Then dictionary[groupID,ED_ENC_NUM] = Green { //Make it green (excellent!!! - We can see already how faster it is to fine tune the filter calculation after our refactoring!!!) // Can you open notepad so we could chat? var reason = "DISC: " + billingICD9Code + " EDMD: " + documentICDInCombinations; dictionary.Add(groupID, document.ED_ENC_NUM, "GREEN", reason); } else { //Make it red var reason = "DISC: " + billingICD9Code; dictionary.Add(groupID, document.ED_ENC_NUM, "RED", reason); } } } } } }
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 CalculationDictionary GetItemsForCurrentGroup(string groupID, CalculationDictionary dictionary) { var returnDictionary = new CalculationDictionary(); var dicionaryObject = dictionary.GetDictionary(); foreach (KeyValuePair <DictionaryKey, ColorReason> entry in dicionaryObject) { if (entry.Key.GroupID == groupID) { returnDictionary.Add(entry.Key.GroupID, entry.Key.ED_ENC_NUM, entry.Value.Color, entry.Value.Reason); } } return(returnDictionary); }