Пример #1
0
        public State GetStateInfo(string stateAbbreviation)
        {
            var states = LoadStates();
            var state = new State();

            foreach (var s in states)
            {
                if (s.StateAbbreviation == stateAbbreviation)
                {
                    state.StateAbbreviation = s.StateAbbreviation;
                    state.StateName = s.StateName;
                    state.TaxRate = s.TaxRate;
                }
            }

            return state;
        }
Пример #2
0
        public List<State> LoadStates()
        {
            states = new List<State>();

            var reader = File.ReadAllLines(FilePathState);

            for (int i = 1; i < reader.Length; i++)
            {
                var columns = reader[i].Split(',');

                var state = new State();

                state.StateAbbreviation = columns[0];
                state.StateName = columns[1];
                state.TaxRate = Decimal.Parse(columns[2]);

                states.Add(state);
            }

            return states;
        }