예제 #1
0
 private List<MinPriceDetail> GetListPrices(HtmlNode nodeTemp, DateTime dateTime)
 {
     if (nodeTemp == null)
     {
         return null;
     }
     List<MinPriceDetail> l = new List<MinPriceDetail>();
     HtmlNodeCollection nodesTds = nodeTemp.SelectNodes(".//td[contains(@class,'fareClass')]");
     foreach (HtmlNode node1 in nodesTds)
     {
         try
         {
             MinPriceDetail mdt = new MinPriceDetail();
             mdt.Price = node1.SelectSingleNode("div/p").InnerText.Replace(",", "");
             node1.SelectSingleNode("div").RemoveChild(node1.SelectSingleNode("div/p"));
             string day = node1.SelectSingleNode("div").InnerText;
             mdt.Date = new DateTime(dateTime.Year, dateTime.Month, int.Parse(day));
             l.Add(mdt);
         }
         catch { }
     }
     return l;
 }
예제 #2
0
 private List<MinPriceDetail> GetListPrices(HtmlNodeCollection nodeTemp)
 {
     if (nodeTemp == null)
     {
         return null;
     }
     List<MinPriceDetail> l = new List<MinPriceDetail>();
     foreach (HtmlNode nodeLi in nodeTemp)
     {
         try
         {
             MinPriceDetail mpd = new MinPriceDetail();
             mpd.Date = DateTime.ParseExact(nodeLi.Attributes["data-date"].Value, "d/M/yyyy", CultureInfo.InvariantCulture);
             mpd.Price = nodeLi.Attributes["data-price"].Value.Replace(",", "");
             l.Add(mpd);
         }
         catch { }
     }
     return l;
 }