public void writeFile(string fileName, Xe xe) { StreamWriter sw = new StreamWriter(fileName, true, Encoding.Unicode); sw.WriteLine(xe.toString()); sw.Close(); }
public void xulytimkiem(ref QuanLyXe ql) { bool home; do { home = false; switch (MenuTimkiem()) { case 1: Console.Write("Nhập biển số xe cần tìm kiếm:"); string bsx = Console.ReadLine(); Xe xe = ql.TimKiemTheoBienSoXe(bsx); if (xe == null) { Console.WriteLine("KHÔNG TÌM THẤY!"); } ql.hienBSX(xe); Console.ReadKey(); break; case 2: Console.Write("Nhập tên nhà xe cần tìm kiếm:"); string ten = Console.ReadLine(); List <Xe> listtmp = ql.TimKiemTheoTenNhaXe(ten); if (ten == null) { Console.WriteLine("KHÔNG TÌM THẤY!"); } ql.hienList(listtmp); Console.ReadKey(); break; case 3: Console.Write("Nhập lộ trình cần tìm kiếm:"); string lt = Console.ReadLine(); List <Xe> Lotrinh = ql.TimKiemTheoLoTrinh(lt); if (lt == null) { Console.WriteLine("KHÔNG TÌM THẤY!"); } ql.hienList(Lotrinh); Console.ReadKey(); break; case 4: Console.Write("Nhập thời gian cần tìm kiếm:"); string tg = Console.ReadLine(); List <Xe> thoigian = ql.TimKiemTheoThoiGianXB(tg); if (tg == null) { Console.WriteLine("KHÔNG TÌM THẤY!"); } ql.hienList(thoigian); Console.ReadKey(); break; case 5: home = true; break; case 6: Environment.Exit(0); Console.ReadKey(); break; } } while (home == false); }
public void hienBSX(Xe xe) { Console.InputEncoding = Encoding.UTF8; Console.WriteLine("XE CAN TIM KIEM LA:"); Console.WriteLine("BienSoXe NhaXe DienThoai LoTrinh SoGhe TGXuatBen TGVeBen"); Console.WriteLine((String.Format(xe.BienSoXe + '\t' + xe.NhaXe + '\t' + xe.DienThoai + '\t' + xe.LoTrinh + '\t' + xe.SoGhe + '\t' + xe.TgXb + '\t' + xe.TgVb))); }
public VeXe(String ve) { string[] mp = ve.Split('#'); this.tg = mp[0]; this.xe = new Xe(); this.xe.BienSoXe = mp[1]; this.giaVe = int.Parse(mp[2]); this.soLuongban = int.Parse(mp[3]); }
public void them(Xe xe) { if (TimKiemTheoBienSoXe(xe.BienSoXe) != null) { Console.WriteLine(" Err: Da ton tai xe co bien so xe " + xe.BienSoXe + " trong he thong"); } else { lstQuanlyXe.Add(xe); writeFile("Xe.txt", xe); } }
public void nhap() { int next; Xe xe; do { xe = new Xe(); xe.nhap(); them(xe); Console.Write("Nhap 1 de tiep tuc, de ket thuc nhap so khac!"); next = int.Parse(Console.ReadLine()); } while (next == 1); }
public void readFile(String fileName) { lstQuanlyXe = new List <Xe>(); StreamReader sr = new StreamReader(fileName); String tmp; Xe xe; while (sr.EndOfStream == false) { tmp = sr.ReadLine().Trim(); if (tmp == "") { continue; } xe = new Xe(tmp); lstQuanlyXe.Add(xe); } sr.Close(); }
public void xoa() { string bsx; Console.Write("Nhap Bien Xe can xoa:"); bsx = Console.ReadLine(); Xe m = null; for (int i = 0; i < lstQuanlyXe.Count; i++) { if (lstQuanlyXe[i].BienSoXe.Equals(bsx)) { m = lstQuanlyXe[i]; break; } } lstQuanlyXe.Remove(m); writeFile(lstQuanlyXe); Console.WriteLine("XOA THANH CONG !"); }
public void UpDaTeBsx() { string bsx; Console.Write("Nhập biển số xe cần cập nhật:"); bsx = Console.ReadLine(); Xe xe = TimKiemTheoBienSoXe(bsx); if (xe == null) { Console.WriteLine("Không có biển số xe nào là:" + bsx); } else { xe.update(); } { Console.WriteLine("CẬP NHẬT THÀNH CÔNG!"); } }
public ThongKe(Xe xe, int SoLuongVe, double TongTien) { this.xe = xe; this.SoLuongVe = SoLuongVe; this.TongTien = TongTien; }
public VeXe() { xe = null; giaVe = 0; soLuongban = 0; }