Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }