private void button1_Click(object sender, EventArgs e) { BUS_HoaDon ihd = new BUS_HoaDon(); List <string> hd = new List <string>(); ; for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { List <string> cthd = new List <string>(); cthd.Add(txtCodeBill.Text); cthd.Add(dataGridView1.Rows[i].Cells[1].Value.ToString()); cthd.Add(dataGridView1.Rows[i].Cells[3].Value.ToString()); cthd.Add(dataGridView1.Rows[i].Cells[2].Value.ToString()); ihd.ChiTietHoaDon(cthd); } hd.Add(txtCodeBill.Text); hd.Add(txtCodeMember.Text); hd.Add(txtCodeStaff.Text); hd.Add(Convert.ToDateTime(dtpDateOfPrint.Text).ToString("MM/dd/yyyy")); hd.Add(txtSafe.Text); hd.Add(txtSum.Text); if (ihd.ThemHd(hd)) { MessageBox.Show("Đã thêm mới hoá đơn !", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Không thêm mới được hoá đơn ! Vui lòng thử lại !", "Lỗi ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }