private void rdbtnthanhtoan_CheckedChanged(object sender, EventArgs e) { try { if (rdbtnthanhtoan.Checked == true) { dataGridView1.RowHeadersVisible = false; cl = new Server_Client.Client(); // gán TCPclient this.client1 = cl.Connect(Luu.IP, Luu.Ports); // khởi tạo biến truyền vào với hàm khởi tạo Entities.LSGDTTNCC lsgd = new Entities.LSGDTTNCC(); // truyền HanhDong lsgd = new Entities.LSGDTTNCC("Select", mancc); clientstrem = cl.SerializeObj(this.client1, "LSGDTTNCC", lsgd); // khởi tạo mảng đối tượng để hứng giá trị Entities.LSGDTTNCC[] lsgd1; lsgd1 = new Entities.LSGDTTNCC[1]; // đổ mảng đối tượng vào datagripview lsgd1 = (Entities.LSGDTTNCC[])cl.DeserializeHepper1(clientstrem, lsgd1); if (lsgd1 == null) { dataGridView1.DataSource = new Entities.LSGDTTNCC[0]; return; } Entities.LSGDTTNCC[] pt3 = new Entities.LSGDTTNCC[lsgd1.Length]; int sotang = 0; for (int j = 0; j < lsgd1.Length; j++) { pt3[sotang] = lsgd1[j]; sotang++; } hienthi3 = new Entities.LSGDTTNCC[sotang]; if (sotang != 0) { for (int j = 0; j < sotang; j++) { hienthi3[j] = pt3[j]; } } else { dataGridView1.DataSource = new Entities.LSGDTTNCC[0]; return; } dataGridView1.DataSource = hienthi3; new Common.Utilities().CountDatagridview(dataGridView1); dataGridView1.Rows[0].Selected = true; } else { } } finally { try { for (int j = 1; j < dataGridView1.ColumnCount; j++) { dataGridView1.Columns[j].Visible = false; } dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].Visible = true; dataGridView1.Columns[1].HeaderText = "Mã Nhà Cung Cấp"; dataGridView1.Columns[2].Visible = true; dataGridView1.Columns[2].HeaderText = "Mã Phiếu TT NCC"; dataGridView1.Columns[3].Visible = true; dataGridView1.Columns[3].HeaderText = "Ngày Lập"; dataGridView1.Columns[4].Visible = true; dataGridView1.Columns[4].HeaderText = "Trạng Thái"; dataGridView1.Columns[5].Visible = true; dataGridView1.Columns[5].HeaderText = "Ghi Chú"; dataGridView1.Columns[6].HeaderText = "Thanh Toán "; dataGridView1.Columns[6].Visible = true; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.AllowUserToAddRows = false; dataGridView1.AllowUserToDeleteRows = false; dataGridView1.AllowUserToResizeRows = false; } catch { } } }