private int TimAPTuaDeMax(DanhSachAnPham a) { int max = int.MinValue; foreach (var item in a.dsap) { if (item is Sach) { Sach s = (Sach)item; if (s.TuaDe.Length > max) { max = s.TuaDe.Length; } } if (item is TapChi) { TapChi tc = (TapChi)item; if (tc.TuaDe.Length > max) { max = tc.TuaDe.Length; } } } return(max); }
public DanhSachAnPham HienThiAPTuaDeMax(DanhSachAnPham a) { DanhSachAnPham kq = new DanhSachAnPham(); int max = TimAPTuaDeMax(a); foreach (var item in a.dsap) { if (item is Sach) { Sach s = (Sach)item; if (s.TuaDe.Length == max) { kq.Them(item); } } if (item is TapChi) { TapChi tc = (TapChi)item; if (tc.TuaDe.Length == max) { kq.Them(item); } } } return(kq); }
public int TimSLBVMax() { int max = int.MinValue; foreach (var item in dsap) { if (item is TapChi) { TapChi tc = (TapChi)item; if (tc.SoBaiViet > max) { max = tc.SoBaiViet; } } } return(max); }
public DanhSachAnPham TCSLBVMax(DanhSachAnPham a) { DanhSachAnPham ds = new DanhSachAnPham(); ds = DSTC(a); int max = ds.TimSLBVMax(); DanhSachAnPham kq = new DanhSachAnPham(); foreach (var item in ds.dsap) { if (item is TapChi) { TapChi tc = (TapChi)item; if (tc.SoBaiViet == max) { kq.Them(item); } } } return(kq); }