private void bttLuu_Click(object sender, EventArgs e) { string sql; if (comboMaTour.Text.Length == 0) { MessageBox.Show("Bạn phải nhập mã tour", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); comboMaTour.Focus(); return; } if (comboMaKH.Text.Length == 0) { MessageBox.Show("Bạn phải nhập mã khách hàng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); comboMaKH.Focus(); return; } sql = "Select SoPhieuDK from DANGKI$ where SoPhieuDK='" + txtSoPhieu.Text + "'"; if (Functions.CheckKey(sql)) { MessageBox.Show("Không thể sửa thông tin đã đăng kí. Vui lòng tạo một đăng kí mới hoặc xóa đăng kí cũ !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } sql = "INSERT INTO DANGKI$ (SoPhieuDK, MaKH, MATOUR, MSNV , NgayDK, NgayHuyDK) Values (N'" + txtSoPhieu.Text + "', N'" + comboMaKH.SelectedValue + "', N'" + comboMaTour.SelectedValue + "', '" + comboMaNV.Text + "', '" + txtNgayDK.Text + "',NULL)"; Functions.RunSQL(sql); Danh_mục_phiếu_đăng_kí dkp = new Danh_mục_phiếu_đăng_kí(); dkp.StartPosition = FormStartPosition.CenterParent; dkp.ShowDialog(); dkp.LoadDataGridViewDK(); Reset_ValuesDK(); }
private void bttSua_Click(object sender, EventArgs e) { string sql; txtNgayHuyDK.Text = DateTime.Now.ToString().Trim(); sql = "UPDATE DANGKI$ SET NgayHuyDK='" + txtNgayHuyDK.Text + "' where SoPhieuDK=N'" + txtSoPhieu.Text + "'"; Functions.RunSQL(sql); Reset_ValuesDK(); Danh_mục_phiếu_đăng_kí dkp = new Danh_mục_phiếu_đăng_kí(); dkp.StartPosition = FormStartPosition.CenterParent; dkp.ShowDialog(); dkp.LoadDataGridViewDK(); Reset_ValuesDK(); }
private void bttXoa_Click(object sender, EventArgs e) { string sql; if (txtSoPhieu.Text == "") { MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sql = "DELETE FROM DANGKI$ WHERE SoPhieuDK=N'" + txtSoPhieu.Text + "'"; Functions.RunSqlDel(sql); Danh_mục_phiếu_đăng_kí dkp = new Danh_mục_phiếu_đăng_kí(); dkp.StartPosition = FormStartPosition.CenterParent; dkp.ShowDialog(); dkp.LoadDataGridViewDK(); Reset_ValuesDK(); } }
private void toolStripMenuItem11_Click(object sender, EventArgs e) { Danh_mục_phiếu_đăng_kí dk = new Danh_mục_phiếu_đăng_kí(); dk.ShowDialog(); }