private void btnThemDU_Click(object sender, EventArgs e) { try { var o = new DoUong() { TenDoUong = txtTenDU.Text, IDLoai = int.Parse(cbbLoaiDU.SelectedValue.ToString()), GiaGoc = double.Parse(txtGiaGoc.Text), GiaBan = double.Parse(txtGiaBan.Text), SoLuong = int.Parse(txtSoLuong.Text), NgayNhapHang = dtPk.Value, DonViTinh = cbbDVT.Text }; MessageBox.Show(dtPk.Value.ToString()); using (var k = new AppCode.QuanCafe()) { var kq = k.ThemDoUong(o); if (kq == false) { MessageBox.Show("Thêm thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { LoadDSDoUong(); MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } catch { return; } }