Exemplo n.º 1
0
        protected override void Finish()
        {
            DebugLog("finish");
            SetEventHandler(ScrapState.COMPLETE);
            // TODO:How do the data insert when login error?
            if (!(bool)GetData(0))
            {
                InfoLog("login error");
                return;
            }

            DebugLog("INSERT");
            DebugLog(ID);
            DebugLog(PW);
            DebugLog(PARAM[0]);
            //It delete data of table in database.
            try
            {
                List <long> IndexList = FactoryDao.GetScrappingDataDao().GetIndex(PARAM[0], "006");
                if (IndexList != null && IndexList.Count > 0)
                {
                    foreach (long index_ in IndexList)
                    {
                        FactoryDao.GetScrappingDataSubDao().Delete(index_.ToString());
                        FactoryDao.GetScrappingDataDao().Delete(index_.ToString());
                    }
                }
            }
            catch (Exception e)
            {
                ErrorLog(e.ToString());
            }
            ScrappingData data = new ScrappingData();

            data.SiteCode = "006";
            data.Id       = ID;
            data.ApplyNum = Convert.ToInt64(PARAM[0]);
            data.Data01   = ConvertString(GetData(1));
            data.Data02   = ConvertString(GetData(2));
            data.Data03   = ConvertString(GetData(3));
            data.Data04   = ConvertString(GetData(4));
            data.Data05   = ConvertString(GetData(5));
            data.Data06   = ConvertString(GetData(6));
            data.Data07   = ConvertString(GetData(7));
            data.Data08   = ConvertString(GetData(8));
            data.Data09   = ConvertString(GetData(9));
            data.Data10   = ConvertString(GetData(10));
            data.Data11   = ConvertString(GetData(11));
            data.Data13   = ConvertString(GetData(13));
            data.Data14   = ConvertString(GetData(14));
            int index = FactoryDao.GetScrappingDataDao().Insert(data, true);

            DebugLog("index " + index);

            ScrappingTotalData scraptotal = new ScrappingTotalData();

            FactoryDao.GetScrappingTotalDataDao().Delete(PARAM[0], "006");
            scraptotal.ApplyNum = Convert.ToInt64(PARAM[0]);
            scraptotal.Id       = ID;
            scraptotal.SiteCode = "006";
            FactoryDao.GetScrappingTotalDataDao().Insert(scraptotal);


            SetEventHandler(ScrapState.COMPLETE);
        }
Exemplo n.º 2
0
        protected override void Finish()
        {
            DebugLog("finish");
            SetEventHandler(ScrapState.COMPLETE);
            // TODO:How do the data insert when login error?
            if (!(bool)GetData(0))
            {
                InfoLog("login error");
                return;
            }

            DebugLog("INSERT");
            DebugLog(ID);
            DebugLog(PW);
            DebugLog(PARAM[0]);

            //It delete data of table in database.
            try
            {
                List <long> IndexList = FactoryDao.GetScrappingDataDao().GetIndex(PARAM[0], "002");
                if (IndexList != null && IndexList.Count > 0)
                {
                    foreach (long index_ in IndexList)
                    {
                        FactoryDao.GetScrappingDataSubDao().Delete(index_.ToString());
                        FactoryDao.GetScrappingDataDao().Delete(index_.ToString());
                    }
                }
            }
            catch (Exception e)
            {
                ErrorLog(e.ToString());
            }
            ScrappingData data = new ScrappingData();

            data.SiteCode = "002";
            data.Id       = ID;
            data.ApplyNum = Convert.ToInt64(PARAM[0]);
            data.Data01   = ConvertString(GetData(1));
            data.Data02   = ConvertString(GetData(2));
            data.Data03   = ConvertString(GetData(3));
            data.Data04   = ConvertString(GetData(4));
            data.Data05   = ConvertString(GetData(5));
            data.Data06   = ConvertString(GetData(6));
            data.Data07   = ConvertString(GetData(7));
            data.Data08   = ConvertString(GetData(8));
            data.Data09   = ConvertString(GetData(9));
            data.Data10   = ConvertString(GetData(10));
            data.Data11   = ConvertString(GetData(11));
            data.Data12   = ConvertString(GetData(12));
            data.Data13   = ConvertString(GetData(13));
            data.Data14   = ConvertString(GetData(14));
            data.Data15   = ConvertString(GetData(15));
            data.Data16   = ConvertString(GetData(16));
            data.Data17   = ConvertString(GetData(17));
            data.Data18   = ConvertString(GetData(18));
            data.Data19   = ConvertString(GetData(19));
            data.Data20   = ConvertString(GetData(20));
            data.Data21   = ConvertString(GetData(21));

            int index = FactoryDao.GetScrappingDataDao().Insert(data, true);

            DebugLog("index " + index);
            Decimal total    = 0;
            Decimal expected = 0;

            //TODO: It should partition the data that total of price is scraped.

            for (int i = 0; i < 3; i++)
            {
                ScrappingDataSub sub = new ScrappingDataSub();
                sub.DataIdx = index;
                // 입금예정 - 도매꾹
                sub.Data01 = ConvertString(GetData(22 + i));
                total      = Sum(total, ConvertString(GetData(22 + i)));
                LOG.Info("index " + (22 + i) + " : " + ConvertString(GetData(22 + i)));
                // 승인대기 - 도매꾹
                sub.Data02 = ConvertString(GetData(25 + i));
                total      = Sum(total, ConvertString(GetData(25 + i)));
                LOG.Info("index " + (25 + i) + " : " + ConvertString(GetData(25 + i)));
                // 발송예정 - 도매꾹
                sub.Data03 = ConvertString(GetData(28 + i));
                total      = Sum(total, ConvertString(GetData(28 + i)));
                LOG.Info("index " + (28 + i) + " : " + ConvertString(GetData(28 + i)));
                // 배송중 - 도매꾹
                sub.Data04 = ConvertString(GetData(31 + i));
                total      = Sum(total, ConvertString(GetData(31 + i)));
                LOG.Info("index " + (31 + i) + " : " + ConvertString(GetData(31 + i)));
                // 적립예정 - 도매꾹
                sub.Data05 = ConvertString(GetData(34 + i));
                expected   = Sum(expected, ConvertString(GetData(34 + i)));
                LOG.Info("index " + (34 + i) + " : " + ConvertString(GetData(34 + i)));
                // 승인취소 - 도매꾹
                sub.Data06 = ConvertString(GetData(37 + i));
                total      = Sum(total, ConvertString(GetData(37 + i)));
                LOG.Info("index " + (37 + i) + " : " + ConvertString(GetData(37 + i)));
                // 판매취소 - 도매꾹
                sub.Data07 = ConvertString(GetData(40 + i));
                total      = Sum(total, ConvertString(GetData(40 + i)));
                LOG.Info("index " + (40 + i) + " : " + ConvertString(GetData(40 + i)));
                // 구매취소 - 도매꾹
                sub.Data08 = ConvertString(GetData(43 + i));
                total      = Sum(total, ConvertString(GetData(43 + i)));
                LOG.Info("index " + (43 + i) + " : " + ConvertString(GetData(43 + i)));
                // 입금예정 - 도매매
                sub.Data09 = ConvertString(GetData(46 + i));
                total      = Sum(total, ConvertString(GetData(46 + i)));
                LOG.Info("index " + (46 + i) + " : " + ConvertString(GetData(46 + i)));
                // 승인대기 - 도매매
                sub.Data10 = ConvertString(GetData(49 + i));
                total      = Sum(total, ConvertString(GetData(49 + i)));
                LOG.Info("index " + (49 + i) + " : " + ConvertString(GetData(49 + i)));
                // 발송예정 - 도매매
                sub.Data11 = ConvertString(GetData(52 + i));
                total      = Sum(total, ConvertString(GetData(52 + i)));
                LOG.Info("index " + (52 + i) + " : " + ConvertString(GetData(52 + i)));
                // 배송중 - 도매매
                sub.Data12 = ConvertString(GetData(55 + i));
                total      = Sum(total, ConvertString(GetData(55 + i)));
                LOG.Info("index " + (55 + i) + " : " + ConvertString(GetData(55 + i)));
                // 적립예정 - 도매매
                sub.Data13 = ConvertString(GetData(58 + i));
                total      = Sum(total, ConvertString(GetData(58 + i)));
                LOG.Info("index " + (58 + i) + " : " + ConvertString(GetData(58 + i)));
                // 승인취소 - 도매매
                sub.Data14 = ConvertString(GetData(61 + i));
                total      = Sum(total, ConvertString(GetData(61 + i)));
                LOG.Info("index " + (61 + i) + " : " + ConvertString(GetData(61 + i)));
                // 판매취소 - 도매매
                sub.Data15 = ConvertString(GetData(64 + i));
                total      = Sum(total, ConvertString(GetData(64 + i)));
                LOG.Info("index " + (64 + i) + " : " + ConvertString(GetData(64 + i)));
                // 구매취소 - 도매매
                sub.Data16 = ConvertString(GetData(67 + i));
                total      = Sum(total, ConvertString(GetData(67 + i)));
                LOG.Info("index " + (67 + i) + " : " + ConvertString(GetData(67 + i)));

                FactoryDao.GetScrappingDataSubDao().Insert(sub);
            }

            ScrappingTotalData scraptotal = new ScrappingTotalData();

            FactoryDao.GetScrappingTotalDataDao().Delete(PARAM[0], "002");
            scraptotal.ApplyNum           = Convert.ToInt64(PARAM[0]);
            scraptotal.Id                 = ID;
            scraptotal.SiteCode           = "002";
            scraptotal.SettlementTotalFee = total.ToString();
            scraptotal.ExpectFee          = expected.ToString();
            FactoryDao.GetScrappingTotalDataDao().Insert(scraptotal);
        }