Example #1
0
        static void Main(string[] args)
        {
            string           filePath      = @"C:\Users\punee\source\repos\StateCensusAnalyser\StateCensusAnalyser\CSVData\IndiaStateCensusData.csv";
            string           otherFilePath = @"C:\Users\punee\source\repos\StateCensusAnalyser\StateCensusAnalyser\CSVData\IndiaStateCode.csv";
            int              CSVRecords    = CSVStateCensusRecords.GetRecords(filePath);
            CSVHelperMethods cSV           = new CSVHelperMethods();
            string           csvData       = cSV.GetJSON(filePath);
            //Console.WriteLine(csvData);

            string jsondTA = cSV.SortJSONDataAccordingToStatePopulation(csvData);

            Console.WriteLine(jsondTA);

            int stateRecord = StateCensusAnalyserUtility.GetStateCensusRecords(filePath);

            FileHeadersCheck      fileHeaders     = new FileHeadersCheck(CheckFileHeaders.CheckFileHeadersMethod);
            FileDelimiterCheck    fileDelimiter   = new FileDelimiterCheck(CheckDelimiter.CheckDelimiterMethod);
            NumberOfRecordsInFile numberOfRecords = new NumberOfRecordsInFile(GetNumberOfRecords.GetNumberOfRecordsMethod);

            Console.WriteLine(fileHeaders(filePath, otherFilePath));
            Console.WriteLine(fileDelimiter(filePath));
            Console.WriteLine(numberOfRecords(filePath));

            Console.WriteLine("census recorded " + CSVRecords);
            Console.WriteLine("census recorded through program " + stateRecord);
        }
 public static int GetStateCensusRecords(string filePath)
 {
     try
     {
         CSVHelperMethods csvHelper = new CSVHelperMethods();
         return(csvHelper.GetCSVRecords(filePath));
     }
     catch (CSVException e)
     {
         throw new CSVException(e.Message, e.type);
     }
 }
 public static void GetFileHeaders(string filePath, string alternateFilePath)
 {
     try
     {
         CSVHelperMethods csvHelper = new CSVHelperMethods();
         csvHelper.GetFileHeaders(filePath, alternateFilePath);
     }
     catch (CSVException e)
     {
         throw new CSVException(e.Message, e.type);
     }
 }
 public static void GetDelimiters(string filePath)
 {
     try
     {
         CSVHelperMethods csvHelper = new CSVHelperMethods();
         csvHelper.GetDelimiters(filePath);
     }
     catch (CSVException e)
     {
         throw new CSVException(e.Message, e.type);
     }
 }
        public static int GetRecords(string filePath)
        {
            try
            {
                CSVHelperMethods csvHelper = new CSVHelperMethods();
                int count = csvHelper.GetRecords(filePath);

                return(count - 1);
            }
            catch (CSVException e)
            {
                throw new CSVException(e.Message, e.type);
            }
        }
Example #6
0
        public string SortJSONByStateArea(string data)
        {
            CSVHelperMethods csvHelper = new CSVHelperMethods();

            return(csvHelper.SortJSONDataAccordingToStateArea(data));
        }
Example #7
0
        public string SortJSONByStatePopulationDensity(string data)
        {
            CSVHelperMethods csvHelper = new CSVHelperMethods();

            return(csvHelper.SortJSONDataAccordingToStatePopulationDensity(data));
        }
Example #8
0
        public string GetJSONFromCSV(string filePath)
        {
            CSVHelperMethods csvHelper = new CSVHelperMethods();

            return(csvHelper.GetJSON(filePath));
        }