コード例 #1
0
ファイル: eBay_Auction.cs プロジェクト: Youkyungjin/Crawler
        public override bool CheckIsCancel()
        {
            try
            {
                foreach (var pData in Excel_Cancel_List_)
                {
                    //if (pData.Value.State_ != "취소완료")
                    //    continue;

                    if (DBSelected_List_.ContainsKey(pData.Key) == true)
                    {
                        if (DBProccess_List_.ContainsKey(pData.Key) == true)
                        {
                            NewLogManager2.Instance.Log(string.Format("CheckIsCancel DB 처리에 두가지가 다 들어가 있다.{0}", pData.Key));
                            continue;
                        }

                        COrderData pCOrderData = DBSelected_List_[pData.Key];

                        if (pCOrderData.State_ != DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL])
                        {
                            pCOrderData.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL];
                            DBCancel_List_.Add(pCOrderData.channelOrderCode_, pCOrderData);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error override bool CheckIsCancel( - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: TicketSuDa.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서 사용처리 해야 할게 있는지 체크
        public override bool CheckNeedUseWeb()
        {
            try
            {
                foreach (var pData in DBSelected_List_)
                {
                    COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];

                    // 레저큐에서 예약을 완료한 상태 웹에 사용 처리를 해야한다.
                    if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_RESERVED])
                    {
                        pDBData.BuyDate_ = pData.Value.BuyDate_;
                        WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                    }
                    else if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.AR])
                    {
                        pDBData.BuyDate_ = pData.Value.BuyDate_;
                        WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error public override bool CheckNeedUseWeb() - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #3
0
ファイル: MomSchool.cs プロジェクト: Youkyungjin/Crawler
        void SplitDealAndInsertExcelData(COrderData pExcelData, Int32[] arr)
        {
            pExcelData.ExData_Option_ = Regex.Replace(pExcelData.ExData_Option_, @"[^a-zA-Z0-9가-힣]", "");
            Int32 nTotalcount = 0;

            for (Int32 i = 0; i < arr.Length; i++)
            {
                for (Int32 j = 0; j < arr[i]; j++)
                {
                    nTotalcount++;
                    COrderData tempExcelData = new COrderData();
                    tempExcelData.CopyFrom(pExcelData);
                    tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);
                    tempExcelData.ExData_Option_    = pExcelData.ExData_Option_;
                    tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                    tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;
                    tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);

                    if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                    {
                        Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                    }
                }
            }
        }
コード例 #4
0
ファイル: WeekOn.cs プロジェクト: Youkyungjin/Crawler
        // 하나의 딜을 여러개로 나눌 필요가 있는가? 있다면 나눠서 넣고 없다면 그냥 넣는다.
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            string optionstring = pExcelData.ExData_Option_;
            Int32  nBuycount    = 0;
            Int32  nTotalcount  = 0;

            pExcelData.ExData_Option_    = Regex.Replace(pExcelData.ExData_Option_, @"[^a-zA-Z0-9가-힣]", "");
            pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", "");
            nBuycount = pExcelData.BuyCount_;

            for (Int32 i = 0; i < nBuycount; i++)
            {
                nTotalcount++;
                COrderData tempExcelData = new COrderData();
                tempExcelData.CopyFrom(pExcelData);
                tempExcelData.ExData_Option_    = pExcelData.ExData_Option_;
                tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;
                tempExcelData.ExData_Use_       = pExcelData.ExData_Use_;
                tempExcelData.ExData_Cancel_    = pExcelData.ExData_Cancel_;
                tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);
                if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                {
                    Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                }
            }
            return(nTotalcount);
        }
コード例 #5
0
ファイル: BaseChannel.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서는 사용처리가 되지 않았는데, DB에 는 사용처리로 되어 있다면, DB값을 변경 해준다.
        public virtual bool CheckNeedFixUp()
        {
            foreach (var pData in Excel_List_)
            {
                if (DBSelected_List_.ContainsKey(pData.Key) == true)
                {
                    COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];

                    if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.USED])
                    {
                        if (pData.Value.ExData_Use_ != LQCrawlerInfo_.ExData_UseCheck_)
                        {
                            pDBData.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_RESERVED];
                            DBProccess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                    else if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.A])
                    {
                        if (pData.Value.ExData_Use_ != LQCrawlerInfo_.ExData_UseCheck_)
                        {
                            pDBData.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.AR];
                            DBProccess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                }
            }

            return(true);
        }
コード例 #6
0
ファイル: MomSchool.cs プロジェクト: Youkyungjin/Crawler
        // 하나의 딜을 여러개로 나눌 필요가 있는가? 있다면 나눠서 넣고 없다면 그냥 넣는다.
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            pExcelData.ExData_Option_ = Regex.Replace(pExcelData.ExData_Option_, @"[^a-zA-Z0-9가-힣]", "");
            Excel_List_.Add(pExcelData.channelOrderCode_, pExcelData);

            return(1);
        }
コード例 #7
0
ファイル: BaseChannel.cs プロジェクト: Youkyungjin/Crawler
        // 주문정보 잘못된것 정정하는 프로시저
        public bool DB_UpdateData_FixUp()
        {
            try
            {
                SqlHelper pMySqlDB = new SqlHelper();

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

                ProcessStateManager.Instance.NeedDBProcessCount_ = DBProccess_List_.Count;
                foreach (var pData in DBProccess_List_)
                {
                    COrderData pOrder = pData.Value;

                    DBInterface.Update_OrderInfo_FixUP(pMySqlDB, (Int32)pOrder.seq_, pOrder.State_);
                    ProcessStateManager.Instance.CurDBProcessCount_++;
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error DB_UpdateData_FixUp {0}", ex.Message));
                return(true);
            }


            return(true);
        }
コード例 #8
0
ファイル: DBInterface.cs プロジェクト: Youkyungjin/Crawler
    public static bool Select_tblOrder_With_UID(SqlHelper dbHelper, Int32 xchannelSeq, Int32 xGoodsSeq
                                                , /*string sDate, string eDate,*/ ref Dictionary <string, COrderData> pList)
    {
        bool bResult = true;

        try
        {
            Dictionary <string, object> argdic = new Dictionary <string, object>();
            argdic.Add("xChannelSeq", xchannelSeq);
            //argdic.Add("xAuthorityLoginSeq", xGoodsSeq);
            argdic.Add("xGoodsSeq", xGoodsSeq);

            //argdic.Add("xSDate", sDate);
            //argdic.Add("xEDate", eDate);

            //\MySqlDataReader datareader = dbHelper.call_proc("spNewTestSelectOrderInfo", argdic);
            MySqlDataReader datareader = dbHelper.call_proc("spNewSelectOrderInfo", argdic);

            while (datareader.Read())
            {
                COrderData pOrderData = new COrderData();
                pOrderData.seq_        = Convert.ToInt64(datareader["seq"]);
                pOrderData.goodsSeq_   = Convert.ToInt32(datareader["goodsSeq"]);
                pOrderData.memberSeq_  = Convert.ToInt32(datareader["memberSeq"]);
                pOrderData.channelSeq_ = Convert.ToInt32(datareader["channelSeq"]);

                pOrderData.channelOrderCode_ = Convert.ToString(datareader["channelOrderCode"]);
                pOrderData.orderReserveCode_ = Convert.ToString(datareader["orderCode"]);
                pOrderData.orderID_          = Convert.ToString(datareader["orderId"]);
                pOrderData.goodsCode_        = Convert.ToString(datareader["ChGoodsCode"]);

                pOrderData.orderSettlePrice_ = Convert.ToInt32(datareader["orderSettlePrice"]);
                pOrderData.orderName_        = Convert.ToString(datareader["orderName"]);
                pOrderData.orderPhone_       = Convert.ToString(datareader["orderPhone"]);
                //pOrderData.orderMethod_ = Convert.ToString(datareader["orderMethod"]);
                pOrderData.State_ = Convert.ToString(datareader["State"]);


                if (pList.ContainsKey(pOrderData.channelOrderCode_) == false)
                {
                    pList.Add(pOrderData.channelOrderCode_, pOrderData);
                }
                else
                {
                    NewLogManager2.Instance.Log(string.Format("Error Select_tblOrder_With_UID Same OrderCode {0}", pOrderData.channelOrderCode_));
                }
            }

            datareader.Close();
            datareader.Dispose();
            datareader = null;
        }
        catch (System.Exception ex)
        {
            NewLogManager2.Instance.Log(string.Format("Error bool Select_tblOrder_With_UID - {0}", ex.Message));
            bResult = false;
        }

        return(bResult);
    }
コード例 #9
0
        // 웹에서 사용처리 해야 할게 있는지 체크
        public override bool CheckNeedUseWeb()
        {
            foreach (var pData in Excel_List_)
            {
                if (DBSelected_List_.ContainsKey(pData.Key) == true)
                {
                    COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];
                    if (pData.Value.State_ == pDBData.State_)
                    {
                        continue;
                    }

                    pData.Value.goodsPassType     = pDBData.goodsPassType;
                    pData.Value.ExData_GoodsName_ = pDBData.ExData_GoodsName_;
                    pData.Value.goodsSeq_         = pDBData.goodsSeq_;
                    pData.Value.goodsCode_        = pDBData.goodsCode_;

                    if (pData.Value.ExData_Use_ == "결제완료")
                    {
                        pDBData.BuyDate_ = pData.Value.BuyDate_;
                        WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                    }
                }
            }

            return(true);
        }
コード例 #10
0
ファイル: SaleToNight.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서 사용처리 해야 할게 있는지 체크
        public override bool CheckNeedUseWeb()
        {
            try
            {
                foreach (var pData in Excel_List_)
                {
                    ChannelGoodInfo pInfo = null;

                    if (LQCrawlerInfo_.ExData_GoodName_ == 0)
                    {
                        pInfo = GetGoodInfoByGoodCodeAndOptionName(pData.Value.goodsCode_, pData.Value.ExData_Option_);
                    }
                    else
                    {
                        pInfo = GetGoodInfoByGoodOptionName(pData.Value.ExData_GoodsName_, pData.Value.ExData_Option_);
                    }

                    if (pInfo == null)
                    {
                        continue;
                    }

                    pData.Value.ExData_GoodsName_ = pInfo.GoodsName_;
                    pData.Value.goodsSeq_         = pInfo.Idx_;
                    pData.Value.goodsCode_        = pInfo.Goods_Code_;

                    if (DBSelected_List_.ContainsKey(pData.Key) == true)
                    {
                        COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];
                        if (pData.Value.State_ == pDBData.State_)
                        {
                            continue;
                        }

                        // 레저큐에서 예약을 완료한 상태 웹에 사용 처리를 해야한다.
                        if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_RESERVED])
                        {
                            pDBData.BuyDate_ = pData.Value.BuyDate_;
                            WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                        else if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.AR])
                        {
                            pDBData.BuyDate_ = pData.Value.BuyDate_;
                            WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error public override bool CheckNeedUseWeb() - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #11
0
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            pExcelData.ExData_Option_    = Regex.Replace(pExcelData.ExData_Option_, @"[^a-zA-Z0-9가-힣]", "");
            pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsNick_, @"[^a-zA-Z0-9가-힣]", "");

            if (Excel_List_.ContainsKey(pExcelData.channelOrderCode_) == false)
            {
                Excel_List_.Add(pExcelData.channelOrderCode_, pExcelData);
            }
            return(1);
        }
コード例 #12
0
ファイル: WeMakePrice.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서 사용처리 해야 할게 있는지 체크
        public override bool CheckNeedUseWeb()
        {
            try
            {
                foreach (var pData in DBSelected_List_)
                {
                    /*  ChannelGoodInfo pInfo = null;
                     *
                     * if (LQCrawlerInfo_.ExData_GoodName_ == 0)
                     *   pInfo = GetGoodInfoByGoodCodeAndOptionName(pData.Value.goodsCode_, pData.Value.ExData_Option_);
                     * else
                     *   pInfo = GetGoodInfoByGoodOptionName(pData.Value.ExData_GoodsName_, pData.Value.ExData_Option_);
                     *
                     * if (pInfo == null)
                     *   continue;
                     */

                    pData.Value.ExData_GoodsName_ = pData.Value.ExData_GoodsName_;
                    pData.Value.goodsSeq_         = pData.Value.goodsSeq_;
                    pData.Value.goodsCode_        = pData.Value.goodsCode_;

                    if (pData.Value.channelOrderCode_ == "4SMBFCRQ7K3D" || pData.Value.channelOrderCode_ == "4UAEDSKHEDQM" || pData.Value.channelOrderCode_ == "55WOW493OVMY")
                    {
                        Int32 a = 32;
                    }

                    if (DBSelected_List_.ContainsKey(pData.Key) == true)
                    {
                        COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];

                        // 레저큐에서 예약을 완료한 상태 웹에 사용 처리를 해야한다.
                        if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_RESERVED])
                        {
                            pDBData.BuyDate_ = pData.Value.BuyDate_;
                            WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                        else if (pDBData.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.AR])
                        {
                            pDBData.BuyDate_ = pData.Value.BuyDate_;
                            WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error bool CheckNeedUseWeb - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #13
0
ファイル: WeekOn.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서 사용처리 해야 할게 있는지 체크
        public override bool CheckNeedUseWeb()
        {
            try
            {
                foreach (var pData in Excel_List_)
                {
                    ChannelGoodInfo pInfo = null;

                    if (LQCrawlerInfo_.ExData_GoodName_ == 0)
                    {
                        pInfo = GetGoodInfoByGoodCodeAndOptionName(pData.Value.goodsCode_, pData.Value.ExData_Option_);
                    }
                    else
                    {
                        pInfo = GetGoodInfoByGoodOptionName(pData.Value.ExData_GoodsNick_, pData.Value.ExData_Option_);
                    }

                    if (pInfo == null)
                    {
                        continue;
                    }

                    pData.Value.goodsPassType     = pInfo.GoodsPassType_;
                    pData.Value.ExData_GoodsName_ = pInfo.GoodsName_;
                    pData.Value.goodsSeq_         = pInfo.Idx_;
                    pData.Value.goodsCode_        = pInfo.Goods_Code_;

                    if (DBSelected_List_.ContainsKey(pData.Key) == true)
                    {
                        COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];
                        if (pData.Value.State_ == pDBData.State_)
                        {
                            continue;
                        }


                        if (pData.Value.ExData_Use_ == "0000-00-00 00:00:00" && pData.Value.ExData_Cancel_ == "0000-00-00 00:00:00")
                        {
                            pDBData.BuyDate_ = pData.Value.BuyDate_;
                            WebProcess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error override bool CheckNeedUseWeb( - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #14
0
        bool Use_Deal(COrderData pCOrderData)
        {
            try
            {
                string couponcode = pCOrderData.channelOrderCode_;
                Int32  LIndex     = couponcode.LastIndexOf('_');
                couponcode = couponcode.Substring(0, LIndex);
                string delivery_no = "";
                string ticket_code = "";

                DateTime eDateTime = Convert.ToDateTime(pCOrderData.BuyDate_);
                DateTime sDateTime = eDateTime.AddDays(-7);

                string eDate = string.Format("{0:D4}{1:D2}{2:D2}", eDateTime.Year, eDateTime.Month, eDateTime.Day);
                string sDate = string.Format("{0:D4}{1:D2}{2:D2}", sDateTime.Year, sDateTime.Month, sDateTime.Day);

                // 웹 호출을 통해서 사용처리한다.
                string   useurl      = LQCrawlerInfo_.UseUserUrl_;
                string   useparam    = LQCrawlerInfo_.UseUserParam_;
                string[] cpcodeArray = couponcode.Split('_');
                couponcode = cpcodeArray[0];
                GetUseTicketInfo(couponcode, sDate, eDate, ref ticket_code, ref delivery_no);

                useparam = useparam.Replace("{Delivery_no}", delivery_no);
                useparam = useparam.Replace("{GoodsCode}", couponcode);
                useparam = useparam.Replace("{TicketCode}", ticket_code);

                HttpWebResponse pResponse = HKHttpWebRequest.ReqHttpRequest("POST", useurl, useparam, Cookie_);

                if (pResponse == null)
                {
                    return(false);
                }

                TextReader r          = (TextReader) new StreamReader(pResponse.GetResponseStream());
                string     htmlBuffer = r.ReadToEnd();

                if (htmlBuffer.IndexOf(LQCrawlerInfo_.UseUserCheck_) < 0)
                {
                    NewLogManager2.Instance.Log(htmlBuffer);
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error bool Use_Deal(COrderData pCOrderData) - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #15
0
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            string optionstring = pExcelData.ExData_Option_;
            Int32  nBuycount    = 0;
            Int32  nTotalcount  = 0;
            string optionname   = "";

            pExcelData.ExData_GoodsNick_ = Convert.ToString(Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", ""));
            string regstring = @"(?<OptionName>\S+)\(\S+\)(?<Count>\d+)개|(?<OptionName>\S+)(?<Count>\d+)개";

            string[] optionarray = System.Text.RegularExpressions.Regex.Split(optionstring, "\n");

            foreach (string curoption in optionarray)
            {
                optionstring = curoption.Replace(" ", "");
                Regex           re = new Regex(regstring, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                MatchCollection oe = re.Matches(optionstring);

                foreach (Match mat in oe)
                {
                    GroupCollection group = mat.Groups;
                    optionname = Convert.ToString(group["OptionName"].Value);
                    optionname = Regex.Replace(optionname, @"[^a-zA-Z0-9가-힣]", "");
                    nBuycount  = Convert.ToInt32(group["Count"].Value);

                    for (Int32 i = 0; i < nBuycount; i++)
                    {
                        nTotalcount++;
                        COrderData tempExcelData = new COrderData();
                        tempExcelData.CopyFrom(pExcelData);
                        tempExcelData.ExData_Option_    = optionname;
                        tempExcelData.ExData_Use_       = pExcelData.ExData_Use_;
                        tempExcelData.ExData_Cancel_    = pExcelData.ExData_Cancel_;
                        tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                        tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;
                        tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);

                        if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                        {
                            Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                        }
                    }
                }
            }

            return(nTotalcount);
        }
コード例 #16
0
ファイル: eBay_Auction.cs プロジェクト: Youkyungjin/Crawler
        // 하나의 딜을 여러개로 나눌 필요가 있는가? 있다면 나눠서 넣고 없다면 그냥 넣는다.
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            if (string.IsNullOrEmpty(comparesitename) == true)
            {
                return(0);
            }

            if (comparesitename.IndexOf(str_sitecompare_) < 0)
            {
                return(0);
            }

            string optionstring   = Regex.Replace(pExcelData.ExData_Option_, @" ", "");
            Int32  nBuycount      = 0;
            Int32  nTotalcount    = 0;
            string optionnickname = "";

            pExcelData.ExData_GoodsNick_ = Convert.ToString(Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", ""));
            string regstring = @"(?<OptionName>\S+)/\S+/\d+개|(?<OptionName>\S+)/\d+개";

            // 옵션명 개수 빼기
            Regex           re = new Regex(regstring, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            MatchCollection oe = re.Matches(optionstring);

            optionnickname = Convert.ToString(Regex.Replace(oe[0].Groups["OptionName"].Value, @"[^a-zA-Z0-9가-힣]", ""));
            nBuycount      = pExcelData.BuyCount_;
            for (Int32 i = 0; i < nBuycount; i++)
            {
                nTotalcount++;
                COrderData tempExcelData = new COrderData();
                tempExcelData.CopyFrom(pExcelData);
                tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;
                tempExcelData.ExData_Option_    = optionnickname;
                tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);
                if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                {
                    Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                }
            }

            return(nTotalcount);
        }
コード例 #17
0
ファイル: TicketSuDa.cs プロジェクト: Youkyungjin/Crawler
        // 하나의 딜을 여러개로 나눌 필요가 있는가? 있다면 나눠서 넣고 없다면 그냥 넣는다.
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            pExcelData.ExData_Option_    = Regex.Replace(pExcelData.ExData_Option_, @"[^a-zA-Z0-9가-힣]", "");
            pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", "");
            string regstring = @"(?<CouponCode>\S+)\(\S+\)";

            Int32 nTotalcount = 0;
            Int32 nBuycount   = 0;

            string[] splitArray = pExcelData.channelOrderCode_.Split(',');
            nBuycount = splitArray.Length;

            for (int i = 0; i < nBuycount; i++)
            {
                string          couponString = splitArray[i].Replace(" ", "");
                Regex           re           = new Regex(regstring, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                MatchCollection oe           = re.Matches(couponString);

                foreach (Match mat in oe)
                {
                    GroupCollection group = mat.Groups;
                    couponString = Convert.ToString(group["CouponCode"].Value);


                    nTotalcount++;
                    COrderData tempExcelData = new COrderData();
                    tempExcelData.CopyFrom(pExcelData);
                    tempExcelData.ExData_Option_    = pExcelData.ExData_Option_;
                    tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                    tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;

                    tempExcelData.channelOrderCode_ = couponString;
                    if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                    {
                        Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                    }
                }
            }

            return(1);
        }
コード例 #18
0
ファイル: BaseChannel.cs プロジェクト: Youkyungjin/Crawler
        // 웹에서 취소가 된 딜이 있는데, DB에는 다른걸로 되어 있다면, DB값을 취소로 변경 해주자.
        public bool CheckNeedFixUP_Cancel()
        {
            foreach (var pData in Excel_List_)
            {
                if (DBSelected_List_.ContainsKey(pData.Key) == true)
                {
                    COrderData pDBData = DBSelected_List_[pData.Value.channelOrderCode_];

                    if (pDBData.State_ != DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL])
                    {
                        if (LQCrawlerInfo_.ExData_CancelCheck_ == pData.Value.ExData_Cancel_)
                        {
                            pDBData.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL];
                            DBProccess_List_.Add(pDBData.channelOrderCode_, pDBData);
                        }
                    }
                }
            }

            return(true);
        }
コード例 #19
0
        protected override Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "")
        {
            string optionstring = pExcelData.ExData_Option_;
            Int32  nBuycount    = 0;
            Int32  nTotalcount  = 0;
            string optionname   = "";
            string regstring    = @"(?<OptionName>\S+)-\S+개";

            optionstring = optionstring.Replace(" ", "");
            pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", "");
            Regex           re = new Regex(regstring, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            MatchCollection oe = re.Matches(optionstring);

            foreach (Match mat in oe)
            {
                GroupCollection group = mat.Groups;
                optionname = Convert.ToString(group["OptionName"].Value);
                optionname = Regex.Replace(optionname, @"[^a-zA-Z0-9가-힣]", "");
                nBuycount  = pExcelData.BuyCount_;

                for (Int32 i = 0; i < nBuycount; i++)
                {
                    nTotalcount++;
                    COrderData tempExcelData = new COrderData();
                    tempExcelData.CopyFrom(pExcelData);
                    tempExcelData.ExData_Option_    = optionname;
                    tempExcelData.ExData_GoodsName_ = pExcelData.ExData_GoodsName_;
                    tempExcelData.ExData_GoodsNick_ = pExcelData.ExData_GoodsNick_;
                    tempExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, nTotalcount);

                    if (Excel_List_.ContainsKey(tempExcelData.channelOrderCode_) == false)
                    {
                        Excel_List_.Add(tempExcelData.channelOrderCode_, tempExcelData);
                    }
                }
            }

            return(nTotalcount);
        }
コード例 #20
0
        public override bool CheckIsCancel()
        {
            foreach (var pData in Excel_Cancel_List_)
            {
                if (DBSelected_List_.ContainsKey(pData.Key) == true)
                {
                    if (DBProccess_List_.ContainsKey(pData.Key) == true)
                    {
                        NewLogManager2.Instance.Log(string.Format("CheckIsCancel DB 처리에 두가지가 다 들어가 있다.{0}", pData.Key));
                        continue;
                    }

                    COrderData pCOrderData = DBSelected_List_[pData.Key];

                    if (pCOrderData.State_ != DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL])
                    {
                        pCOrderData.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.CANCEL];
                        DBCancel_List_.Add(pCOrderData.channelOrderCode_, pCOrderData);
                    }
                }
            }

            return(true);
        }
コード例 #21
0
ファイル: Coupang.cs プロジェクト: Youkyungjin/Crawler
        protected override bool Internal_Excel_Parsing(ChannelGoodInfo pChannelGoodInfo)
        {
            try
            {
                if (actionType != "insert")
                {
                    return(true);
                }

                if (GoodsDownInfo_.ContainsKey(pChannelGoodInfo.Goods_Code_) == false)
                {
                    NewLogManager2.Instance.Log(string.Format("!! 상품 코드 엑셀이 없습니다. - {0}", pChannelGoodInfo.Goods_Code_));
                    return(false);
                }


                DateTime dtNow      = BaseChannel.dtnow;
                DateTime beforeData = dtNow.AddDays(-2);
                string   sData      = string.Format("{0}-{1}-{2} {3}:{4}:{5}", beforeData.Year, beforeData.Month, beforeData.Day, "00", "00", "00");


                string filepath = GoodsDownInfo_[pChannelGoodInfo.Goods_Code_];
                Microsoft.Office.Interop.Excel.Application ap = null;
                Workbook  wb = null;
                Worksheet ws = null;
                HKExcelHelper.GetWorkSheet(filepath, ref ap, ref wb, ref ws);

                Range  tRange          = null;
                string tempString      = "";
                string comparesitename = "";

                Int32 nCurrentRow      = LQCrawlerInfo_.ExData_Start_;
                Int32 ExData_Option    = LQCrawlerInfo_.ExData_Option_;
                Int32 ExData_Coupncode = LQCrawlerInfo_.ExData_Coupncode_;
                Int32 ExData_Buyer     = LQCrawlerInfo_.ExData_Buyer_;
                Int32 ExData_Cancel    = LQCrawlerInfo_.ExData_Cancel_;
                Int32 ExData_Use       = LQCrawlerInfo_.ExData_Use_;
                Int32 ExData_Buyphone  = LQCrawlerInfo_.ExData_Buyphone_;
                Int32 ExData_Price     = LQCrawlerInfo_.ExData_Price_;
                Int32 ExData_BuyDate   = LQCrawlerInfo_.ExData_Buydate_;
                Int32 ExData_BuyCount  = LQCrawlerInfo_.ExData_Count_;

                if (nCurrentRow > 0)
                {
                    ProcessStateManager.Instance.NeedParsingCount_ += (ws.UsedRange.Rows.Count - (nCurrentRow - 1));
                }

                while (true)
                {
                    try
                    {
                        tRange          = ws.Cells[nCurrentRow, 1];
                        comparesitename = Convert.ToString(tRange.Value2);

                        tRange = ws.Cells[nCurrentRow, ExData_Option];
                        if (tRange == null)
                        {
                            break;
                        }

                        tempString = tRange.Value2;
                        if (tempString == null)
                        {
                            break;
                        }

                        COrderData pExcelData = new COrderData();
                        pExcelData.channelSeq_            = LQCrawlerInfo_.Channel_Idx_;
                        pExcelData.goodsSeq_              = pChannelGoodInfo.Idx_;
                        pExcelData.ExData_Option_         = tempString;
                        pExcelData.ExData_OptionOriginal_ = tempString;
                        pExcelData.ExData_GoodsName_      = pExcelData.ExData_GoodsNick_ = pChannelGoodInfo.GoodsName_;
                        pExcelData.goodsCode_             = pChannelGoodInfo.Goods_Code_;

                        tRange = ws.Cells[nCurrentRow, ExData_BuyDate];

                        pExcelData.BuyDate_ = Convert.ToString(tRange.Value2);
                        pExcelData.BuyDate_ = pExcelData.BuyDate_.Replace('.', '-');
                        pExcelData.BuyDate_ = Regex.Replace(pExcelData.BuyDate_, @"^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$", @"$1-$2-$3 $4:$5:$6");
                        DateTime excelDate = DateTime.Parse(pExcelData.BuyDate_);

                        int checkTime = DateTime.Compare(beforeData, excelDate);

                        //비교날짜보다 더 크면 리스트에 추가하지 말고 넘어간다
                        if (checkTime > 0)
                        {
                            ProcessStateManager.Instance.PassParsingCount_++;
                            nCurrentRow++;
                            continue;
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Coupncode];
                        if (tRange == null)
                        {
                            break;
                        }

                        pExcelData.channelOrderCode_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.channelOrderCode_ == null)
                        {
                            break;
                        }
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Replace("'", "");
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Trim();   // 공백 제거

                        tRange = ws.Cells[nCurrentRow, ExData_Buyer];
                        pExcelData.orderName_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderName_ == null)
                        {
                            pExcelData.orderName_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Cancel];
                        pExcelData.ExData_Cancel_ = tRange.Value2;
                        if (pExcelData.ExData_Cancel_ == null)
                        {
                            pExcelData.ExData_Cancel_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Use];
                        pExcelData.ExData_Use_ = tRange.Value2;
                        if (pExcelData.ExData_Use_ == null)
                        {
                            pExcelData.ExData_Use_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Buyphone];
                        pExcelData.orderPhone_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderPhone_ == null)
                        {
                            pExcelData.orderPhone_ = "";
                        }

                        pExcelData.orderPhone_ = pExcelData.orderPhone_.Replace("'", "");


                        if (ExData_Price != 0)
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_Price];

                            if (tRange.Value2 != null && tRange.Value2 != "")
                            {// 돈에 , 가 있으면 제거하자.
                                tempString = Convert.ToString(tRange.Value2);
                                tempString = tempString.Replace(",", "");
                                pExcelData.orderSettlePrice_ = Convert.ToInt32(tempString);
                            }
                        }

                        if (ExData_BuyCount != 0)// 구매갯수를 따로 뽑아야 하는 채널에서만
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_BuyCount];
                            pExcelData.BuyCount_ = Convert.ToInt32(tRange.Value2);
                        }

                        SplitDealAndInsertExcelData(pExcelData, comparesitename);
                    }
                    catch (System.Exception ex)
                    {
                        NewLogManager2.Instance.Log(string.Format("엑셀 파싱 에러 : {0}", ex.Message));
                        break;
                        //nCurrentRow++;
                        //continue;
                    }

                    ProcessStateManager.Instance.CurParsingCount_++;
                    nCurrentRow++;
                }

                wb.Close(false, filepath, Type.Missing);
                ap.Quit();

                Marshal.FinalReleaseComObject(tRange);
                Marshal.FinalReleaseComObject(ws);
                Marshal.FinalReleaseComObject(wb);
                Marshal.FinalReleaseComObject(ap);
                tRange = null;
                ws     = null;
                wb     = null;
                ap     = null;

                GC.Collect();
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error protected override bool Internal_Excel_Parsing - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #22
0
        protected override bool Internal_Excel_Parsing(ChannelGoodInfo pChannelGoodInfo)
        {
            try
            {
                if (GoodsDownInfo_.ContainsKey(pChannelGoodInfo.Goods_Code_) == false)
                {
                    NewLogManager2.Instance.Log(string.Format("!! 상품 코드 엑셀이 없습니다. - {0}", pChannelGoodInfo.Goods_Code_));
                    return(false);
                }

                string filepath = GoodsDownInfo_[pChannelGoodInfo.Goods_Code_];
                Microsoft.Office.Interop.Excel.Application ap = null;
                Workbook  wb = null;
                Worksheet ws = null;
                HKExcelHelper.GetWorkSheet(filepath, ref ap, ref wb, ref ws);

                Range  tRange          = null;
                string tempString      = "";
                string comparesitename = "";

                Int32 nCurrentRow       = LQCrawlerInfo_.ExData_Start_;
                Int32 ExData_Option     = LQCrawlerInfo_.ExData_Option_;
                Int32 ExData_Coupncode  = LQCrawlerInfo_.ExData_Coupncode_;
                Int32 ExData_Buyer      = LQCrawlerInfo_.ExData_Buyer_;
                Int32 ExData_Cancel     = LQCrawlerInfo_.ExData_Cancel_;
                Int32 ExData_Use        = LQCrawlerInfo_.ExData_Use_;
                Int32 ExData_Buyphone   = LQCrawlerInfo_.ExData_Buyphone_;
                Int32 ExData_Price      = LQCrawlerInfo_.ExData_Price_;
                Int32 ExData_BuyDate    = LQCrawlerInfo_.ExData_Buydate_;
                Int32 ExData_BuyCount   = LQCrawlerInfo_.ExData_Count_;
                Int32 ExData_GoodsName  = LQCrawlerInfo_.ExData_GoodName_;
                Int32 ExData_Coupncode2 = 4;    // 11번가만 가지고 있는 주문 순번 쿠폰 코드가 고유하지 않아서 이것과 합쳐야만 고유해진다.

                ProcessStateManager.Instance.NeedParsingCount_ += ws.UsedRange.Rows.Count;

                while (true)
                {
                    try
                    {
                        tRange          = ws.Cells[nCurrentRow, 1];
                        comparesitename = Convert.ToString(tRange.Value2);

                        tRange = ws.Cells[nCurrentRow, ExData_Option];
                        if (tRange == null)
                        {
                            break;
                        }

                        tempString = tRange.Value2;
                        if (tempString == null)
                        {
                            break;
                        }

                        COrderData pExcelData = new COrderData();
                        pExcelData.channelSeq_            = LQCrawlerInfo_.Channel_Idx_;
                        pExcelData.goodsSeq_              = pChannelGoodInfo.Idx_;
                        pExcelData.ExData_Option_         = tempString;
                        pExcelData.ExData_OptionOriginal_ = tempString;
                        tRange = ws.Cells[nCurrentRow, ExData_GoodsName];
                        pExcelData.ExData_GoodsName_ = tRange.Value2;
                        pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", "");
                        tRange = ws.Cells[nCurrentRow, ExData_Coupncode];
                        if (tRange == null)
                        {
                            break;
                        }

                        pExcelData.channelOrderCode_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.channelOrderCode_ == null)
                        {
                            break;
                        }
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Replace("'", "");
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Trim();   // 공백 제거

                        tRange = ws.Cells[nCurrentRow, ExData_Coupncode2];
                        if (tRange == null)
                        {
                            break;
                        }

                        pExcelData.channelOrderCode_ = string.Format("{0}_{1}", pExcelData.channelOrderCode_, Convert.ToString(tRange.Value2));

                        tRange = ws.Cells[nCurrentRow, ExData_Buyer];
                        pExcelData.orderName_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderName_ == null)
                        {
                            pExcelData.orderName_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Cancel];
                        pExcelData.ExData_Cancel_ = tRange.Value2;
                        if (pExcelData.ExData_Cancel_ == null)
                        {
                            pExcelData.ExData_Cancel_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Use];
                        pExcelData.ExData_Use_ = tRange.Value2;
                        if (pExcelData.ExData_Use_ == null)
                        {
                            pExcelData.ExData_Use_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Buyphone];
                        pExcelData.orderPhone_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderPhone_ == null)
                        {
                            pExcelData.orderPhone_ = "";
                        }

                        pExcelData.orderPhone_ = pExcelData.orderPhone_.Replace("'", "");


                        if (ExData_Price != 0)
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_Price];

                            if (tRange.Value2 != null)
                            {// 돈에 , 가 있으면 제거하자.
                                tempString = Convert.ToString(tRange.Value2);
                                tempString = tempString.Replace(",", "");
                                pExcelData.orderSettlePrice_ = Convert.ToInt32(tempString);
                            }
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_BuyDate];
                        if (LQCrawlerInfo_.Channel_Idx_ == 9 || LQCrawlerInfo_.Channel_Idx_ == 14 || LQCrawlerInfo_.Channel_Idx_ == 15 || LQCrawlerInfo_.Channel_Idx_ == 18)
                        {
                            double   temp = Convert.ToDouble(tRange.Value2);
                            DateTime dta  = DateTime.FromOADate(temp);
                            pExcelData.BuyDate_ = dta.ToString("u");
                            pExcelData.BuyDate_ = pExcelData.BuyDate_.Replace("Z", "");
                        }
                        else
                        {
                            pExcelData.BuyDate_ = Convert.ToString(tRange.Value2);
                        }

                        pExcelData.BuyDate_ = pExcelData.BuyDate_.Replace('/', '-');

                        if (ExData_BuyCount != 0)// 구매갯수를 따로 뽑아야 하는 채널에서만
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_BuyCount];
                            pExcelData.BuyCount_ = Convert.ToInt32(tRange.Value2);
                        }

                        SplitDealAndInsertExcelData(pExcelData, comparesitename);
                    }
                    catch (System.Exception ex)
                    {
                        NewLogManager2.Instance.Log(string.Format("엑셀 파싱 에러 : {0}", ex.Message));
                        break;
                        //nCurrentRow++;
                        //continue;
                    }

                    ProcessStateManager.Instance.CurParsingCount_++;
                    nCurrentRow++;
                }

                wb.Close(false, Type.Missing, Type.Missing);
                ap.Quit();

                Marshal.FinalReleaseComObject(ws);
                Marshal.FinalReleaseComObject(wb);
                Marshal.FinalReleaseComObject(ap);
                ws = null;
                wb = null;
                ap = null;
                GC.Collect();
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error override bool Internal_Excel_Parsing - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #23
0
ファイル: BaseChannel.cs プロジェクト: Youkyungjin/Crawler
        // DB 에 데이터 Insert
        public bool DB_InsertData()
        {
            try
            {
                SqlHelper pMySqlDB = new SqlHelper();

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

                ProcessStateManager.Instance.NeedDBProcessCount_ = DBProccess_List_.Count;
                Int32  nTempSeq     = 0;
                Int32  nStartSeq    = 0;
                Int32  nEndSeq      = 0;
                String nTempPinCode = "";

                foreach (var pData in DBProccess_List_)
                {
                    COrderData pOrder = pData.Value;

                    if (pOrder.goodsPassType == "2")
                    {
                        bool bResult = DBInterface.Insert_tblOrder_test(pMySqlDB, pOrder.goodsSeq_, pOrder.channelSeq_
                                                                        , pOrder.channelOrderCode_, pOrder.orderSettlePrice_, 1, pOrder.orderID_, pOrder.orderName_
                                                                        , pOrder.orderPhone_, pOrder.State_, pOrder.ExData_Option_, pOrder.ExData_OptionOriginal_
                                                                        , pOrder.BuyDate_, ref nTempSeq, ref nTempPinCode);
                    }
                    else
                    {
                        bool bResult = DBInterface.Insert_Order_Channel(pMySqlDB, pOrder.goodsSeq_, pOrder.channelSeq_
                                                                        , pOrder.channelOrderCode_, pOrder.orderSettlePrice_, pOrder.orderName_
                                                                        , pOrder.orderPhone_, pOrder.State_, pOrder.BuyDate_, ref nTempSeq, ref nTempPinCode);
                    }

                    if (nTempSeq > 0)
                    {
                        if (pOrder.goodsSendType_ == 2)
                        {
                            QrCodeImageCreate(nTempPinCode, nTempSeq);
                        }
                        else if (pOrder.goodsSendType_ == 3)
                        {
                            BarCodeImageCreate(nTempPinCode, nTempSeq);
                        }

                        if (nStartSeq == 0)
                        {
                            nEndSeq = nStartSeq = nTempSeq;
                        }
                        else
                        {
                            nEndSeq = nTempSeq;
                        }
                    }

                    ProcessStateManager.Instance.CurDBProcessCount_++;
                }

                bool bSMSOn = true;

                if (nStartSeq > 0 && nEndSeq > 0 && bSMSOn == true)
                {
                    DBInterface.Insert_SMS(pMySqlDB, nStartSeq, nEndSeq);
                }

                // 매칭 되지 않은 데이터 넣기
                foreach (var pData in DBProccess_List_Wrong_)
                {
                    COrderData pOrder = pData.Value;

                    bool bResult = DBInterface.Insert_tblOrderWr(pMySqlDB, pOrder.goodsSeq_, pOrder.channelSeq_
                                                                 , pOrder.channelOrderCode_, pOrder.orderSettlePrice_, 1, pOrder.orderID_, pOrder.orderName_
                                                                 , pOrder.orderPhone_, pOrder.State_, pOrder.ExData_GoodsName_, pOrder.ExData_GoodsNick_, pOrder.ExData_Option_, pOrder.ExData_OptionOriginal_
                                                                 , pOrder.BuyDate_, ref nTempSeq);
                }

                pMySqlDB.Close();
                pMySqlDB = null;
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error DB_InsertData {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #24
0
ファイル: SaleToNight.cs プロジェクト: Youkyungjin/Crawler
        protected override bool Internal_Excel_Parsing(ChannelGoodInfo pChannelGoodInfo)
        {
            try
            {
                if (GoodsDownInfo_.ContainsKey(pChannelGoodInfo.Goods_Code_) == false)
                {
                    NewLogManager2.Instance.Log(string.Format("!! 상품 코드 엑셀이 없습니다. - {0}", pChannelGoodInfo.Goods_Code_));
                    return(false);
                }
                string filepath = GoodsDownInfo_[pChannelGoodInfo.Goods_Code_];
                Microsoft.Office.Interop.Excel.Application ap = null;
                Workbook  wb = null;
                Worksheet ws = null;
                HKExcelHelper.GetWorkSheet(filepath, ref ap, ref wb, ref ws);

                Range  tRange          = null;
                string tempString      = "";
                string comparesitename = "";

                Int32 nCurrentRow      = LQCrawlerInfo_.ExData_Start_;
                Int32 ExData_Option    = LQCrawlerInfo_.ExData_Option_;
                Int32 ExData_Coupncode = LQCrawlerInfo_.ExData_Coupncode_;
                Int32 ExData_Buyer     = LQCrawlerInfo_.ExData_Buyer_;
                Int32 ExData_Cancel    = LQCrawlerInfo_.ExData_Cancel_;
                Int32 ExData_Use       = LQCrawlerInfo_.ExData_Use_;
                Int32 ExData_Buyphone  = LQCrawlerInfo_.ExData_Buyphone_;
                Int32 ExData_Price     = LQCrawlerInfo_.ExData_Price_;
                Int32 ExData_BuyDate   = LQCrawlerInfo_.ExData_Buydate_;
                Int32 ExData_BuyCount  = LQCrawlerInfo_.ExData_Count_;
                Int32 ExData_GoodsName = LQCrawlerInfo_.ExData_GoodName_;

                if (nCurrentRow > 0)
                {
                    ProcessStateManager.Instance.NeedParsingCount_ += (ws.UsedRange.Rows.Count - (nCurrentRow - 1));
                }

                while (true)
                {
                    try
                    {
                        tRange          = ws.Cells[nCurrentRow, 1];
                        comparesitename = Convert.ToString(tRange.Value2);

                        tRange = ws.Cells[nCurrentRow, ExData_Option];
                        if (tRange == null)
                        {
                            break;
                        }

                        tempString = tRange.Value2;
                        if (tempString == null)
                        {
                            break;
                        }

                        COrderData pExcelData = new COrderData();
                        pExcelData.channelSeq_            = LQCrawlerInfo_.Channel_Idx_;
                        pExcelData.goodsSeq_              = pChannelGoodInfo.Idx_;
                        pExcelData.ExData_Option_         = tempString;
                        pExcelData.ExData_OptionOriginal_ = tempString;
                        tRange = ws.Cells[nCurrentRow, ExData_GoodsName];
                        pExcelData.ExData_GoodsName_ = tRange.Value2;
                        pExcelData.goodsCode_        = pChannelGoodInfo.Goods_Code_;

                        tRange = ws.Cells[nCurrentRow, ExData_Coupncode];
                        if (tRange == null)
                        {
                            break;
                        }

                        pExcelData.channelOrderCode_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.channelOrderCode_ == null)
                        {
                            break;
                        }
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Replace("'", "");
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Trim();   // 공백 제거

                        tRange = ws.Cells[nCurrentRow, ExData_Buyer];
                        pExcelData.orderName_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderName_ == null)
                        {
                            pExcelData.orderName_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Cancel];
                        pExcelData.ExData_Cancel_ = tRange.Value2;
                        if (pExcelData.ExData_Cancel_ == null)
                        {
                            pExcelData.ExData_Cancel_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Use];
                        pExcelData.ExData_Use_ = tRange.Value2;
                        if (pExcelData.ExData_Use_ == null)
                        {
                            pExcelData.ExData_Use_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Buyphone];
                        pExcelData.orderPhone_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderPhone_ == null)
                        {
                            pExcelData.orderPhone_ = "";
                        }

                        pExcelData.orderPhone_ = pExcelData.orderPhone_.Replace("'", "");
                        pExcelData.orderPhone_ = Regex.Replace(pExcelData.orderPhone_, @"^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?([0-9]{3,4})-?([0-9]{4})$", @"$1-$2-$3");

                        if (ExData_Price != 0)
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_Price];

                            if (tRange.Value2 != null)
                            {// 돈에 , 가 있으면 제거하자.
                                tempString = Convert.ToString(tRange.Value2);
                                tempString = tempString.Replace(",", "");
                                pExcelData.orderSettlePrice_ = Convert.ToInt32(tempString);
                            }
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_BuyDate];

                        pExcelData.BuyDate_ = Convert.ToString(tRange.Value2);
                        pExcelData.BuyDate_ = pExcelData.BuyDate_.Substring(0, pExcelData.BuyDate_.Length - 2);
                        if (ExData_BuyCount != 0)// 구매갯수를 따로 뽑아야 하는 채널에서만
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_BuyCount];
                            pExcelData.BuyCount_ = Convert.ToInt32(tRange.Value2);
                        }

                        SplitDealAndInsertExcelData(pExcelData, comparesitename);
                    }
                    catch (System.Exception ex)
                    {
                        NewLogManager2.Instance.Log(string.Format("엑셀 파싱 에러 : {0}", ex.Message));
                        break;
                        //nCurrentRow++;
                        //continue;
                    }

                    ProcessStateManager.Instance.CurParsingCount_++;
                    nCurrentRow++;
                }

                wb.Close(false, Type.Missing, Type.Missing);
                ap.Quit();

                Marshal.FinalReleaseComObject(ws);
                Marshal.FinalReleaseComObject(wb);
                Marshal.FinalReleaseComObject(ap);
                ws = null;
                wb = null;
                ap = null;
                GC.Collect();
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error protected override bool Internal_Excel_Parsing - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
コード例 #25
0
ファイル: BaseChannel.cs プロジェクト: Youkyungjin/Crawler
 // 엑셀 데이터 리스트에 넣기
 protected abstract Int32 SplitDealAndInsertExcelData(COrderData pExcelData, string comparesitename = "");
コード例 #26
0
        protected override bool Internal_Excel_Parsing(ChannelGoodInfo pChannelGoodInfo)
        {
            try
            {
                if (GoodsDownInfo_.ContainsKey(pChannelGoodInfo.Goods_Code_) == false)
                {
                    NewLogManager2.Instance.Log(string.Format("!! 상품 코드 엑셀이 없습니다. - {0}", pChannelGoodInfo.Goods_Code_));
                    return(false);
                }
                string filepath = GoodsDownInfo_[pChannelGoodInfo.Goods_Code_];
                Microsoft.Office.Interop.Excel.Application ap = null;
                Workbook  wb = null;
                Worksheet ws = null;
                HKExcelHelper.GetWorkSheet(filepath, ref ap, ref wb, ref ws);

                Range  tRange     = null;
                string tempString = "";

                Int32 nCurrentRow      = LQCrawlerInfo_.ExData_Start_;
                Int32 ExData_Option    = LQCrawlerInfo_.ExData_Option_;
                Int32 ExData_Coupncode = LQCrawlerInfo_.ExData_Coupncode_;
                Int32 ExData_Buyer     = LQCrawlerInfo_.ExData_Buyer_;
                Int32 ExData_Cancel    = LQCrawlerInfo_.ExData_Cancel_;
                Int32 ExData_Use       = LQCrawlerInfo_.ExData_Use_;
                Int32 ExData_Buyphone  = LQCrawlerInfo_.ExData_Buyphone_;
                Int32 ExData_Price     = LQCrawlerInfo_.ExData_Price_;
                Int32 ExData_BuyDate   = LQCrawlerInfo_.ExData_Buydate_;
                Int32 ExData_BuyCount  = LQCrawlerInfo_.ExData_Count_;
                Int32 ExData_GoodsName = LQCrawlerInfo_.ExData_GoodName_;

                if (nCurrentRow > 0)
                {
                    ProcessStateManager.Instance.NeedParsingCount_ += (ws.UsedRange.Rows.Count - (nCurrentRow - 1));
                }

                string beforeOrderName  = "";   // 이전 주문자명
                string beforeOrderPhone = "";   // 이전 주문 전화번호
                string beforeOrderDate  = "";   // 이전 주문 날짜
                while (true)
                {
                    try
                    {
                        tRange = ws.Cells[nCurrentRow, ExData_Option];
                        if (tRange == null)
                        {
                            break;
                        }

                        tempString = tRange.Value2;
                        if (tempString == null)
                        {
                            break;
                        }

                        COrderData pExcelData = new COrderData();
                        pExcelData.channelSeq_            = LQCrawlerInfo_.Channel_Idx_; // 채널 시퀀스
                        pExcelData.goodsSeq_              = -1;                          // 상품 시퀀스
                        pExcelData.ExData_Option_         = tempString;                  // 옵션명
                        pExcelData.ExData_OptionOriginal_ = tempString;                  // 원래 옵션명

                        tRange = ws.Cells[nCurrentRow, ExData_GoodsName];
                        pExcelData.ExData_GoodsName_ = tRange.Value2;
                        pExcelData.ExData_GoodsNick_ = Regex.Replace(pExcelData.ExData_GoodsName_, @"[^a-zA-Z0-9가-힣]", "");

                        tRange = ws.Cells[nCurrentRow, ExData_Coupncode];
                        if (tRange == null)
                        {
                            break;
                        }

                        pExcelData.channelOrderCode_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.channelOrderCode_ == null)
                        {
                            break;
                        }
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Replace("'", "");
                        pExcelData.channelOrderCode_ = pExcelData.channelOrderCode_.Trim();

                        tRange = ws.Cells[nCurrentRow, ExData_Buyer];
                        pExcelData.orderName_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderName_ == null)
                        {
                            pExcelData.orderName_ = beforeOrderName;
                        }
                        else
                        {
                            beforeOrderName = pExcelData.orderName_;
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Cancel];
                        pExcelData.ExData_Cancel_ = tRange.Value2;
                        if (pExcelData.ExData_Cancel_ == null)
                        {
                            pExcelData.ExData_Cancel_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Use];
                        pExcelData.ExData_Use_ = tRange.Value2;
                        if (pExcelData.ExData_Use_ == null)
                        {
                            pExcelData.ExData_Use_ = "";
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_Buyphone];
                        pExcelData.orderPhone_ = Convert.ToString(tRange.Value2);
                        if (pExcelData.orderPhone_ == null)
                        {
                            pExcelData.orderPhone_ = beforeOrderPhone;
                        }
                        else
                        {
                            beforeOrderPhone = pExcelData.orderPhone_;
                        }

                        pExcelData.orderPhone_ = pExcelData.orderPhone_.Replace("'", "");

                        if (ExData_Price != 0)
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_Price];

                            if (tRange.Value2 != null)
                            {
                                tempString = Convert.ToString(tRange.Value2);
                                tempString = tempString.Replace(",", "");
                                pExcelData.orderSettlePrice_ = Convert.ToInt32(tempString);
                            }
                        }

                        tRange = ws.Cells[nCurrentRow, ExData_BuyDate];

                        if (tRange.Value2 == null)
                        {
                            pExcelData.BuyDate_ = beforeOrderDate;
                        }
                        else
                        {
                            double   temp = Convert.ToDouble(tRange.Value2);
                            DateTime dta  = DateTime.FromOADate(temp);
                            pExcelData.BuyDate_ = dta.ToString("u");
                            pExcelData.BuyDate_ = pExcelData.BuyDate_.Replace("Z", "");
                            beforeOrderDate     = pExcelData.BuyDate_;
                        }

                        if (ExData_BuyCount != 0)
                        {
                            tRange = ws.Cells[nCurrentRow, ExData_BuyCount];
                            pExcelData.BuyCount_ = Convert.ToInt32(tRange.Value2);
                        }

                        SplitDealAndInsertExcelData(pExcelData);
                    }
                    catch (System.Exception ex)
                    {
                        NewLogManager2.Instance.Log(string.Format("엑셀 파싱 에러 : {0}", ex.Message));
                        break;
                        //nCurrentRow++;
                        //continue;
                    }

                    ProcessStateManager.Instance.CurParsingCount_++;
                    nCurrentRow++;
                }

                wb.Close(false, Type.Missing, Type.Missing);
                ap.Quit();

                Marshal.FinalReleaseComObject(ws);
                Marshal.FinalReleaseComObject(wb);
                Marshal.FinalReleaseComObject(ap);
                ws = null;
                wb = null;
                ap = null;
                GC.Collect();
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error public override bool Internal_Excel_Parsing - {0}", ex.Message));
                return(false);
            }

            return(true);
        }