예제 #1
0
        public override void GetContainer(TransactionContainerAbstract container, string filePath)
        {
            if (!FilePaths.Contains(filePath))
            {
                FilePaths.Add(filePath);
            }
            else
            {
                throw new Exception("This file has already been loaded");
            }

            container.Clear();

            foreach (var currentPath in FilePaths)
            {
                var lines = File.ReadLines(currentPath);

                foreach (string s in lines)
                {
                    string[] split = s.Split(',');

                    if (split.Length != AttributeNumber)
                    {
                        throw new Exception("Column number mismatch");
                    }

                    container.AddTransaction(long.Parse(split[0]),
                                             DateTime.ParseExact(split[1], "HH:mm:ss", CultureInfo.InvariantCulture),
                                             split[4],
                                             double.Parse(split[5], CultureInfo.InvariantCulture),
                                             double.Parse(split[7], CultureInfo.InvariantCulture),
                                             split[15] == "B" ? true : false);
                }
            }
        }
 public abstract void GetContainer(TransactionContainerAbstract container, string filePath);