private KoltukBilgilerListe koltukListeyeAt(string seferNo, string tarih) { KoltukBilgilerListe temp = new KoltukBilgilerListe(); string numara = ""; string yolcuAdi = ""; string yolcuCinsiyeti = ""; string durum = ""; string dosya_yolu = System.Windows.Forms.Application.StartupPath + "\\" + tarih + ".txt"; FileStream fs = new FileStream(dosya_yolu, FileMode.Open, FileAccess.Read); StreamReader sw = new StreamReader(fs); string yazi = sw.ReadLine(); while (!yazi.Contains("Sefer No: '" + seferNo + "'")) { yazi = sw.ReadLine(); if (yazi == null) { Console.WriteLine("Aradığınız sefer bulunamadı.."); sw.Close(); fs.Close(); return(temp); } } for (int i = 0; i < 11; i++) { yazi = sw.ReadLine(); } while (!yazi.Contains("-")) { if (yazi.Contains("Koltuk")) { numara = elemanAyir(yazi); } else if (yazi.Contains("Yolcu Adı")) { yolcuAdi = elemanAyir(yazi); } else if (yazi.Contains("Cinsiyet")) { yolcuCinsiyeti = elemanAyir(yazi); } else if (yazi.Contains("Durum")) { durum = elemanAyir(yazi); temp.Ekle(numara, yolcuAdi, yolcuCinsiyeti, durum); } yazi = sw.ReadLine(); } sw.Close(); fs.Close(); return(temp); }
public void Ekle(string seferNo, string saat, string guzergah, string kapasite, int fiyat, string tarih, string plaka, string kaptan, KoltukBilgilerListe koltukbilgileri) { SeferBilgisiDugum temp; temp = head; tag: if (temp.seferNo == null) { temp.seferNo = seferNo; temp.tarih = tarih; temp.saat = saat; temp.guzergah = guzergah; temp.kapasite = kapasite; temp.plaka = plaka; temp.kaptan = kaptan; temp.fiyat = fiyat; temp.koltukBilgileri = koltukbilgileri; temp.sonraki = new SeferBilgisiDugum(); } else { temp = temp.sonraki; goto tag; } }