Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            //new Spider().GetRequst();
            Console.WriteLine("begin...." + DateTime.Now);

            PullData spider = new PullData();

            // 债券新闻
            spider.GetBondsNewsData("银行 基金");

            // 上交所
            // spider.GetNewsFromShangExchangeTest("新奥股份*2018");
            // spider.GetNewsFromShangExchange("新奥股份*2018");

            // 深交所
            //  spider.GetSZNewsByPostTest("监管关注");
            // spider.GetSZNewsByPost("华联股份 高级管理人员辞职");

            // 证监会
            // spider.GetSecuritiesNewsByPostTest("中心");
            //   spider.GetSecuritiesNewsByPost("监管");
            // spider.ConvertToModelList("");
            // spider.GetSecuritiesDetail();

            // 失信人信息查询23

            //var code = "";
            var count = 0;

            while (count < 0)
            {
                var needPerson = true;
                spider.ParseImgToCode(needPerson);
                Thread.Sleep(500);
                count++;
            }


            //Console.WriteLine("输入验证码:");
            //var code = Console.ReadLine();
            //Console.WriteLine("已输入:" + code);
            //   spider.GetPersonInHttpClient("codeImgF50DF51363C61749730C6B4BE9AB96BE", "4jlx");

            var queryUri = "http://zxgk.court.gov.cn/shixin/findDis";
            var req      = HttpWebRequest.Create(queryUri) as HttpWebRequest;

            // spider.GetPersonInfo(req,"","1234");

            // 百度新闻
            //spider.TestRequest();


            // ParseImgCode parser = new ParseImgCode();
            //  parser.Test();


            Console.ReadKey();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Proceed to Buyer Page
        /// </summary>
        public IActionResult BuyerSearch()
        {
            PullData db = new PullData(Configuration);

            ViewBag.Location     = db.BindDropDownListCustomer("select distinct 1 Id, street Name from pmiresidenceresult limit 0,500;", "Location");
            ViewBag.propertyType = db.BindDropDownListCustomer("select distinct 1 Id,propertyType Name from pmiresidenceresult limit 0,500;", "Property Type");

            return(View());
        }
Exemplo n.º 3
0
        public static bool TEST(PullData spider)
        {
            Console.WriteLine("输入验证码:");
            Console.ReadLine();
            var code = Console.ReadLine();

            //  spider.GetCourtPersonInfo("", code);
            return(true);
        }
Exemplo n.º 4
0
        public string AjaxFilter(string Locations, string propertyTypes, string PriceRange, string SaleType, string LandArea, string FloorRange)
        {
            PullData db       = new PullData(Configuration);
            string   whrQuery = " Where 0=0";

            if (Locations != null)
            {
                whrQuery = whrQuery + " and street='" + Locations + "'";
            }
            if (propertyTypes != null)
            {
                whrQuery = whrQuery + " and propertyType='" + propertyTypes + "'";
            }
            if (SaleType != null)
            {
                whrQuery = whrQuery + " and typeOfSale='" + SaleType + "'";
            }
            if (FloorRange != null)
            {
                whrQuery = whrQuery + " and floorRange='" + FloorRange + "'";
            }
            if (PriceRange != null)
            {
                if (PriceRange == "1")
                {
                    whrQuery = whrQuery + " and CAST(price AS UNSIGNED)<" + 1000000;
                }
                else if (PriceRange == "11")
                {
                    whrQuery = whrQuery + " and CAST(price AS UNSIGNED)>" + 10000000;
                }
                else
                {
                    whrQuery = whrQuery + " and (CAST(price AS UNSIGNED)<" + Convert.ToInt32(PriceRange) * 1000000 + " and CAST(price AS UNSIGNED)>" + ((Convert.ToInt32(PriceRange) * 1000000) - 1000000) + " )";
                }
            }

            if (LandArea != null)
            {
                if (LandArea == "1")
                {
                    whrQuery = whrQuery + " and CAST(area AS UNSIGNED)<" + 100;
                }
                else
                {
                    whrQuery = whrQuery + " and (CAST(area AS UNSIGNED)<" + Convert.ToInt32(LandArea) * 100 + " and CAST(area AS UNSIGNED)>" + ((Convert.ToInt32(LandArea) * 100) - 100) + " )";
                }
            }
            whrQuery = whrQuery + " ORDER BY idtransaction DESC LIMIT 600";
            string    query = " Select  * From pmiresidenceresult " + whrQuery;
            DataTable dt    = db.LoadData(query, "Loaddt");
            string    json  = JsonConvert.SerializeObject(dt);

            return(JsonConvert.SerializeObject(dt));
        }
Exemplo n.º 5
0
        ///<summary>
        ///Uses the dictionary returned from GetAllPrices to create a list of chartmodels with appropriate values
        /// </summary>
        ///<returns>
        ///List of chart models with calculated average for the month and moving average across 3 months
        /// </returns>
        public List <ChartViewModel> GetAvgPriceList(string Location)
        {
            PullData db = new PullData(Configuration);

            string Query = "SELECT Sum(price) FROM bricks.pmiresidenceresult ";

            if (Location != "" && Location != null)
            {
                Query = Query + " Where street='" + Location + "'";
            }

            DataTable dtPriceSum = db.LoadData(Query, "PriceSum");


            string resultQuery = "SELECT contractDate,FORMAT(((Sum(price)/" + dtPriceSum.Rows[0][0].ToString() + ")*100),6) AveragePrice FROM bricks.pmiresidenceresult ";

            if (Location != "" && Location != null)
            {
                resultQuery = resultQuery + " Where street='" + Location + "'";
            }
            resultQuery = resultQuery + @" Group by contractDate order by STR_TO_DATE(concat('01,', left(contractDate, 2),',20',right(contractDate, 2)),'%d,%m,%Y')";

            DataTable dtresultQuery = db.LoadData(resultQuery, "resultQuery");

            for (int i = 0; i < dtresultQuery.Rows.Count; i++)
            {
                string strMonth = dtresultQuery.Rows[i]["contractDate"].ToString().Substring(0, 2);
                string strYear  = "20" + dtresultQuery.Rows[i]["contractDate"].ToString().Substring(2, 2);
                dtresultQuery.Rows[i]["contractDate"] = strMonth + "-" + strYear;
            }

            var datalist = new List <ChartViewModel>();

            datalist.Add(new ChartViewModel {
                saleTime = dtresultQuery.Rows[0][0].ToString(), averagePrice = dtresultQuery.Rows[0][1].ToString(), movingAveragePrice = dtresultQuery.Rows[0][1].ToString()
            });
            double sumOfMonths   = Double.Parse(dtresultQuery.Rows[0][1].ToString()) + Double.Parse(dtresultQuery.Rows[1][1].ToString());
            double movingAverage = sumOfMonths / 2;

            datalist.Add(new ChartViewModel {
                saleTime = dtresultQuery.Rows[1][0].ToString(), averagePrice = dtresultQuery.Rows[1][1].ToString(), movingAveragePrice = movingAverage.ToString("N6")
            });
            for (int i = 2; i < dtresultQuery.Rows.Count; i++)
            {
                sumOfMonths   = Double.Parse(dtresultQuery.Rows[i - 2][1].ToString()) + Double.Parse(dtresultQuery.Rows[i - 1][1].ToString()) + Double.Parse(dtresultQuery.Rows[i][1].ToString());
                movingAverage = sumOfMonths / 3;
                datalist.Add(new ChartViewModel {
                    saleTime = dtresultQuery.Rows[i][0].ToString(), averagePrice = dtresultQuery.Rows[i][1].ToString(), movingAveragePrice = movingAverage.ToString("N6")
                });
            }
            return(datalist);
        }