コード例 #1
0
        public static DataTable ParseCompaniesData(DataTable filteredTable)
        {
            DataTable updatedTable = new DataTable();

            try
            {
                updatedTable = filteredTable.Clone();
                int i = 0;
                foreach (DataRow row in filteredTable.Rows)
                {
                    bool    isCompanyCrawled = false;
                    DataRow dr  = crawlRow(row, out isCompanyCrawled);
                    DataRow _dr = updatedTable.NewRow();
                    updatedTable.ImportRow(dr);
                    i++;
                    if (isCompanyCrawled)
                    {
                        Console.WriteLine("Company Data Found :" + row[CompanyEnum.COMPANY_NAME]);

                        ExcelUtilities.ExportToExcelOleDb(updatedTable, companiesRecordSheet, OutputFilePath, "updatedCompanies.xlsx", true);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerUtility.Write("Data Parsing Failed ", ex.Message);
                ExcelUtilities.ExportToExcelOleDb(updatedTable, companiesRecordSheet, OutputFilePath, "updatedCompanies.xlsx", true);
            }
            return(updatedTable);
        }
コード例 #2
0
        public static void FilterCompaniesRecords()
        {
            var    dataSet        = ExcelUtilities.GetDataSetFromExcelFile(filePath, companiesRecordSheet);
            var    companiesTable = dataSet.Tables[companiesRecordSheet];
            var    filteredTable  = FilterDataTable(companiesTable);
            string outputFileName = "FilteredCompanyRecords.xlsx";

            ExcelUtilities.ExportToExcelOleDb(filteredTable, companiesRecordSheet, OutputFilePath, outputFileName, true);

            LoggerUtility.Write("Success", "Company Records Sorted " + OutputFilePath + outputFileName);
            APIManager.ParseCompaniesData(filteredTable);
        }
コード例 #3
0
        public static void SortSalesRecords()
        {
            try
            {
                var    dataSet        = ExcelUtilities.GetDataSetFromExcelFile(filePath, saleRecordSheet);
                var    salesTable     = dataSet.Tables[saleRecordSheet];
                var    sortKey        = "Transfer Date";
                var    sortedTable    = SortDataTable(salesTable, sortKey);
                string outputFileName = "SortedSalesRecords.xlsx";
                ExcelUtilities.ExportToExcelOleDb(sortedTable, saleRecordSheet, OutputFilePath, outputFileName, true);

                LoggerUtility.Write("Success", "Sales Record Sorted " + OutputFilePath + outputFileName);
            }
            catch (Exception ex)
            {
                LoggerUtility.Write("Exception in SortSaleRecords : ", ex.Message);
            }
        }