private void addNonSimStuff(EM_System s, string cn) { EM_IncomeList il = new EM_IncomeList(); il.name = "ils_" + cn + "data"; s.incomelists.Add(il.name, il); il.description = "Non-simulated taxes"; List <EM_ILComponent> comp = new List <EM_ILComponent>(); foreach (EM_ILComponent c in s.incomelists["ils_" + cn].components) { // if (s.incomelists["ils_" + cn + "sim"].components.FindIndex(cm => cm.name == c.name) < 0) if (!c.name.EndsWith(DefGeneral.POSTFIX_SIMULATED)) { comp.Add(c); } } foreach (EM_ILComponent com in comp) { if (com.addit) { il.components.Add(com); } } foreach (EM_ILComponent com in comp) { if (!com.addit) { il.components.Add(com); } } il.shortComponentList = " " + String.Join(" ", getListComponents(s, il, true)); il.longComponentList = " " + String.Join(" ", getListComponents(s, il, false)); if (il.shortComponentList == " ") { il.shortComponentList = " - "; } else if (il.shortComponentList.Substring(0, 2) == " +") { il.shortComponentList = il.shortComponentList.Substring(2); } if (il.longComponentList == " ") { il.longComponentList = " - "; } else if (il.longComponentList.Substring(0, 2) == " +") { il.longComponentList = il.longComponentList.Substring(2); } }
internal List <string> getListComponents(EM_System sys, EM_IncomeList il, bool isShort) { List <string> comp = new List <string>(); foreach (EM_ILComponent com in il.components) { if (sys.incomelists.ContainsKey(com.name)) { comp.AddRange(getListComponents(sys, sys.incomelists[com.name], isShort)); } else { comp.Add((com.addit ? "+" : "-") + " " + (isShort ? com.name.Replace("\n", "") : com.description.Replace("- ", ": ").Replace(" -", " :").Replace("\n", ""))); } } return(comp); }
internal List <EM_ILComponent> expandListComponents(EM_System sys, EM_IncomeList il) { List <EM_ILComponent> comp = new List <EM_ILComponent>(); foreach (EM_ILComponent com in il.components) { if (sys.incomelists.ContainsKey(com.name)) { comp.AddRange(expandListComponents(sys, sys.incomelists[com.name])); } else { comp.Add(com); } } return(comp); }