Example #1
0
        public static Dictionary <string, int> buildColCountDic(string filePath)
        {
            //Read CSV file, build dictinoary from it.
            COMCSVReader          reader  = new COMCSVReader();
            List <List <string> > csvData = reader.getData(filePath);

            Dictionary <string, int> standardsDic = new Dictionary <string, int>();

            foreach (List <string> line in csvData)
            {
                standardsDic.Add(line[0], Convert.ToInt32(line[1]));
            }
            return(standardsDic);
        }
Example #2
0
        public static Dictionary <string, string> buildStandardsDic(string filePath)
        {
            //Read CSV file, build dictinoary from it.
            COMCSVReader          reader  = new COMCSVReader();
            List <List <string> > csvData = reader.getData(filePath);

            Dictionary <string, string> standardsDic = new Dictionary <string, string>();

            foreach (List <string> line in csvData)
            {
                standardsDic.Add(line[1], line[0]);
            }
            return(standardsDic);
        }
Example #3
0
        public static List <CostCode> getCostCodesFromCSV(string filePath, Dictionary <string, string> standardsDic)
        {
            COMCSVReader          reader    = new COMCSVReader();
            List <CostCode>       costCodes = new List <CostCode>();
            List <List <string> > csvData   = reader.getData(filePath);

            StringBuilder headerBuilder = new StringBuilder();

            for (int i = 0; i < csvData[0].Count; i++)
            {
                headerBuilder.Append(csvData[0][i]);
                if (i < csvData[0].Count - 1)
                {
                    headerBuilder.Append(",");
                }
            }


            costCodes = getCostCodesByHeader(csvData, headerBuilder.ToString(), standardsDic);
            return(costCodes);
        }