private void btnNotShowProduct_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Toàn bộ số công ty trong group sẽ bị ẩn. Đồng ý", "Queuesion", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { ProductAdapter productAdapter = new ProductAdapter(new Entities.Data.SqlDb(QT.Entities.Server.ConnectionString)); int TypeCompany = Convert.ToInt32(lookUpEdit1.EditValue); if (TypeCompany > 0) { DataTable tblCompanyNeedNotShow = productAdapter.GetListCompanyByStatus(TypeCompany); if (tblCompanyNeedNotShow != null && tblCompanyNeedNotShow.Rows.Count > 0) { foreach (DataRow row in tblCompanyNeedNotShow.Rows) { bool bOK = productAdapter.UpdateNotShowProductForCompany(Convert.ToInt64(row["id"]), false); if (bOK == false && MessageBox.Show("Xem log lỗi. Chạy tiếp compnay tiếp?", "Question", MessageBoxButtons.YesNo , MessageBoxIcon.Question) == DialogResult.Yes) { break; } } MessageBox.Show("Success!"); } } } } catch (Exception ex01) { MessageBox.Show(ex01.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }