public void SuaKhachThue(KhachThue khachthue) { int vitritim = ds.IndexOf(khachthue); if (vitritim > 0) { ds[vitritim] = khachthue; } }
public bool ThemKhachThue(KhachThue khachthue) { if (ds.Contains(khachthue)) { return(false); } else { ds.Add(khachthue); return(true); } }
public bool XoaKhachThue(KhachThue khachthue) { if (khachthue != null)//tim thay { ds.Remove(khachthue); return(true); } else { return(false); } }
// 3 nhap vao doi tuong => danh sach => listview private void btnTinhThue_Click(object sender, EventArgs e) { KhachThue khach = new KhachThue(); khach.MaKhachHang = Convert.ToInt32(txtMaKhachHang.Text); khach.TenKhachHang = txtHoTenKhachHang.Text; khach.SoLuong = Convert.ToInt32(cboSoLuong.SelectedIndex.ToString()); khach.DonGia = Convert.ToInt32(txtDonGia.Text); if (chkDungHan2.Checked) { khach.TraDungTre = true; } else { khach.TraDungTre = false; } dskt.ThemKhachThue(khach); LoadDanhSachListView(dskt.GetAllDanhSach()); }