Ejemplo n.º 1
0
        //执行任务1
        public static void TaskCase1()
        {
            //读取文件
            //string filePathCase1 = Directory.GetCurrentDirectory() + "/files/en_case1";
            string filePathCase1 = Utils.GetSettings("FileDir:EN_Case_1");

            //Console.WriteLine("读取【英文Case1】文件夹中的结论...........");
            Console.WriteLine("Read the conclusion in the [EN_Case1] folder...........");
            if (!Directory.Exists(filePathCase1))
            {
                //Console.WriteLine("不存在此文件夹,请提前放入...........");
                Console.WriteLine("This folder does not exist, please put it in advance...........");
            }
            //读取英文case1
            var listCase1 = BatchImportHelper.ImportCase1(filePathCase1);

            //Console.WriteLine($"读取完毕,获得记录总数:{listCase1.Count}...........");
            Console.WriteLine($"After reading, get the total number of records:{listCase1.Count}...........");
            if (listCase1.Count > 0)
            {
                //写入excel
                DataTable dt = Utils.ToDataTable(listCase1);
                ExportExcelHandler.ExecuteExportExcelData(filePathCase1, "ChemicaList1.xls", dt);
                //Console.WriteLine("写入excel成功...........");
                Console.WriteLine("Successfully write to Excel...........");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行任务4
        /// </summary>
        public static void TaskCase4()
        {
            string filePathCase4 = Utils.GetSettings("FileDir:CN_Case_2");

            Console.WriteLine("Read the conclusion in the [CN_Case2] folder...........");
            if (!Directory.Exists(filePathCase4))
            {
                Console.WriteLine("This folder does not exist, please put it in advance...........");
            }
            //读取中文case2
            var listCase4 = BatchImportHelper.ImportCase4(filePathCase4);

            Console.WriteLine($"After reading, get the total number of records:{listCase4.Count}...........");
            if (listCase4.Count > 0)
            {
                //写入excel
                DataTable dt = Utils.ToDataTable(listCase4);
                ExportExcelHandler.ExecuteExportExcelData(filePathCase4, "化合物集合2.xls", dt);
                Console.WriteLine("Successfully write to Excel...........");
            }
        }