private void LoadData() { DataTable dt = new DataTable(); dt = AccountFB.LoadDuLieuByNhanVien(taikhoan); gridControl1.DataSource = dt; }
//đánh giá trang, nhóm private void DanhGia(int kt) { foreach (ListViewItem item in lsKetQuaSearch.SelectedItems) { // thêm vào pages if (DrbtnLoaiTim.selectedIndex == 0) { tblPage pg = new tblPage(); pg.IDPage = lsIDPage[item.Index]; pg.Name = lsNamePage[item.Index]; pg.ImgLink = lsLinkImgPage[item.Index]; pg.Status = kt; pg.TaiKhoan = taikhoan; DAO.Pages.Them(pg); } //thêm vào groups if (DrbtnLoaiTim.selectedIndex == 1) { tblGroup newgroup = new tblGroup(); newgroup.IDGroup = lsIDPage[item.Index]; newgroup.Name = lsNamePage[item.Index]; newgroup.ImgLink = lsLinkImgPage[item.Index]; newgroup.Status = kt; newgroup.TaiKhoan = taikhoan; DAO.Group.Them(newgroup); DataTable dt = AccountFB.LoadDuLieuByNhanVien(taikhoan); for (int i = 0; i < dt.Rows.Count; i++) { ThuVienLamViecFacebook.DangXuat(); ThuVienLamViecFacebook.DNKhongLayTT(dt.Rows[i]["NumberIDAccount"].ToString()); ThuVienLamViecFacebook.JoinGroup(lsIDPage[item.Index]); } } //xóa cái vừa đánh giá khỏi danh sách lsIDPage.RemoveAt(item.Index); lsNamePage.RemoveAt(item.Index); lsLinkImgPage.RemoveAt(item.Index); lsKetQuaSearch.Items.RemoveAt(item.Index); } MessageBox.Show("Đã thêm vào danh sách"); }