private void rdbtntralai_CheckedChanged(object sender, EventArgs e) { try { if (rdbtntralai.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.LSGDTraLaiNCC lsgd = new Entities.LSGDTraLaiNCC(); // truyền HanhDong lsgd = new Entities.LSGDTraLaiNCC("Select", txtMaNCC.Text); clientstrem = cl.SerializeObj(this.client1, "LSGDTraLaiNCC", lsgd); // khởi tạo mảng đối tượng để hứng giá trị Entities.LSGDTraLaiNCC[] lsgd1; lsgd1 = new Entities.LSGDTraLaiNCC[1]; // đổ mảng đối tượng vào datagripview lsgd1 = (Entities.LSGDTraLaiNCC[])cl.DeserializeHepper1(clientstrem, lsgd1); if (lsgd1 == null) { dataGridView1.DataSource = new Entities.LSGDTraLaiNCC[0]; return; } Entities.LSGDTraLaiNCC[] pt3 = new Entities.LSGDTraLaiNCC[lsgd1.Length]; int sotang = 0; for (int j = 0; j < lsgd1.Length; j++) { pt3[sotang] = lsgd1[j]; sotang++; } hienthi2 = new Entities.LSGDTraLaiNCC[sotang]; if (sotang != 0) { for (int j = 0; j < sotang; j++) { hienthi2[j] = pt3[j]; } } else { dataGridView1.DataSource = new Entities.LSGDTraLaiNCC[0]; return; } dataGridView1.DataSource = hienthi2; 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ã Hóa Đơn Trả Lại NCC"; dataGridView1.Columns[3].Visible = true; dataGridView1.Columns[3].HeaderText = "Ngày Trả"; dataGridView1.Columns[4].Visible = true; dataGridView1.Columns[4].HeaderText = "Hình Thức Thanh Toán"; dataGridView1.Columns[5].Visible = true; dataGridView1.Columns[5].HeaderText = "Ghi Chú"; dataGridView1.Columns[6].HeaderText = "Thanh Toán Ngay"; dataGridView1.Columns[6].Visible = true; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.AllowUserToAddRows = false; dataGridView1.AllowUserToDeleteRows = false; dataGridView1.AllowUserToResizeRows = false; } catch { } } }