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