Пример #1
0
 internal static void ComparisonEngine(string csvFieldData)
 {
     List <string> gasStationList      = ListFactory.GasStationList();
     List <string> departmentStoreList = ListFactory.DepartmentStoreList();
     List <string> groceryStoreList    = ListFactory.GroceryStoreList();
     List <string> shippingStoreList   = ListFactory.ShippingStoreList();
 }
Пример #2
0
        /// <summary>
        /// The parsing engine.
        /// </summary>
        /// <param name="path">The string value for the path to the csv file on disk.</param>
        /// <returns>A list of csv line data.</returns>
        public static List <string> ParseEngine(string path)
        {
            List <string> gasStationList      = ListFactory.GasStationList();
            List <string> departmentStoreList = ListFactory.DepartmentStoreList();
            List <string> groceryStoreList    = ListFactory.GroceryStoreList();
            List <string> shippingStoreList   = ListFactory.ShippingStoreList();

            using (TextFieldParser parser = new TextFieldParser(path))
            {
                List <string> lineBuilder = new List <string>();
                List <string> lineStorer  = new List <string>();

                parser.TextFieldType = FieldType.Delimited;
                parser.SetDelimiters(",");
                while (!parser.EndOfData)
                {
                    //Process row
                    string[] fields = parser.ReadFields();
                    foreach (string field in fields)
                    {
                        Console.WriteLine(field);
                        Console.ReadLine();
                    }

                    string line = String.Join(" ", fields);
                    Console.WriteLine(line);
                    Console.ReadLine();
                    string correctedLine = Regex.Replace(line, " {2,}", " ");

                    Console.WriteLine(correctedLine);
                    Console.ReadLine();
                }
                return(lineStorer);
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            List <string> gasStationList      = ListFactory.GasStationList();
            List <string> departmentStoreList = ListFactory.DepartmentStoreList();
            List <string> groceryStoreList    = ListFactory.GroceryStoreList();

            List <string> parsedCsv = ParseMachine.ParseEngine("c:\\testenv\\export.csv");

            Console.WriteLine(ListFactory.shippingStoreCost.Count);
            Console.ReadLine();

            //the following method call will compare each line in lineStorer with each line in each store list and return true or false for that line
            //once I get that true or false, I can begin to sort costs by whether they match X list or not
            //ComparisonMachine.ComparisonEngine(field.Trim());

            //now I have a list of strings that contains each line from the spreadsheet
            //that list is lineStorer
            //from here, I can separate each line into individual words by splitting on the whitespace
            //then I can split each line in the store list by each word using the same whitespace split
            //then I can compare each word in each list to each other and if any of the words match
            //sort the selected object into the correct cost container
            //Console.ReadLine();
        }