示例#1
0
        private static void GetAlexa()
        {
            var       t1      = DateTime.Now;
            WebClient Client  = new WebClient();
            var       d       = new DirectoryInfo(defaultResFolder).Parent.FullName;
            var       curDest = string.Format("{0}\\alexa.zip", d);

            Client.DownloadFile(alexaSource, curDest);
            DataProcessor processor = new DataProcessor();
            var           res       = processor.unzip(curDest);
            var           bc        = new CsvBulkCopyDataIntoSqlServer();

            bc.UpdateAlexaTable(res, true);
            var tm1 = Math.Floor(DateTime.Now.Subtract(t1).TotalSeconds).ToString();

            Console.WriteLine("Snapnames domains importined from site to DB in {0} sec", tm1);
        }
示例#2
0
        private static void ReCreateDomTable()
        {
            var t1      = DateTime.Now;
            var cs      = new CsvBulkCopyDataIntoSqlServer();
            var folder  = ConfigurationManager.AppSettings["OutputFolder"];
            var files   = Directory.EnumerateFiles(folder, "*.csv").ToArray();
            var counter = 0;

            for (var i = 0; i < files.Length; i++)
            {
                var tt1 = DateTime.Now;
                var f   = new FileInfo(files[i]);
                var cnt = cs.LoadCsvDataIntoSqlServer(f.Name, i == 0);
                counter += cnt;
                var dt = Math.Round((decimal)DateTime.Now.Subtract(tt1).TotalSeconds).ToString();
                Console.WriteLine("{0}: {1} records are imported in {2} sec", f.Name, cnt.ToString(), dt.ToString());
            }
            var t2 = Math.Round((decimal)DateTime.Now.Subtract(t1).TotalSeconds).ToString();

            Console.WriteLine("New table ({0} records) is created in {1} sec", counter.ToString(), t2);
        }