示例#1
0
        /// <summary>
        /// 解析信息
        /// </summary>
        /// <param name="foldName">文件夹路径</param>
        /// <param name="fileName">文件名</param>
        /// <param name="number">要搜索的权证号</param>
        public void ExplainNormalInfo(string foldName, string fileName, string number)
        {
            ExcelInfo.CreateExcelFile(foldName, fileName);
            string strHtml      = WebInfo.GetPageInfo(hostContentPreUrl + FIRST_MAIN_URL);
            string strFirstPage = strHtml;

            Explain.FirstPage(strHtml, ref pageIdx, ref pageCount);

            int pageProjIdx = 1;

            while (true)
            {
                if (pageStart <= pageIdx)
                {//仅抓取指定页码之后的页面
                    List <string> projList = new List <string>();
                    Explain.FirstProj(strHtml, projList);
                    foreach (string projItem in projList)
                    {
                        this.ExplainSecondBuilding(projItem);
                        UpdateProgess(false, pageProjIdx++);
                    }
                }
                if (pageIdx >= pageCount || pageIdx >= pageEnd)
                {
                    break;
                }
                //每栋楼抓完后保存数据
                if (pageIdx % 30 == 0)//每30页保存一次
                {
                    ExcelInfo.SaveInfo();
                }

                //开始下一轮循环
                Dictionary <string, string> nextKey = new Dictionary <string, string>();
                Explain.FirstNextPage(strHtml, nextKey);
                strHtml = WebInfo.PostPageInfo(hostContentPreUrl + FIRST_MAIN_URL, nextKey);
                Explain.FirstPage(strHtml, ref pageIdx, ref pageCount);
            }
            if (number.Length > 3)
            {
                this.GetSearchProjects(strFirstPage, number);
            }

            ExcelInfo.FinishExcel();
        }
示例#2
0
        private void GetSearchProjects(string strHtmlFirstPage, string number)
        {
            string[] numArray = number.Split(',');
            foreach (string strNum in numArray)
            {
                Dictionary <string, string> postValue = new Dictionary <string, string>();

                Explain.FirstSearchNumber(strHtmlFirstPage, strNum, postValue);

                string strHtml = WebInfo.PostPageInfo(hostContentPreUrl + FIRST_MAIN_URL, postValue);

                List <string> projList = new List <string>();
                Explain.FirstProj(strHtml, projList);

                foreach (string projItem in projList)
                {
                    this.ExplainSecondBuilding(projItem);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 解析第三层的详细信息
        /// </summary>
        /// <param name="pageUrl"></param>
        /// <param name="itemInfo">解析的结果</param>
        private void ExplainThirdDetail(string pageUrl, Content itemInfo)
        {
            //HouseTable    图表形式
            //listhouse     列表形式
            pageUrl = pageUrl.Replace("HouseTable", "listhouse");
            string strHtml = WebInfo.GetPageInfo(hostContentPreUrl + pageUrl);
            int    currentPageIdx = 0, currentPageCount = 0;

            Explain.FirstPage(strHtml, ref currentPageIdx, ref currentPageCount);
            while (true)
            {
                List <Content> infoList = new List <Content>();
                Explain.ThirdDetail(strHtml, itemInfo, infoList);

                int     itemCount = infoList.Count;
                Content item;
                for (int i = 0; i < infoList.Count; i++)
                {
                    item = infoList[i];
                    if (this.houseType == HouseType.ALL ||
                        this.houseType == HouseType.CANSELL && item.HouseStatus == "可售")
                    {
                        item.RoomType = this.GetRoomTypeInfo(item.ProjectName, item.BlockNumber, item.LayerNumber, item.RoomNumber);
                    }
                    ExcelInfo.InsertItemInfo(1, resultIdx++, item);
                    UpdateProgess(true, resultIdx);
                }

                if (currentPageIdx >= currentPageCount)
                {
                    break;
                }

                //开始下一轮循环
                Dictionary <string, string> nextKey = new Dictionary <string, string>();
                Explain.ThirdNextPage(strHtml, nextKey);
                strHtml = WebInfo.PostPageInfo(hostContentPreUrl + pageUrl, nextKey);
                Explain.FirstPage(strHtml, ref currentPageIdx, ref currentPageCount);
            }
        }