private void datahoadon_CellContentClick(object sender, DataGridViewCellEventArgs e) { int dong; dong = datahoadon.CurrentRow.Index; txtsoHD.Text = datahoadon[1, dong].Value.ToString(); dateTimePicker1.Value = DateTime.Parse(datahoadon[2, dong].Value.ToString()); cbnhanvien.Text = datahoadon[3, dong].Value.ToString(); dataCTHD.DataSource = CTHD_BLL.CTHD_Select_Where(txtsoHD.Text); }
private void butluuHD_Click(object sender, EventArgs e) { var HoaDon_BLL = new HoaDon_BLL(); string MaKH = comboBox1.SelectedValue.ToString(); string MaNV = cbnhanvien.SelectedValue.ToString(); datahoadon.DataSource = HoaDon_BLL.HoaDon_Insert(txtsoHD.Text, MaKH, MaNV, DateTime.Parse(dateTimePicker1.Value.ToString()), "Khó Quá", "Tiền Mặt"); datahoadon.DataSource = HoaDon_BLL.HoaDon_Select_Where(txtsoHD.Text); foreach (DataRow dr in CTHD.Rows) { var CTHD_BLL = new CTHD_BLL(); dataCTHD.DataSource = CTHD_BLL.CTHD_Insert(txtsoHD.Text, dr[0].ToString(), int.Parse(txtsoluong.Text)); dataCTHD.DataSource = CTHD_BLL.CTHD_Select_Where(txtsoHD.Text); } CTHD.Clear(); CTHD_HOADON_Load(sender, e); }