private void cmbMaNhanPhong_SelectedIndexChanged(object sender, EventArgs e) { HoaDonControl hdctrl = new HoaDonControl(); HoaDonInFo hdi = hdctrl.LayHoaDon(cmbMaNhanPhong.SelectedValue.ToString()); ChiTietPhieuNhanControl pnctrl = new ChiTietPhieuNhanControl(); ChiTietHoaDonInFo cthdi = new ChiTietHoaDonInFo(); int songay = pnctrl.TinhSoNgay(cthdi.SoNgay); try { numSoNgay.Value = TinhSoNgay(Convert.ToString(cmbMaNhanPhong.SelectedValue.ToString())); } catch (Exception ex) { } }
private void dataGridViewX1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { if (MessageBox.Show("Bạn có chắc chắn xóa không?", "Phieu Nhan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { DataRowView view = (DataRowView)bindingNavigator1.BindingSource.Current; ChiTietPhieuNhanControl ctrl = new ChiTietPhieuNhanControl(); IList <ChiTietPhieuNhanPhongInFo> ds = ctrl.ChiTietPhieuNhan(view["MaNhanPhong"].ToString()); ctrl.Save(); } }