示例#1
0
        static void RemoveResidents(ResidentsList residentsList, UtilitiesList utilitiesList, string chosenMonth, string chosenUtility)
        {
            var utilityCode = "";

            for (utilitiesList.StartOfList(); utilitiesList.Contains(); utilitiesList.NextListNode())
            {
                if (utilitiesList.GetData().ServiceName == chosenUtility)
                {
                    utilityCode = utilitiesList.GetData().ServiceCode;
                    break;
                }
            }

            for (residentsList.StartOfList(); residentsList.Contains(); residentsList.NextListNode())
            {
                if (residentsList.GetData().Month != chosenMonth || residentsList.GetData().ServiceCount <= 0 || residentsList.GetData().UtilityCode != utilityCode)
                {
                    residentsList.RemoveResident(residentsList.GetNodeLocation(residentsList.GetData()));
                    residentsList.StartOfList();
                }
            }
        }