本文整理汇总了C#中SortableBindingList.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# SortableBindingList.AsQueryable方法的具体用法?C# SortableBindingList.AsQueryable怎么用?C# SortableBindingList.AsQueryable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortableBindingList
的用法示例。
在下文中一共展示了SortableBindingList.AsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public IQueryable<AuctionSearch> Search(string searchText)
{
const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx";
var auctions = new SortableBindingList<AuctionSearch>();
var doc = HtmlDocument(Post(searchString,
"t=22&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:" +
searchText.Replace(" ", ",") +
"&rtr=7&baid=-1&searchMode=1sg=1&showAdult=true&searchDir=1&event=&rnd=0.698455864796415&EqnJYig=561ef36"));
if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
{
foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
{
if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
{
AuctionSearch auction = GenerateAuctionSearch();
auction.DomainName = HTMLDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
Console.WriteLine(auction.DomainName);
auction.BidCount = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace(" ", "")));
auction.Traffic = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace(" ", "")));
auction.Valuation = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace(" ", "")));
auction.Price = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
try
{
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
{
if (HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
{
auction.BuyItNow = TryParse_INT(Regex.Split(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
}
}
else
{
auction.BuyItNow = 0;
}
}
catch (Exception) { auction.BuyItNow = 0; }
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
{
auction.MinBid = TryParse_INT(GetSubString(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
}
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
!HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
{
auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
}
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
{
auction.MinBid = TryParse_INT(GetSubString(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
}
if (QuerySelector(node, "td > div > span") != null)
{
foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
{
auction.MinOffer = TryParse_INT(item.Replace(",", ""));
}
}
auction.EndDate = GetPacificTime;
foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
{
auction.AuctionRef = item;
break;
}
//AppSettings.Instance.AllAuctions.Add(auction);
if (auction.MinBid > 0)
{
auctions.Add(auction);
}
}
}
}
return auctions.AsQueryable();
}
示例2: Search
public IQueryable<AuctionSearch> Search(string searchText)
{
const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx";
var auctions = new SortableBindingList<AuctionSearch>();
var doc = HtmlDocument(Post(searchString,
"t=16&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:"+
searchText.Replace(" ",",")
+"|ddlCharacters:0|txtCharacters:|txtMinTraffic:|txtMaxTraffic:|txtMinDomainAge:|txtMaxDomainAge:|txtMinPrice:|txtMaxPrice:|ddlCategories:0|chkAddBuyNow:false|chkAddFeatured:false|chkAddDash:true|chkAddDigit:true|chkAddWeb:false|chkAddAppr:false|chkAddInv:false|chkAddReseller:false|ddlPattern1:|ddlPattern2:|ddlPattern3:|ddlPattern4:|chkSaleOffer:false|chkSalePublic:true|chkSaleExpired:true|chkSaleCloseouts:false|chkSaleUsed:false|chkSaleBuyNow:false|chkSaleDC:false|chkAddOnSale:false|ddlAdvBids:0|txtBids:|txtAuctionID:|ddlDateOffset:&rtr=2&baid=-1&searchDir=1&rnd=0.899348703911528&jnkRjrZ=6dd022d"));
if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
{
foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
{
if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
{
AuctionSearch auction = GenerateAuctionSearch();
auction.DomainName = HtmlDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
Console.WriteLine(auction.DomainName);
auction.BidCount = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace(" ", "")));
auction.Traffic = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace(" ", "")));
auction.Valuation = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace(" ", "")));
auction.Price = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
try
{
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
{
if (HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
{
auction.BuyItNow = TextModifier.TryParse_INT(Regex.Split(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
}
}
else
{
auction.BuyItNow = 0;
}
}
catch (Exception) { auction.BuyItNow = 0; }
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
{
auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
}
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
!HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
{
auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
}
if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
{
auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
}
if (QuerySelector(node, "td > div > span") != null)
{
foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
{
auction.MinOffer = TextModifier.TryParse_INT(item.Replace(",", ""));
}
}
auction.EndDate = GetPacificTime;
foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
{
auction.AuctionRef = item;
break;
}
//AppSettings.Instance.AllAuctions.Add(auction);
if (auction.MinBid > 0)
{
auctions.Add(auction);
}
}
}
}
return auctions.AsQueryable();
}