Example #1
0
        void Crawler_Function(object sender, DoWorkEventArgs e)
        {
            label_CrawlingState.InvokeIfNeeded(SetCrawlingState, "크롤링 시작");
            LastCrawlingTick_ = 0;

            CrawlerManager.Instance.MakeCrawler(CrawlerInfoManager.Instance.channelidx_);
            LQCrawlerBase pCrawler   = CrawlerManager.Instance.GetCrawler();
            Int32         nStartTick = Environment.TickCount;

            pCrawler.Crawling(crawler_worker_);
            deletedownloadfile();
            label_CrawlingTime.InvokeIfNeeded(CheckCrawlingTime, nStartTick);
        }
Example #2
0
        private void button_FileShow_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(SelectedFilePath_) == true)
            {
                MessageBox.Show("파일을 먼저 선택하세요.");
                return;
            }

            string        channel_name = Convert.ToString(comboBox_SelectChannel.SelectedItem);
            LQCrawlerInfo pInfo        = GetCrawlingInfo(channel_name);

            CrawlerManager.Instance.SetCrawlerInfo(pInfo);

            if (pInfo == null)
            {
                MessageBox.Show("크롤러 정보가 잘못되었습니다.");
                return;
            }

            // 크롤러 정보 만들기
            // 크롤러 생성
            CrawlerManager.Instance.MakeCrawler(pInfo.Channel_Idx_);
            LQCrawlerBase pLQCrawlerBase = CrawlerManager.Instance.GetCrawler();

            if (pLQCrawlerBase == null)
            {
                MessageBox.Show("크롤러 매니저 생성 실패");
                return;
            }

            // 엑셀 데이터 읽어오기
            bool   bFixed    = false;
            string exceltype = Convert.ToString(comboBox_ExcelFrom.SelectedItem);

            if (string.Compare(ExcelTypeName_, exceltype) == 0)
            {
                bFixed = true;
            }

            OrderManager.Instance.Init();
            pLQCrawlerBase.LoadExcelAndInsertList(SelectedFilePath_, 0, bFixed, "");

            DataInsertToGrid();
        }
Example #3
0
        private void button_DBInsert_Click(object sender, EventArgs e)
        {
            if (comboBox_SelectAuthor.SelectedIndex <= 0)
            {
                MessageBox.Show("권리사를 선택 해주세요.");
                return;
            }

            if (comboBox_SelectChannel.SelectedIndex <= 0)
            {
                MessageBox.Show("채널을 선택 해주세요.");
                return;
            }

            if (comboBox_ExcelFrom.SelectedIndex <= 0)
            {
                MessageBox.Show("엑셀 폼을 선택해 주세요.");
                return;
            }

            LQCrawlerBase pLQCrawlerBase = CrawlerManager.Instance.GetCrawler();
            LQCrawlerInfo pLQCrawlerInfo = CrawlerManager.Instance.GetCrawlerInfo();

            if (pLQCrawlerBase == null || pLQCrawlerInfo == null)
            {
                MessageBox.Show("크롤러가 생성되지 않았습니다.");
                return;
            }

            // 상품 정보 읽어오기
            SqlHelper pMySqlDB = new SqlHelper();

            pMySqlDB.Connect(CrawlerInfoManager.Instance.method_, CrawlerInfoManager.Instance.dbip_, CrawlerInfoManager.Instance.dbport_, CrawlerInfoManager.Instance.dbname_
                             , CrawlerInfoManager.Instance.dbaccount_, CrawlerInfoManager.Instance.dbpw_, CrawlerInfoManager.Instance.sshhostname_
                             , CrawlerInfoManager.Instance.sshuser_, CrawlerInfoManager.Instance.sshpw_);

            DBFunctions.SelectStateTable(pMySqlDB);
            DBFunctions.GetGoodsTable(pMySqlDB, pLQCrawlerInfo.Channel_Idx_, pLQCrawlerInfo.AuthoritySeq_);
            Dictionary <Int32, ChannelGoodInfo> pGoodInfoList = CrawlerManager.Instance.GetGoodsInfo();

            DBFunctions.Select_tblOrder(pMySqlDB, pLQCrawlerInfo.Channel_Idx_);
            DBFunctions.Select_tblOrderWr(pMySqlDB, pLQCrawlerInfo.Channel_Idx_);

            pLQCrawlerBase.Login();
            pLQCrawlerBase.Combine_DB_And_Excel(false);
            pLQCrawlerBase.Process_RefundData(pMySqlDB);
            pLQCrawlerBase.Process_ExpiredData();

            // 채널에 상품처리// 채널에 취소처리  // 채널에 반품처리
            pLQCrawlerBase.Process_Use_Cancel_Refund();

            // DB 에 처리
            SqlHelper pMySqlDB2 = new SqlHelper();

            pMySqlDB2.Connect(CrawlerInfoManager.Instance.method_, CrawlerInfoManager.Instance.dbip_, CrawlerInfoManager.Instance.dbport_, CrawlerInfoManager.Instance.dbname_
                              , CrawlerInfoManager.Instance.dbaccount_, CrawlerInfoManager.Instance.dbpw_, CrawlerInfoManager.Instance.sshhostname_
                              , CrawlerInfoManager.Instance.sshuser_, CrawlerInfoManager.Instance.sshpw_);
            pLQCrawlerBase.Process_DB(pMySqlDB2);

            if (pMySqlDB2.Close() == false)
            {
                LogManager.Instance.Log("<<< 삭제 실패 2 >>>");
            }

            pMySqlDB2 = null;

            MessageBox.Show("크롤링이 끝났습니다.");
        }