public List <GoiChup> GetGoichupList() { List <GoiChup> list = new List <GoiChup>(); DataTable table = DataProvider.Instance.ExecuteQuery("select MaGoiChup, Loai, DiaDiem, GiaTien, TinhTrang, MaLoaiGC, TenLoaiGC from GOICHUP, LOAIGOICHUP where GOICHUP.Loai=LOAIGOICHUP.MaLoaiGC"); foreach (DataRow row in table.Rows) { GoiChup gc = new GoiChup(row); list.Add(gc); } return(list); }
public List <GoiChup> GetGoichupListByLoaigc(int maloaigc) { List <GoiChup> list = new List <GoiChup>(); var query = string.Format("select * from GOICHUP where Loai={0} and TinhTrang=N'Đang sử dụng'", maloaigc); DataTable table = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow row in table.Rows) { GoiChup gc = new GoiChup(row); list.Add(gc); } return(list); }
private void btnChoose_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvGoichup.Rows) { DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell; if (cell.Value != null) { if (cell.Value == cell.TrueValue) { var magoichup = _GoichupList[dgvGoichup.SelectedRows[0].Index].MaGoiChup; GoiChup goichup = GoiChupDAO.Instance.GetgoichupByMagc(magoichup); _Goichupduocchon.Add(goichup); } } } GoiChup(); this.Close(); }