Ejemplo n.º 1
0
        public static bool InsertCrawlerMonitorInfo(SqlHelper dbHelper, string xIpAddress, Int32 xPort, ref Int32 MonitorSeq)
        {
            MonitorSeq = 0;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xIpAddress", xIpAddress);
                argdic.Add("xPort", xPort.ToString());

                MySqlDataReader datareader = dbHelper.call_proc("spNewInsertCrawlerMonitor", argdic);
                while (datareader.Read())
                {
                    MonitorSeq = Convert.ToInt32(datareader["MonitorSeq"]);
                    break;
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                return false;
            }

            if (MonitorSeq == 0)
                return false;

            return true;
        }
Ejemplo n.º 2
0
        public static bool InsertCrawlerRestartLog(SqlHelper dbHelper, string xlogMessage, Int32 xCrawlerSeq, Int32 xCrawlerMonitorSeq
            , Int32 xChannelSeq, Int32 xAuthoritySeq, string xIssueDate)
        {
            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xlogMessage", xlogMessage);
                argdic.Add("xCrawlerSeq", xCrawlerSeq.ToString());
                argdic.Add("xCrawlerMonitorSeq", xCrawlerMonitorSeq.ToString());
                argdic.Add("xChannelSeq", xChannelSeq.ToString());
                argdic.Add("xAuthoritySeq", xAuthoritySeq.ToString());
                argdic.Add("xIssueDate", xIssueDate);

                MySqlDataReader datareader = dbHelper.call_proc("spNewCrawlerInsertLog", argdic);

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 3
0
        public static bool UpdateCrawlerMonitorInfo(SqlHelper dbHelper, Int32 xMonitorSeq, string xIpAddress, Int32 xPort, string xCrawlerState
            , ref Int32 Result, ref Int32 ChannelSeq, ref Int32 AuthoritySeq, ref Int32 Mode, ref Int32 CrawlerSeq)
        {
            Result = 0;
            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xMonitorSeq", xMonitorSeq.ToString());
                argdic.Add("xIpAddress", xIpAddress);
                argdic.Add("xPort", xPort.ToString());
                argdic.Add("xCrawlerState", xCrawlerState);

                MySqlDataReader datareader = dbHelper.call_proc("spNewUpdateCrawlerMonitor", argdic);

                while (datareader.Read())
                {
                    Result = Convert.ToInt32(datareader["RESULT"]);
                    if (Result == 0)
                    {
                        break;
                    }

                    if (datareader["AuthoritySeq"] != DBNull.Value)
                        AuthoritySeq = Convert.ToInt32(datareader["AuthoritySeq"]);
                    if (datareader["ChannelSeq"] != DBNull.Value)
                        ChannelSeq = Convert.ToInt32(datareader["ChannelSeq"]);
                    if (datareader["Mode"] != DBNull.Value)
                        Mode = Convert.ToInt32(datareader["Mode"]);
                    if (datareader["CrawlerSeq"] != DBNull.Value)
                        CrawlerSeq = Convert.ToInt32(datareader["CrawlerSeq"]);

                    break;
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 4
0
        // 쿠폰 정보 입력.
        public static bool Insert_tblWrongOrder(SqlHelper dbHelper, Int32 xchannelSeq, string xchannelOrderCode, float xorderSettlePrice
            , string xorderName, string xorderOptionName, Int32 xorderCount, string xorderPhone, string xstate)
        {
            bool bResult = true;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xchannelSeq", xchannelSeq);
                argdic.Add("xchannelOrderCode", xchannelOrderCode);
                argdic.Add("xorderSettlePrice", xorderSettlePrice);
                argdic.Add("xorderName", xorderName);
                argdic.Add("xorderOptionName", xorderOptionName);
                argdic.Add("xorderPhone", xorderPhone);
                argdic.Add("xorderCount", xorderCount);
                argdic.Add("xstate", xstate);

                MySqlDataReader datareader = dbHelper.call_proc("sp_insert_tblWrongOrder", argdic);
                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 5
0
        public static bool Insert_tblOrder(SqlHelper dbHelper, Int32 GoodsSeq, Int32 channelSeq, string channelCode, float OrderPrice
            , Int32 OrderCount, string UserId, string UserName, string UserPhone, string State, string goodsNickName, string goodsOrgName
            , string RegDate, ref Int32 OrderSeq)
        {
            bool bResult = true;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xchannelSeq", channelSeq);
                argdic.Add("xchannelCode", channelCode);
                argdic.Add("xOrderPrice", OrderPrice);
                argdic.Add("xOrderCount", OrderCount);
                argdic.Add("xUserId", UserId);
                argdic.Add("xUserName", UserName);
                argdic.Add("xUserPhone", UserPhone);
                argdic.Add("xState", State);
                argdic.Add("xGoodsSeq", GoodsSeq);
                argdic.Add("xgoodsNickName", goodsNickName);
                argdic.Add("xgoodsOrgName", goodsOrgName);
                argdic.Add("xRegDate", RegDate);

                MySqlDataReader datareader = dbHelper.call_proc("sp_insert_chOrder", argdic);

                string strSeq = "";
                while (datareader.Read())
                {
                    strSeq = Convert.ToString(datareader["OrderSeq"]);
                    OrderSeq = Convert.ToInt32(strSeq);
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 6
0
        public static bool Insert_SMS(SqlHelper dbHelper, Int32 xSOrderSeq, Int32 xEOrderSeq)
        {
            bool bResult = true;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xSOrderSeq", xSOrderSeq);
                argdic.Add("xEOrderSeq", xEOrderSeq);

                MySqlDataReader datareader = dbHelper.call_proc("sp_insert_Sms", argdic);

                //string strSeq = "";
                //while (datareader.Read())
                //{
                //    strSeq = Convert.ToString(datareader["OrderSeq"]);
                //}

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 7
0
        // DB 에 처리
        public void Process_DB(SqlHelper MySqlDB)
        {
            Int32 nTempSeq = 0;
            Int32 nStartSeq = 0;
            Int32 nEndSeq = 0;
            string emptyCheckCode = "";

            // 매칭이 정상적인 데이터 넣기
             Dictionary<string, tblOrderData> pOrderList = OrderManager.Instance.GetOrderList();
            foreach (var pData in pOrderList)
            {
                tblOrderData pOrder = pData.Value;

                if (pOrder.NeedDBProc_ == tblOrderData.NeedDBProc.Insert)
                {
                     bool bResult = DBFunctions.Insert_tblOrder(MySqlDB, 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);
                    LogManager.Instance.Log(string.Format("DB Insert {0}", pOrder.channelOrderCode_));

                    if (bResult == true)
                    {
                        CrawlerManager.Instance.GetResultData().Inserted_++;
                    }
                    else
                    {
                        CrawlerManager.Instance.GetResultData().ErrorCount_++;
                        CrawlerManager.Instance.GetResultData().TotalErrorCount_++;
                    }

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

                    if (pOrder.channelSeq_ == 11 || pOrder.channelSeq_ == 12 || pOrder.channelSeq_ == 14 || pOrder.authoritySeq_ == 26)
                    {

                        int goodsSeq = 0;
                        string cpcode = "";
                        string goodscode = "";

                        goodsSeq  = pOrder.goodsSeq_;
                        cpcode    = pOrder.channelOrderCode_;
                        goodscode = pOrder.goodsCode_;

                        if (cpcode.Contains(emptyCheckCode) != true || emptyCheckCode =="")
                        {//이베이(옥션,지마켓),굿바이셀리는 선 사용처리
                            First_UseData(goodsSeq, cpcode, goodscode);
                        }
                        string[] cpcodeArray = cpcode.Split('_');
                        emptyCheckCode = cpcodeArray[0];
                    }
                }
                else if (pOrder.NeedDBProc_ == tblOrderData.NeedDBProc.Update)
                {

                    bool bResult = DBFunctions.Update_OrderInfo(MySqlDB, (Int32)pOrder.seq_, pOrder.State_);
                    LogManager.Instance.Log(string.Format("DB Update {0}", pOrder.channelOrderCode_));
                    if (bResult == true)
                    {
                        CrawlerManager.Instance.GetResultData().Updated_++;
                    }
                    else
                    {
                        CrawlerManager.Instance.GetResultData().ErrorCount_++;
                        CrawlerManager.Instance.GetResultData().TotalErrorCount_++;
                    }
                }
            }

            bool bSMSOn = true;

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

            // 매칭이 비정상적인 데이터 넣기
            Dictionary<string, tblOrderData> pWrongOrderList = OrderManager.Instance.GetWrongOrderList();
            foreach (var pData in pWrongOrderList)
            {
                tblOrderData pOrder = pData.Value;
                if (pOrder.NeedDBProc_ == tblOrderData.NeedDBProc.Insert)
                {
                    bool bResult = DBFunctions.Insert_tblOrder(MySqlDB, 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);
                    LogManager.Instance.Log(string.Format("DB Wrong Insert {0}", pOrder.channelOrderCode_));
                }

            }
        }
Ejemplo n.º 8
0
        public static bool Select_tblOrderWr(SqlHelper dbHelper, Int32 xchannelSeq)
        {
            bool bResult = true;

            try
            {
                // 2014.06.05
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xChannelIdx", xchannelSeq);

                MySqlDataReader datareader = dbHelper.call_proc("sp_select_OrderWrInfo", argdic);

                while (datareader.Read())
                {
                    tblOrderData pOrderData = new tblOrderData();
                    pOrderData.channelOrderCode_ = Convert.ToString(datareader["channelOrderCode"]);
                    pOrderData.NeedDBProc_ = tblOrderData.NeedDBProc.None;
                    OrderManager.Instance.AddWrongData(pOrderData);
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 9
0
 // 자신이 담당할 상품 Load
 bool DB_GetGoodsInfo(SqlHelper pDBHelper)
 {
     bool bResult = DBInterface.GetGoodsTableWithUID(pDBHelper, CINIManager.Instance.channelidx_, CINIManager.Instance.authorityseq_
         , CINIManager.Instance.UID_, ref GoodsInfoList_);
     return bResult;
 }
Ejemplo n.º 10
0
 // DB 에서 채널 정보 로드
 bool DB_GetChannelInfo(SqlHelper pDBHelper)
 {
     //bool bResult = DBInterface.GetCrawlerInfo(pDBHelper, CINIManager.Instance.channelidx_, CINIManager.Instance.partneridx_, ref LQCrawlerInfo_);
     bool bResult = DBInterface.GetCrawlerInfoNew(pDBHelper, CINIManager.Instance.channelidx_, CINIManager.Instance.partneridx_
         , CINIManager.Instance.authorityseq_, ref LQCrawlerInfo_);
     return bResult;
 }
Ejemplo n.º 11
0
        // 주문정보 잘못된것 정정하는 프로시저
        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;
        }
Ejemplo n.º 12
0
        // 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;
        }
Ejemplo n.º 13
0
        // DB 에서 정보 로드 하기
        public bool DB_GetInfos()
        {
            bool bResult = true;

            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_);

                bResult = DB_GetChannelInfo(pMySqlDB);

                if (bResult)
                    ProcessStateManager.Instance.ChannelName_ = LQCrawlerInfo_.ChannelName_;

                if (bResult)
                    bResult = DB_GetStateTable(pMySqlDB);

                if (bResult)
                    bResult = DB_GetGoodsInfo(pMySqlDB);

                if (bResult)
                    bResult = DB_SelectData(pMySqlDB);

                pMySqlDB.Close();
                pMySqlDB = null;

            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error public bool DB_GetInfos() {0}", ex.Message));
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 14
0
        // DB에는 있으나 엑셀에서 찾지 못한것들 처리
        public virtual bool Process_RefundData(SqlHelper MySqlDB)
        {
            Dictionary<string, tblOrderData> pOrderList = OrderManager.Instance.GetOrderList();
            Dictionary<Int32, ChannelGoodInfo> pInfoList = CrawlerManager.Instance.GetGoodsInfo();
            foreach (var pData in pOrderList)
            {
                tblOrderData p = pData.Value;

                if (p.bFindInExcel_ == false)
                {
                    if (pInfoList.ContainsKey(p.goodsSeq_) == true)
                    {
                        if (p.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_BUY])
                        {
                        // bool bResult = DBFunctions.Update_CancelOrderInfo(MySqlDB, (Int32)p.seq_, p.channelOrderCode_);
                        }
                        //else if (p.State_ == DealStateManager.Instance.StateString_[(Int32)DealStateEnum.FINISH_RESERVED])
                        //{
                        //    p.State_ = DealStateManager.Instance.StateString_[(Int32)DealStateEnum.BLACK];
                        //}
                        else
                        {
                            continue;
                        }

                        //p.NeedDBProc_ = tblOrderData.NeedDBProc.Update;
                    }
                }
            }

            return true;
        }
Ejemplo n.º 15
0
        // 각각의 상태 정보 로드
        public static bool SelectStateTable(SqlHelper dbHelper)
        {
            DealStateManager.Instance.Init();

            bool bResult = true;

            try
            {
                MySqlDataReader datareader = dbHelper.call_proc("sp_select_StateTable", null);

                while (datareader.Read())
                {
                    Int32 nStateType = Convert.ToInt32(datareader["StateType"]);
                    string strStateName = Convert.ToString(datareader["StateName"]);
                    string strExplain = Convert.ToString(datareader["Explain"]);

                    DealStateManager.Instance.Add(nStateType, strStateName, strExplain);
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 16
0
        // DB에서 사용처리 해야하는 테이블 로드
        public static bool Select_tblOrder(SqlHelper dbHelper, Int32 xchannelSeq)
        {
            bool bResult = true;

            try
            {
                // 2014.06.05
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xChannelIdx", xchannelSeq);

                MySqlDataReader datareader = dbHelper.call_proc("sp_select_OrderInfo", argdic);

                while (datareader.Read())
                {
                    tblOrderData pOrderData = new tblOrderData();
                    pOrderData.NeedDBProc_ = tblOrderData.NeedDBProc.None;
                    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.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"]);

                    OrderManager.Instance.AddOrderData(pOrderData);
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 17
0
 // 자신이 담당할 상품 Load
 bool DB_GetStateTable(SqlHelper pDBHelper)
 {
     bool bResult = DBInterface.SelectStateTable(pDBHelper);
     return bResult;
 }
Ejemplo n.º 18
0
        public static bool Update_OrderInfo(SqlHelper dbHelper, Int32 xOrderSeq, string xState)
        {
            bool bResult = true;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xOrderSeq", xOrderSeq);
                argdic.Add("xState", xState);

                MySqlDataReader datareader = dbHelper.call_proc("sp_update_OrderInfo", argdic);

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 19
0
        // 기존 주문 내역 Load
        bool DB_SelectData(SqlHelper pDBHelper)
        {
            bool bResult = true;
            string eDate = "";
            string sDate = "";

            string DateFormat_ = "{0}-{1}-{2} {3}:{4}:{5}";

            DBSelected_List_.Clear();
            DateTime beforeData = dtnow.AddDays(-6);  // 이지웰 건수가 많으면 데이터를 못들고옴, 10일전 건수만 들고오게 함
            //yourdate.ToString("yyyyMMddHHmmss");

            //eDate = dtnow.ToString("yyyy-MM-dd 23:59:59");
            //sDate = beforeData.ToString("yyyy-MM-dd 00:00:00");
            //eDate = string.Format(DateFormat_, dtnow.Year, dtnow.Month, dtnow.Day, "23", "59", "59");
            //sData = string.Format(DateFormat_, beforeData.Year, beforeData.Month, beforeData.Day, "00", "00", "00");

            bResult = DBInterface.Select_Order_List(pDBHelper, CINIManager.Instance.channelidx_, CINIManager.Instance.authorityseq_, CINIManager.Instance.UID_, ref DBSelected_List_);

            //foreach (var pData in GoodsInfoList_)
            //{
            //    bResult = DBInterface.Select_tblOrder_With_UID(pDBHelper, CINIManager.Instance.channelidx_, pData.Value.Idx_ , ref DBSelected_List_);

                // bResult = DBInterface.Select_tblOrder_With_UID(pDBHelper, CINIManager.Instance.channelidx_, pData.Value.Idx_, sDate, eDate, ref DBSelected_List_);
            //}

            return bResult;
        }
Ejemplo n.º 20
0
        // DB 에서 상품 코드 읽어오기
        public static bool GetGoodsTable(SqlHelper dbHelper, Int32 nChannelIdx, Int32 nAuthorityIdx)
        {
            Dictionary<Int32, ChannelGoodInfo> pInfoList = CrawlerManager.Instance.GetGoodsInfo();
            pInfoList.Clear();

            bool bResult = true;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xChannelIdx", nChannelIdx.ToString());
                argdic.Add("xAuthorityIdx", nAuthorityIdx.ToString());

                // 2014.06.05
                MySqlDataReader datareader = dbHelper.call_proc("sp_select_GoodsInfo", argdic);
                string availableData = "";
                while (datareader.Read())
                {
                    ChannelGoodInfo pGoodInfo = new ChannelGoodInfo();

                    pGoodInfo.Idx_ = Convert.ToInt32(datareader["seq"]);
                    pGoodInfo.Goods_Code_ = Convert.ToString(datareader["ChGoodsCode"]);
                    pGoodInfo.GoodsName_ = Convert.ToString(datareader["GoodsName"]);
                    pGoodInfo.sDate_ = Convert.ToString(datareader["GoodsSdate"]);
                    pGoodInfo.eDateFormat_ = Convert.ToString(datareader["GoodsEdateFormat"]);
                    availableData = Convert.ToString(datareader["AvailableDate"]);
                    pGoodInfo.OptionName_ = Convert.ToString(datareader["GoodsOptionName"]);
                    pGoodInfo.OptionNickName_ = Convert.ToString(datareader["GoodsNickName"]);
                    pGoodInfo.GoodsAttrType_ = Convert.ToInt32(datareader["GoodsAttrType"]);

                    if (string.IsNullOrEmpty(pGoodInfo.Goods_Code_) == true)
                    {
                        string LogMessage = string.Format("bool GetGoodsTable 상품코드가 지정되어 있지 않아서 상품은 건너 뜁니다.{0}/{1}"
                            , pGoodInfo.Goods_Code_, pGoodInfo.GoodsName_);
                        LogManager.Instance.Log(LogMessage);
                        continue;
                    }

                    if (string.IsNullOrEmpty(pGoodInfo.OptionNickName_) == true)
                    {
                        string LogMessage = string.Format("bool GetGoodsTable 상품 옵션명이 지정되지 않아서 이 상품은 건너 뜁니다.{0}/{1}"
                            , pGoodInfo.Goods_Code_, pGoodInfo.OptionNickName_);
                        LogManager.Instance.Log(LogMessage);
                        continue;
                    }

                    if (string.IsNullOrEmpty(availableData) == false)
                    {
                        if (Regex.IsMatch(availableData, @"^(19|20)\d{2}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[0-1])$") == true)
                        {
                            pGoodInfo.availableDateTime_ = Convert.ToDateTime(availableData);
                            pGoodInfo.Expired_ = true;
                        }
                    }
                    pInfoList.Add(pGoodInfo.Idx_, pGoodInfo);

                }
                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 21
0
        // 크롤링 정보 로드 하기
        public static bool GetCrawlerInfo(SqlHelper dbHelper, Int32 nChannelIdx, Int32 PartnerIdx)
        {
            bool bResult = false;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xChannelIdx", nChannelIdx.ToString());
                argdic.Add("xPartnerIdx", PartnerIdx.ToString());

                MySqlDataReader datareader = dbHelper.call_proc("sp_select_Crawler_Info", argdic);
                while (datareader.Read())
                {
                    bResult = true;

                    LQCrawlerInfo pInfo = new LQCrawlerInfo();
                    pInfo.nIdx_ = Convert.ToInt32(datareader["idx"]);
                    pInfo.Channel_Idx_ = Convert.ToInt32(datareader["Channel_Idx"]);
                    pInfo.ChannelName_ = Convert.ToString(datareader["AuthorityName"]);
                    pInfo.AuthoritySeq_ = Convert.ToInt32(datareader["AuthoritySeq"]);
                    pInfo.PartnerSeq_ = Convert.ToInt32(datareader["PartnerSeq"]);
                    pInfo.PartnerName_ = Convert.ToString(datareader["PartnerName"]);

                    pInfo.MainUrl_ = Convert.ToString(datareader["MainUrl"]);         // 메인 URL
                    pInfo.LoginIDTAG_ = Convert.ToString(datareader["LoginIDTAG"]);
                    pInfo.LoginPWTAG_ = Convert.ToString(datareader["LoginPWTAG"]);
                    pInfo.LoginUrl_ = Convert.ToString(datareader["LoginUrl"]);
                    pInfo.LoginParam_ = Convert.ToString(datareader["LoginParam"]);      // 로그인 셋팅값
                    pInfo.LoginID_ = Convert.ToString(datareader["LoginID"]);         // 로그인 아이디
                    pInfo.LoginPW_ = Convert.ToString(datareader["LoginPW"]);         // 로그인 암호
                    pInfo.LoginMethod_ = Convert.ToString(datareader["LoginMethod"]);     // 로그인 방식
                    pInfo.LoginEvent_ = Convert.ToString(datareader["LoginEvent"]);      // 로그인 버튼 이벤트
                    pInfo.LoginCheck_ = Convert.ToString(datareader["LoginCheck"]);
                    pInfo.LoginType_ = Convert.ToChar(datareader["LoginType"]);
                    pInfo.ExcelDownUrl_ = Convert.ToString(datareader["ExcelDownUrl"]);    // 엑셀 다운로드 URL
                    pInfo.ExcelDownParameter_ = Convert.ToString(datareader["ExcelDownParameter"]);
                    pInfo.ExcelDownMethod_ = Convert.ToString(datareader["ExcelDownMethod"]);    // 엑셀 다운로드 방식
                    pInfo.ExcelDownRule_ = Convert.ToString(datareader["ExcelDownRule"]);

                    pInfo.UseGoodsUrl_ = Convert.ToString(datareader["UseGoodsUrl"]);
                    pInfo.UseGoodsParam_ = Convert.ToString(datareader["UseGoodsParam"]);
                    pInfo.UseGoodsCheck_ = Convert.ToString(datareader["UseGoodsCheck"]);
                    pInfo.UseGoodsRule_ = Convert.ToString(datareader["UseGoodsRule"]);

                    pInfo.UseUserUrl_ = Convert.ToString(datareader["UseUserUrl"]);
                    pInfo.UseUserParam_ = Convert.ToString(datareader["UseUserParam"]);
                    pInfo.UseUserCheck_ = Convert.ToString(datareader["UseUserCheck"]);

                    pInfo.NUseGoodsUrl_ = Convert.ToString(datareader["NUseGoodsUrl"]);
                    pInfo.NUseGoodsParam_ = Convert.ToString(datareader["NUseGoodsParam"]);
                    pInfo.NUseGoodsCheck_ = Convert.ToString(datareader["NUseGoodsCheck"]);
                    pInfo.NUseGoodsRule_ = Convert.ToString(datareader["NUseGoodsRule"]);

                    pInfo.NUseUserUrl_ = Convert.ToString(datareader["NUseUserUrl"]);
                    pInfo.NUseUserParam_ = Convert.ToString(datareader["NUseUserParam"]);
                    pInfo.NUseUserCheck_ = Convert.ToString(datareader["NUseUserCheck"]);

                    pInfo.RUseUserUrl_ = Convert.ToString(datareader["RUseUserUrl"]);
                    pInfo.RUseUserParam_ = Convert.ToString(datareader["RUseUserParam"]);
                    pInfo.RUseUserCheck_ = Convert.ToString(datareader["RUseUserCheck"]);

                    pInfo.ExData_Start_ = Convert.ToInt32(datareader["ExData_Start"]);
                    pInfo.ExData_Coupncode_ = Convert.ToInt32(datareader["ExData_Coupncode"]);
                    pInfo.ExData_Buydate_ = Convert.ToInt32(datareader["ExData_Buydate"]);
                    pInfo.ExData_Option_ = Convert.ToInt32(datareader["ExData_Option"]);
                    pInfo.ExData_Cancel_ = Convert.ToInt32(datareader["ExData_Cancel"]);
                    pInfo.ExData_Count_ = Convert.ToInt32(datareader["ExData_Count"]);
                    pInfo.ExData_Use_ = Convert.ToInt32(datareader["ExData_Use"]);
                    pInfo.ExData_Buyer_ = Convert.ToInt32(datareader["ExData_Buyer"]);
                    pInfo.ExData_Buyphone_ = Convert.ToInt32(datareader["ExData_Buyphone"]);
                    pInfo.ExData_Price_ = Convert.ToInt32(datareader["ExData_Price"]);
                    pInfo.ExData_UseCheck_ = Convert.ToString(datareader["ExData_UseCheck"]);
                    pInfo.ExData_CancelCheck_ = Convert.ToString(datareader["ExData_CancelCheck"]);

                    CrawlerManager.Instance.SetCrawlerInfo(pInfo);
                    break;
                }
                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                LogManager.Instance.Log(ex.Message);
                bResult = false;
            }

            return bResult;
        }
Ejemplo n.º 22
0
 public override bool Process_RefundData(SqlHelper MySqlDB)
 {
     return true;
 }
Ejemplo n.º 23
0
        // 크롤링
        public virtual void Crawling(BackgroundWorker pWorker)
        {
            LogManager.Instance.Log(string.Format("<<< 크롤링 시작 {0}>>>", CrawlerManager.Instance.CrawlingCount()));
            pWorker.ReportProgress(1);
            bool bResult = true;

            // DB 접속
            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_);

            // DB에서 채널 정보 로드하기
            pWorker.ReportProgress(2);
            //bResult = DBFunctions.GetCrawlerInfo_Authority(pMySqlDB, CrawlerInfoManager.Instance.channelidx_, CrawlerInfoManager.Instance.partneridx_);
            bResult = DBFunctions.GetCrawlerInfo_Authority(pMySqlDB, CrawlerInfoManager.Instance.channelidx_, CrawlerInfoManager.Instance.partneridx_, CrawlerInfoManager.Instance.authorityseq_);
            if (bResult == false)
            {
                pWorker.ReportProgress(9);
                OrderManager.Instance.Init();
                LogManager.Instance.Log("<<< 크롤링 실패 : GetCrawlerInfo >>>");
                return;
            }
            // 주문별 상태 로드하기
            bResult = DBFunctions.SelectStateTable(pMySqlDB);
            if (bResult == false)
            {
                pWorker.ReportProgress(9);
                OrderManager.Instance.Init();
                LogManager.Instance.Log("<<< 크롤링 실패 : SelectStateTable >>>");
                return;
            }

            // DB에서 현재 가지고 있는 상품 정보 로드하기
            pWorker.ReportProgress(3);
            bResult = DBFunctions.GetGoodsTable(pMySqlDB, CrawlerInfoManager.Instance.channelseq_, CrawlerInfoManager.Instance.authorityseq_);
            if (bResult == false)
            {
                pWorker.ReportProgress(9);
                OrderManager.Instance.Init();
                LogManager.Instance.Log("<<< 크롤링 실패 : GetGoodsTable >>>");
                return;
            }

            // DB에서 현재 Insert된 상품 정보 로드 하기
            pWorker.ReportProgress(4);
            OrderManager.Instance.Init();
            bResult = DBFunctions.Select_tblOrder(pMySqlDB, CrawlerInfoManager.Instance.channelseq_);
            bResult = DBFunctions.Select_tblOrderWr(pMySqlDB, CrawlerInfoManager.Instance.channelseq_);

            if (bResult == false)
            {
                pWorker.ReportProgress(9);
                OrderManager.Instance.Init();
                LogManager.Instance.Log("<<< 크롤링 실패 : Select_tblOrder >>>");
                return;
            }

            CrawlerManager.Instance.GetResultData().DBSelected_ = OrderManager.Instance.GetOrderList().Count;

            // 채널 로그인
            pWorker.ReportProgress(5);
            bResult = Login();

            // 채널에서 상품 판매 정보 다운로드 // 데이터 가공
            pWorker.ReportProgress(6);
            bResult = DownloadExcelAndDataMake();
            if (bResult == false)
            {
                pWorker.ReportProgress(9);
                OrderManager.Instance.Init();
                LogManager.Instance.Log("<<< 크롤링 실패 >>>");
                return;
            }
            bResult = Combine_DB_And_Excel(false);
            //bResult = Process_RefundData(pMySqlDB);  // 당일 취소건에 대한것. 일단 막아두자.

            bResult = Process_ExpiredData();

            // 채널에 상품처리// 채널에 취소처리  // 채널에 반품처리
            pWorker.ReportProgress(7);
            bResult = Process_Use_Cancel_Refund();

            // 다운로드 받은파일 삭제
            //deletedownloadfile();

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

            // DB 에 Insert or Update
            pWorker.ReportProgress(8);
            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_);
            Process_DB(pMySqlDB2);

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

            // 완료
            CrawlerManager.Instance.AddCrawlingCount();
            pWorker.ReportProgress(9);
            LogManager.Instance.Log("<<< 크롤링 완료 >>>");
        }