Exemplo n.º 1
0
 private Boolean OChuaDay(OChua oChua)
 {
     if (oChua.SOLUONG >= 5)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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--;
            }
        }
Exemplo n.º 5
0
        private void AddSachOnNewOChua(List <OChua> lstOChua, String MaSach)
        {
            OChua oChua = new OChua(Function.SinhMa("OChua"), MaSach, 1);

            lstOChua.Add(oChua);
        }