示例#1
0
        public override bool Web_DownLoad_CancelList()
        {
            try
            {
                string method = "GET";
                string url    = @"http://biz.wemakeprice.com/dealer/deal_list/do_xsl_download/{GoodsCode}/1";

                DateTime dtNow = DateTime.Now;

                string makefolder = HKLibrary.UTIL.HKFileHelper.GetCurrentDirectory();
                makefolder += "\\";
                makefolder += CINIManager.Instance.channelseq_;
                makefolder += "\\";
                makefolder += dtNow.ToShortDateString();
                HKLibrary.UTIL.HKFileHelper.MakeFolder(makefolder);

                foreach (var pData in GoodsInfoList_)
                {
                    if (CancelDownInfo_.ContainsKey(pData.Value.Goods_Code_) == false)
                    {
                        string sendurl    = url.Replace("{GoodsCode}", pData.Value.Goods_Code_);
                        string downString = string.Format(@"{0}\Cancel_{1}_{2}.xls"
                                                          , makefolder, pData.Value.Goods_Code_, Convert.ToString(dtNow.Ticks));

                        HttpWebResponse pResponse = HKHttpWebRequest.ReqHttpRequest(method, sendurl, "", Cookie_, null, null, 180000);

                        if (pResponse.CharacterSet == "" || pResponse.CharacterSet == "euc-kr" || pResponse.CharacterSet == "EUC-KR")
                        {
                            FileStream fs = File.OpenWrite(downString);

                            string d = pResponse.CharacterSet;
                            Stream responsestream = pResponse.GetResponseStream();
                            byte[] buffer         = new byte[2048];

                            long totalBytesRead = 0;
                            int  bytesRead;

                            while ((bytesRead = responsestream.Read(buffer, 0, buffer.Length)) > 0)
                            {
                                totalBytesRead += bytesRead;
                                fs.Write(buffer, 0, bytesRead);
                            }
                            fs.Close();
                            fs.Dispose();
                        }

                        CancelDownInfo_.Add(pData.Value.Goods_Code_, downString);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error bool Web_DownLoad_CancelList - {0}", ex.Message));
                return(false);
            }

            return(true);
        }
示例#2
0
        public override bool Web_DownLoad_CancelList()
        {
            try
            {
                string   method     = "GET";
                string   url        = @"https://wing.coupang.com/refund/approval/exceldown?coupangSrl={GoodsCode}&status=NONE&productTitle=%5B%EB%8C%80%EC%B2%9C%5D+%EC%A7%9A%ED%8A%B8%EB%9E%99+1%EC%9D%B8+%EC%9D%B4%EC%9A%A9%EA%B6%8C&excelDownload=true";
                DateTime dtNow      = DateTime.Now;
                string   makefolder = HKLibrary.UTIL.HKFileHelper.GetCurrentDirectory();
                makefolder += "\\";
                makefolder += CINIManager.Instance.channelseq_;
                makefolder += "\\";
                makefolder += dtNow.ToShortDateString();
                HKLibrary.UTIL.HKFileHelper.MakeFolder(makefolder);

                foreach (var pData in GoodsInfoList_)
                {
                    if (CancelDownInfo_.ContainsKey(pData.Value.Goods_Code_) == false)
                    {
                        string sendurl    = url.Replace("{GoodsCode}", pData.Value.Goods_Code_);
                        string downString = string.Format(@"{0}\Cancel_{1}_{2}.xls"
                                                          , makefolder, pData.Value.Goods_Code_, Convert.ToString(dtNow.Ticks));

                        HttpWebResponse pResponse = HKHttpWebRequest.ReqHttpRequest(method, sendurl, "", Cookie_, null, null, 180000);


                        FileStream fs = File.OpenWrite(downString);

                        string d = pResponse.CharacterSet;
                        Stream responsestream = pResponse.GetResponseStream();
                        byte[] buffer         = new byte[2048];

                        long totalBytesRead = 0;
                        int  bytesRead;

                        while ((bytesRead = responsestream.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            totalBytesRead += bytesRead;
                            fs.Write(buffer, 0, bytesRead);
                        }
                        fs.Close();
                        fs.Dispose();


                        CancelDownInfo_.Add(pData.Value.Goods_Code_, downString);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error Web_DownLoad_CancelList {0}", ex.Message));
                return(false);
            }

            return(true);
        }
示例#3
0
        public override bool Web_DownLoad_CancelList()
        {
            try
            {
                string method = "GET";
                string url    = @"https://ps.ticketmonster.co.kr/daily/cancellist";
                string param  = @"main_deal_srl={GoodsCode}&branch_srl=&start_date={sDate}&end_date={eDate}&searchKey=&searchVal=&excel=Y";

                DateTime dtNow = DateTime.Now;

                string eDate = "";
                string sDate = "";

                string makefolder = HKLibrary.UTIL.HKFileHelper.GetCurrentDirectory();
                makefolder += "\\";
                makefolder += CINIManager.Instance.channelseq_;
                makefolder += "\\";
                makefolder += dtNow.ToShortDateString();
                HKLibrary.UTIL.HKFileHelper.MakeFolder(makefolder);

                foreach (var pData in GoodsInfoList_)
                {
                    if (CancelDownInfo_.ContainsKey(pData.Value.Goods_Code_) == false)
                    {
                        if (pData.Value.eDateFormat_ != null)
                        {
                            DateTime beforeData = dtNow.AddDays(-7);  // 이지웰 건수가 많으면 데이터를 못들고옴, 10일전 건수만 들고오게 함
                            eDate = string.Format("{0:D4}-{1:D2}-{2:D2}", dtNow.Year, dtNow.Month, dtNow.Day);
                            sDate = string.Format("{0:D4}-{1:D2}-{2:D2}", beforeData.Year, beforeData.Month, beforeData.Day);
                        }

                        string sendparam = param.Replace("{sDate}", sDate);
                        sendparam = sendparam.Replace("{eDate}", eDate);
                        sendparam = sendparam.Replace("{GoodsCode}", pData.Value.Goods_Code_);
                        string downString = string.Format(@"{0}\Cancel_{1}_{2}.xls"
                                                          , makefolder, pData.Value.Goods_Code_, Convert.ToString(dtNow.Ticks));

                        HttpWebResponse pResponse = HKHttpWebRequest.ReqHttpRequest(method, url, sendparam, Cookie_, null, null, 180000);

                        if (pResponse.CharacterSet == "" || pResponse.CharacterSet == "euc-kr" || pResponse.CharacterSet == "EUC-KR")
                        {
                            FileStream fs = File.OpenWrite(downString);

                            string d = pResponse.CharacterSet;
                            Stream responsestream = pResponse.GetResponseStream();
                            byte[] buffer         = new byte[2048];

                            long totalBytesRead = 0;
                            int  bytesRead;

                            while ((bytesRead = responsestream.Read(buffer, 0, buffer.Length)) > 0)
                            {
                                totalBytesRead += bytesRead;
                                fs.Write(buffer, 0, bytesRead);
                            }
                            fs.Close();
                            fs.Dispose();
                        }
                        else
                        {
                            TextReader textReader = (TextReader) new StreamReader(pResponse.GetResponseStream(), Encoding.GetEncoding(pResponse.CharacterSet));
                            string     htmlBuffer = textReader.ReadToEnd();
                            HKLibrary.UTIL.HKFileHelper.SaveToFile(downString, htmlBuffer);
                            textReader.Close();
                            textReader.Dispose();
                        }

                        CancelDownInfo_.Add(pData.Value.Goods_Code_, downString);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NewLogManager2.Instance.Log(string.Format("Error override bool Web_DownLoad_CancelList - {0}", ex.Message));
                return(false);
            }

            return(true);
        }