public SortedDictionary <String, String> GetParam()
        {
            SortedDictionary <String, String> map = base.GetBaseParam();

            if (PageNo == null)
            {
                throw new SimbossException("param pageNo is required");
            }
            map.Add("pageNo", PageNo.ToString());
            return(map);
        }
        protected void GotoPage(int pg)
        {
            DataView dv = (DataView)DataSource;

            if (PageCount > 0)
            {
                PageNo            = pg;
                ddList.DataSource = GetCurrPage(dv);
            }
            else
            {
                PageNo            = 0;
                ddList.DataSource = dv;
            }
            try { ddList.DataBind(); }
            catch { }
            lbPages.Text = PageNo.ToString() + " of " + PageCount.ToString();
            cbPostBack(this, EventArgs.Empty);
        }
        public override Dictionary <string, string> ToDict()
        {
            var dict = new Dictionary <string, string>
            {
                { "pageNo", PageNo.ToString() },
                { "pageSize", PageSize.ToString() },
            };

            if (!string.IsNullOrWhiteSpace(NamespaceId))
            {
                dict.Add("namespaceId", NamespaceId);
            }

            if (!string.IsNullOrWhiteSpace(GroupName))
            {
                dict.Add("groupName", GroupName);
            }

            return(dict);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="proxy"></param>
        public void GrabFirstOrNextPage(IPProxy proxy = null)
        {
            if (AgentStatus != IPProxyAgentStatusEnum.Idle)
            {
                return;
            }

            var pgNo = PageNo.ToString();

            if (PageInstruction != null)
            {
                pgNo = PageInstruction.PageNo(PageNo);
            }
            TargetPgUrl = TargetPageUrlPattern.Replace("{PAGENO}", pgNo);

            AgentStatus = IPProxyAgentStatusEnum.Reading;
            InvokeEventFreeIPProxiesReading(new EventHandlers.FreeIPProxiesReadingEventArgs(TargetPgUrl));

            // Get the html response called from the url
            var contentDoc = ScraperBoxHelper.GrabPage(_driver as PhantomJSDriver, TargetPgUrl, proxy?.AsTuple());

            ValidatePage(contentDoc);
            if (!PageIsValid)
            {
                AgentStatus = IPProxyAgentStatusEnum.Completed;
                InvokeEventFreeIPProviderSourceCompleted(new EventHandlers.FreeIPProviderSourceCompletedEventArgs(PageNo));
                base.Shutdown();
                return;
            }

            // have the inheriting class parse the html result
            ParseProxyPage(contentDoc);
            TotalPagesScraped++;

            // increase the page no for next use.
            PageNo++;
        }
Beispiel #5
0
        private void openChildren(PageNo pPageNo)
        {
            Type targetFormType = typeof(frmCowPart);

            if (pPageNo == PageNo.ManageStaff)
            {
                targetFormType = typeof(frmStaff);
            }
            else if (pPageNo == PageNo.ManageMember)
            {
                targetFormType = typeof(frmMember);
            }
            else if (pPageNo == PageNo.CowPart)
            {
                targetFormType = typeof(frmCowPart);
            }
            else if (pPageNo == PageNo.StaffTimeStamp)
            {
                targetFormType = typeof(frmStaffTimeStamp);
            }
            else if (pPageNo == PageNo.CowList)
            {
                targetFormType = typeof(frmCowList);
            }
            else if (pPageNo == PageNo.Department)
            {
                targetFormType = typeof(frmDepartment);
            }
            else if (pPageNo == PageNo.Faction)
            {
                targetFormType = typeof(frmFaction);
            }

            // tsmMainData
            else if (pPageNo == PageNo.CowBreed)
            {
                targetFormType = typeof(frmCowBreed);
            }
            else if (pPageNo == PageNo.CowHorn)
            {
                targetFormType = typeof(frmCowHorn);
            }
            else if (pPageNo == PageNo.CowPurpose)
            {
                targetFormType = typeof(frmCowPurpose);
            }
            else if (pPageNo == PageNo.CowStatus)
            {
                targetFormType = typeof(frmCowStatus);
            }
            else if (pPageNo == PageNo.CowGrowUpLevel)
            {
                targetFormType = typeof(frmCowGrowLevel);
            }
            else if (pPageNo == PageNo.CowColor)
            {
                targetFormType = typeof(frmCowColor);
            }
            else if (pPageNo == PageNo.CowStall)
            {
                targetFormType = typeof(frmCowStall);
            }
            else if (pPageNo == PageNo.CowLocation)
            {
                targetFormType = typeof(frmCowLocation);
            }

            bool isExist = false;

            foreach (Form f in this.MdiChildren)
            {
                if (f.GetType() == targetFormType)
                {
                    f.Activate();
                    if (f.WindowState != FormWindowState.Maximized)
                    {
                        f.WindowState = FormWindowState.Maximized;
                    }
                    isExist = true;
                    break;
                }
            }

            if (!isExist)
            {
                Form targetForm = null;

                if (pPageNo == PageNo.ManageStaff)
                {
                    targetForm = new frmStaff();
                }
                else if (pPageNo == PageNo.ManageMember)
                {
                    targetForm = new frmMember();
                }
                else if (pPageNo == PageNo.CowPart)
                {
                    targetForm = new frmCowPart();
                }
                else if (pPageNo == PageNo.StaffTimeStamp)
                {
                    targetForm = new frmStaffTimeStamp();;
                }
                else if (pPageNo == PageNo.CowList)
                {
                    targetForm = new frmCowList();
                }
                else if (pPageNo == PageNo.Department)
                {
                    targetForm = new frmDepartment();
                }
                else if (pPageNo == PageNo.Faction)
                {
                    targetForm = new frmFaction();
                }

                // tsmMainData
                else if (pPageNo == PageNo.CowBreed)
                {
                    targetForm = new frmCowBreed();
                }
                else if (pPageNo == PageNo.CowHorn)
                {
                    targetForm = new frmCowHorn();
                }
                else if (pPageNo == PageNo.CowPurpose)
                {
                    targetForm = new frmCowPurpose();
                }
                else if (pPageNo == PageNo.CowStatus)
                {
                    targetForm = new frmCowStatus();
                }
                else if (pPageNo == PageNo.CowGrowUpLevel)
                {
                    targetForm = new frmCowGrowLevel();
                }
                else if (pPageNo == PageNo.CowColor)
                {
                    targetForm = new frmCowColor();
                }
                else if (pPageNo == PageNo.CowStall)
                {
                    targetForm = new frmCowStall();
                }
                else if (pPageNo == PageNo.CowLocation)
                {
                    targetForm = new frmCowLocation();
                }

                targetForm.MdiParent = this;
                targetForm.Show();
                targetForm.WindowState = FormWindowState.Maximized;

                MainFunction.AddOrRemaveChildName(pMdiParent: this,
                                                  pChildName: targetForm.Name,
                                                  pChildText: targetForm.Text,
                                                  pIsAdd: true);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 构造多酒店查询XML
        /// </summary>
        /// <returns>多酒店查询XML</returns>
        private string GetMultiRequestXML()
        {
            StringBuilder NodeInfo = new StringBuilder();

            #region Build XML

            NodeInfo.Append("<HotelAvailRQ>");
            NodeInfo.Append("<HotelAvailCriteria AvailReqType=\"" + Enum.GetName(typeof(AvailReqTypeEnum), AvailReqType) + "\">");
            NodeInfo.Append("<ConfirmRightNowIndicator>" + Utils.BoolToYesOrNo(ConfirmRightNowIndicator) + "</ConfirmRightNowIndicator>");
            NodeInfo.Append("<StayDateRange Duration=\"\"  CheckOutDate=\"" + CheckOutDate + "\" CheckInDate=\"" + CheckInDate + "\"/>");
            NodeInfo.Append("<RatePlanCandidates>");
            NodeInfo.Append("<RatePlanCandidate RatePlanCode=\"" + RatePlanCode + "\" RatePlanType=\"" + RatePlanType + "\" Payment=\"" + Payment + "\">");
            //指定供应商 开始
            if (!String.IsNullOrEmpty(VendorCode))
            {
                NodeInfo.Append("<VendorsIncluded>");
                NodeInfo.Append("<Vendor VendorCode=\"" + VendorCode + "\"/>");
                NodeInfo.Append("</VendorsIncluded>");
                NodeInfo.Append("<IsDefinedChannel>" + IsDefinedChannel + "</IsDefinedChannel>");
                NodeInfo.Append("<IsDefinedVendor>" + IsDefinedVendor + "</IsDefinedVendor>");
            }
            //指定供应商 结束
            NodeInfo.Append("</RatePlanCandidate>");
            NodeInfo.Append("</RatePlanCandidates>");
            //价格
            NodeInfo.Append("<RateRange MaxRate=\"" + (PriceMaxRate.HasValue ? PriceMaxRate.ToString() : string.Empty) + "\" Currency=\"" + PriceCurrency + "\" MinRate=\"" + (PriceMinRate.HasValue ? PriceMinRate.ToString() : string.Empty) + "\"/>");
            NodeInfo.Append("<HotelSearchCriteria>");
            //经纬度
            NodeInfo.Append("<Position LongitudeFrom=\"" + MinimumLongitude + "\" LatitudeFrom=\"" + MinimumLatitude + "\" Longitude=\"" + Longitude + "\" LongitudeTo=\"" + MaximumLongitude + "\" Latitude=\"" + Latitude + "\" LatitudeTo=\"" + MaximumLatitude + "\"/>");
            //地理位置(地标)
            if (!String.IsNullOrEmpty(LandMark))
            {
                NodeInfo.Append("<LandMark>" + LandMark + "</LandMark>");
            }
            if (!String.IsNullOrEmpty(PhoneNumber))
            {
                NodeInfo.Append("<PhoneNumber>" + PhoneNumber + "</PhoneNumber>");
            }
            if (!String.IsNullOrEmpty(Radius))
            {
                NodeInfo.Append("<Radius>" + Radius + "</Radius>");
            }
            NodeInfo.Append("<HotelRef");
            if (!String.IsNullOrEmpty(District))
            {
                NodeInfo.Append(" District=\"" + District + "\"");
            }
            NodeInfo.Append(" CityCode=\"" + CityCode + "\"");
            if (!String.IsNullOrEmpty(HotelBrandName))
            {
                NodeInfo.Append(" HotelBrandName=\"" + HotelBrandName + "\"");
            }
            if (AirReception != BoolEnum.none)
            {
                NodeInfo.Append(" AirReception=\"" + Enum.GetName(typeof(BoolEnum), AirReception) + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChainCode))
            {
                NodeInfo.Append(" HotelChainCode=\"" + HotelChainCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelCode))
            {
                NodeInfo.Append(" HotelCode=\"" + HotelCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelEnglishName))
            {
                NodeInfo.Append(" HotelEnglishName=\"" + HotelEnglishName + "\"");
            }
            if (!String.IsNullOrEmpty(HotelBrandCode))
            {
                NodeInfo.Append(" HotelBrandCode=\"" + HotelBrandCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChineseName))
            {
                NodeInfo.Append(" HotelChineseName=\"" + HotelChineseName + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChainName))
            {
                NodeInfo.Append(" HotelChainName=\"" + HotelChainName + "\"");
            }
            NodeInfo.Append(" />");
            if (!String.IsNullOrEmpty(Fitment))
            {
                NodeInfo.Append("<Fitment>" + Fitment + "</Fitment>");
            }
            if (!String.IsNullOrEmpty(OpenDate))
            {
                NodeInfo.Append("<OpenDate>" + OpenDate + "</OpenDate>");
            }
            NodeInfo.Append("<RoomStayCandidates>");
            NodeInfo.Append("<RoomStayCandidate");
            if (!String.IsNullOrEmpty(RoomView))
            {
                NodeInfo.Append(" RoomView=\"" + RoomView + "\"");
            }
            if (!String.IsNullOrEmpty(RoomName))
            {
                NodeInfo.Append(" RoomName=\"" + RoomName + "\"");
            }
            if (Internet != BoolEnum.none)
            {
                NodeInfo.Append(" Internet=\"" + Enum.GetName(typeof(BoolEnum), Internet) + "\"");
            }
            if (NoSmoking != BoolEnum.none)
            {
                NodeInfo.Append(" NoSmoking=\"" + Enum.GetName(typeof(BoolEnum), NoSmoking) + "\"");
            }
            if (RoomQuantity > 0)
            {
                NodeInfo.Append(" Quantity=\"" + RoomQuantity.ToString() + "\"");
            }
            if (!String.IsNullOrEmpty(BedType))
            {
                NodeInfo.Append(" BedType=\"" + BedType + "\"");
            }
            NodeInfo.Append(">");
            NodeInfo.Append("<RoomAmenity");
            if (QualityLevel != QualityLevelEnum.None)
            {
                NodeInfo.Append(" QualityLevel=\"" + Enum.GetName(typeof(QualityLevelEnum), QualityLevel) + "\"");
            }
            if (RoomTypeGuestMaxNum > 0)
            {
                NodeInfo.Append(" RoomTypeGuestMaxNum=\"" + RoomTypeGuestMaxNum.ToString() + "\"");
            }
            NodeInfo.Append(" />");
            NodeInfo.Append("</RoomStayCandidate>");
            NodeInfo.Append("</RoomStayCandidates>");
            //星级
            if (HotelRank != HotelRankEnum._00)
            {
                NodeInfo.Append("<Rank>" + Enum.GetName(typeof(HotelRankEnum), HotelRank).Substring(1) + "</Rank>");
            }
            NodeInfo.Append("</HotelSearchCriteria>");
            //分页信息
            NodeInfo.Append("<ReqPageInfo>");
            NodeInfo.Append("<ReqNumOfEachPage>" + NumOfEachPage.ToString() + "</ReqNumOfEachPage>");
            NodeInfo.Append("<ReqPageNo>" + PageNo.ToString() + "</ReqPageNo>");
            NodeInfo.Append("<IsPageView>" + Utils.BoolToYesOrNo(IsPageView) + "</IsPageView>");
            NodeInfo.Append("</ReqPageInfo>");
            //是否显示房型
            NodeInfo.Append("<RoomTypeDetailShowed>" + Utils.BoolToYesOrNo(RoomTypeDetailShowed) + "</RoomTypeDetailShowed>");
            //排序
            if (OrderBy != HotelOrderBy.Default)
            {
                NodeInfo.Append("<OrderBy>" + Enum.GetName(typeof(HotelOrderBy), OrderBy) + "</OrderBy>");
            }
            NodeInfo.Append("</HotelAvailCriteria>");
            NodeInfo.Append("</HotelAvailRQ>");

            #endregion

            return(NodeInfo.ToString());
        }
Beispiel #7
0
 public override string GetText()
 {
     return(PageNo.ToString());
 }