public void Load_Securities() { if (IsLoaded) { // The household's securities are already loaded, don't do anything return; } // The securities have not already been loaded for this household const string positionPath = FormStart.PositionPath; positionCSVData = CSVMethods.Get_CSV_Data(positionPath); // Get a list of every security in the accounts, but only one instance of each foreach (Account account in Accounts) { // Get the account's securities from the CSV data Account.Parse_Securities_From_CSV(positionCSVData, account); foreach (Security security in account.Securities) { // See if the security is on the master list already if (!FormHousehold.MasterTickerList.Contains(security.Ticker)) { // The security's not on the master list, add it FormHousehold.MasterTickerList.Add(security.Ticker); } } } // The household's securities have been loaded IsLoaded = true; }
public static List <Household> Load_List_From_CSV(string path) { // Get the data from the csv file List <string[]> csvData = CSVMethods.Get_CSV_Data(path); // Get the household list from the csv data List <Household> householdList = Parse_Households_From_CSV_Data(csvData); // Combine households with the same ID Combine_Households(householdList); // Return the household list return(householdList); }