Esempio n. 1
0
    public List<string> IlListesi()
    {
        HtmlAgilityPack.HtmlWeb htmlweb = new HtmlAgilityPack.HtmlWeb();
        string htmlContext = GetContent("http://www.illerarasimesafe.com/");
        HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
        document.LoadHtml(htmlContext);
        List<IlList> illist = new List<IlList>();
        HtmlNodeCollection element = document.DocumentNode.SelectNodes("//*[contains(@class,'selectBox')]");
        int sayac = 0;
        foreach (HtmlNode item in element)
        {
            sayac += 1;
            IlList il = new IlList();
            if (sayac == 1)
            {

                il.il_adi = item.InnerText;
            }
            illist.Add(il);

        }
        List<string> il_listesi=new List<string>();
        foreach (var item in illist)
        {
            try
            {
                string[] iller = item.il_adi.ToString().Replace("\t\t", "").Replace(" ", "").Split('\n');
                int sayac1 = 0;
                foreach (string sehir in iller)
                {
                    sayac1= sayac1 + 1;
                    if (sayac1 == 2)
                    {
                        il_listesi.Add("ADANA");
                        sayac1 = sayac1 + 1;
                    }
                    if (sayac1 == 3 || sayac1== 1)
                    {
                        continue;
                    }
                    il_listesi.Add(sehir.ToUpper());

                }
            }
            catch { }

        }
        return il_listesi;
    }
Esempio n. 2
0
 private List<IlList> MesafeAndSaat(string ilksehir, string ilkilce, string ikincisehir, string ikinciIlce)
 {
     HtmlAgilityPack.HtmlWeb htmlweb = new HtmlAgilityPack.HtmlWeb();
     string htmlContext = GetContent("http://www.illerarasimesafe.com/" + ilksehir.ToLower() + "-" + ilkilce.ToLower() + "_" + ikincisehir.ToLower() + "-" + ikinciIlce.ToLower() + "/");
     HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
     document.LoadHtml(htmlContext);
     List<IlList> illist = new List<IlList>();
     HtmlNodeCollection element = document.DocumentNode.SelectNodes("//div[contains(@class,'result')]//span");
     int sayac = 0;
     foreach (HtmlNode item in element)
     {
         sayac += 1;
         IlList il = new IlList();
         if (sayac < 3)
         {
             il.il_adi = item.InnerText;
         }
         illist.Add(il);
     }
     return illist;
 }
Esempio n. 3
0
    private List<IlList> IlceListesi(string il_adi)
    {
        HtmlAgilityPack.HtmlWeb htmlweb = new HtmlAgilityPack.HtmlWeb();
        string htmlContext = GetContent("http://www.illerarasimesafe.com/" + il_adi.ToLower());
        HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
        document.LoadHtml(htmlContext);
        List<IlList> illist = new List<IlList>();
        HtmlNodeCollection element = document.DocumentNode.SelectNodes("//*[contains(@class,'searched')]//ul");
        int sayac = 0;
        foreach (HtmlNode item in element)
        {
            sayac += 1;
            IlList il = new IlList();
            if (sayac == 1)
            {

                il.il_adi = item.InnerText;
            }
            illist.Add(il);

        }
        return illist;
    }