Пример #1
0
 private Boolean OChuaDay(OChua oChua)
 {
     if (oChua.SOLUONG >= 5)
     {
         return(true);
     }
     return(false);
 }
Пример #2
0
        public OChua getOChuaByMa(String MaOChua, List <OChua> lstOChua)
        {
            if (lstOChua.Count == 0)
            {
                return(null);
            }
            OChua ochua = new OChua();

            for (int i = 0; i < lstOChua.Count; i++)
            {
                if (lstOChua[i].MaOCHUA == MaOChua)
                {
                    ochua = lstOChua[i];
                }
            }
            return(ochua);
        }
Пример #3
0
        public OChua getSLMinOChua(List <OChua> lstOChua)
        {
            if (lstOChua.Count == 0)
            {
                return(null);
            }
            OChua oChua = lstOChua[0];

            for (int i = 1; i < lstOChua.Count; i++)
            {
                if (lstOChua[i].SOLUONG < oChua.SOLUONG)
                {
                    oChua = lstOChua[i];
                }
            }
            return(oChua);
        }
Пример #4
0
        public void DeleteFromOChua(String MaOChua, List <OChua> lstOChua)
        {
            OChua ochua = new OChua();

            if (MaOChua == "")
            {
                ochua = getSLMinOChua(lstOChua);
            }
            else
            {
                ochua = getOChuaByMa(MaOChua, lstOChua);
            }
            if (ochua.SOLUONG == 1)
            {
                lstOChua.Remove(ochua);
            }
            else
            {
                ochua.SOLUONG--;
            }
        }
Пример #5
0
        private void AddSachOnNewOChua(List <OChua> lstOChua, String MaSach)
        {
            OChua oChua = new OChua(Function.SinhMa("OChua"), MaSach, 1);

            lstOChua.Add(oChua);
        }