private void btnXoa_Click(object sender, EventArgs e) { if (MyPublics.TonTaiKhoaChinh(txtMaCanBo.Text, "MA_CB", "THIETBITHANHLY")) { MessageBox.Show("Phải xóa những thiết bị do cán bộ này thanh lý trước!"); } else { DialogResult blnDongY; blnDongY = MessageBox.Show("Bạn thật sự muốn xóa?", "Xác nhận", MessageBoxButtons.YesNo); if (blnDongY == DialogResult.Yes) { string strDelete = "Delete CANBO Where MA_CB = @MA_CB"; if (MyPublics.conMyConnection.State == ConnectionState.Closed) { MyPublics.conMyConnection.Open(); } SqlCommand cmdCommand = new SqlCommand(strDelete, MyPublics.conMyConnection); cmdCommand.Parameters.AddWithValue("@MA_CB", txtMaCanBo.Text); cmdCommand.ExecuteNonQuery(); MyPublics.conMyConnection.Close(); dgvCanBo.Rows.RemoveAt(dgvCanBo.CurrentRow.Index); GanDuLieu(); } } DieuKhienKhiBinhThuong(); }
private void btnXoa_Click(object sender, EventArgs e) { if (MyPublics.TonTaiKhoaChinh(txtMaThietBi.Text, "MA_TB", "THIETBITHANHLY")) { MessageBox.Show("Thiết bị này đang thanh lý, vui lòng hủy thanh lý trước khi xóa !", "Thông báo"); } else { DialogResult blnDongY; blnDongY = MessageBox.Show("Bạn thật sự muốn xóa ?", "Xác nhận", MessageBoxButtons.YesNo); if (blnDongY == DialogResult.Yes) { string strSelect = "Delete THIETBI Where MA_TB = @MaThietBi"; if (MyPublics.conMyConnection.State == ConnectionState.Closed) { MyPublics.conMyConnection.Open(); } SqlCommand cmdCommand = new SqlCommand(strSelect, MyPublics.conMyConnection); cmdCommand.Parameters.AddWithValue("@MaThietBi", txtMaThietBi.Text); cmdCommand.ExecuteNonQuery(); MyPublics.conMyConnection.Close(); dgvThietBi.Rows.RemoveAt(dgvThietBi.CurrentRow.Index); GanDuLieu(); } } DieuKhienKhiBinhThuong(); }
private void btnLuu_Click(object sender, EventArgs e) { float TGBaoHanh, TLHaoMon, GiaTri; if ((txtMaThietBi.Text == "") || (txtBoMon.Text == "") || (txtGiaTri.Text == "") || (txtMaPhong.Text == "") || (txtTenThietBi.Text == "") || (txtThoiGianBaoHanh.Text == "") || (txtTiLeHaoMon.Text == "") || (cboTinhTrang.SelectedIndex == -1) || (cboLoaiThietBi.SelectedIndex == -1) || (!float.TryParse(txtThoiGianBaoHanh.Text, out TGBaoHanh)) || (TGBaoHanh < 0) || (!float.TryParse(txtTiLeHaoMon.Text, out TLHaoMon)) || (TLHaoMon < 0) || (!float.TryParse(txtGiaTri.Text, out GiaTri)) || (GiaTri < 0)) { MessageBox.Show("Lỗi nhập dữ liệu !"); } else if ((ThemSua == 1) && ((MyPublics.TonTaiKhoaChinh(txtMaThietBi.Text, "MA_TB", "THIETBI")))) { MessageBox.Show("Mã thiết bị này đã có rồi !"); txtMaThietBi.Focus(); } else { ThucThiLuu(); cboLoaiThietBi.SelectedIndex = ViTriThietBi; } }
private void btnLuu_Click(object sender, EventArgs e) { if (MyPublics.TonTaiKhoaChinh(txtMaThietBi.Text, "MA_TB", "THIETBITHANHLY")) { MessageBox.Show("Đã thanh lý thiết bị này rồi !", "Thông báo"); } else { ThucThiLuu(); } }
private void btnLuu_Click(object sender, EventArgs e) { if ((txtMaCanBo.Text == "") || (txtTenCanBo.Text == "") || (cboTenBoMon.SelectedIndex == -1) || (cboQuyenSuDung.SelectedIndex == -1)) { MessageBox.Show("Lỗi nhập dữ liệu!"); } else if ((ThemSua == 1) && (MyPublics.TonTaiKhoaChinh(txtMaCanBo.Text, "MA_CB", "CANBO"))) { MessageBox.Show("Mã cán bộ này đã tồn tại, vui lòng nhập mã khác!"); txtMaCanBo.Focus(); } else { ThucThiLuu(); } }
private void btnLuu_Click(object sender, EventArgs e) { if ((txtMaPhong.Text == "") || (txtTenPhong.Text == "") || (cboTenBoMon.SelectedIndex == -1)) { MessageBox.Show("Lỗi nhập dữ liệu!"); } else if ((ThemSua == 1) && (MyPublics.TonTaiKhoaChinh(txtMaPhong.Text, "MA_PHONG", "PHONG")) && (MyPublics.TonTaiKhoaChinh(cboTenBoMon.SelectedValue.ToString(), "MA_BM", "PHONG"))) { MessageBox.Show("Mã phòng thuộc bộ môn này đã tồn tại, vui lòng nhập mã khác!", "Thông báo"); txtMaPhong.Focus(); } else { ThucThiLuu(); } }
private void btnXoa_Click(object sender, EventArgs e) { if (MyPublics.TonTaiKhoaChinh(txtMaBoMon.Text, "MA_BM", "CANBO")) { MessageBox.Show("Phải xóa cán bộ thuộc bộ môn này trước!", "Thông báo"); } else { DialogResult blnDongY; blnDongY = MessageBox.Show("Bạn có muốn xóa?", "Xác nhận", MessageBoxButtons.YesNo); if (blnDongY == DialogResult.Yes) { bsBoMon.RemoveCurrent(); daBoMon.Update(dsBoMon, "BOMON"); dsBoMon.AcceptChanges(); } } DieuKhienKhiBinhThuong(); }
private void btnXoa_Click(object sender, EventArgs e) { if (MyPublics.TonTaiKhoaChinh(txtMaLoai.Text, "MA_LOAI", "THIETBI")) { MessageBox.Show("Phải xóa thiết bị thuộc loại này trước !"); } else { DialogResult blnDongY; blnDongY = MessageBox.Show("Bạn thật sự muốn xóa ?", "Xác nhận", MessageBoxButtons.YesNo); if (blnDongY == DialogResult.Yes) { bsLoaiThietBi.RemoveCurrent(); daLoaiThietBi.Update(dsLoaiThietBi, "LoaiThietBi"); dsLoaiThietBi.AcceptChanges(); } } DieuKhienKhiBinhThuong(); }
private void btnLuu_Click(object sender, EventArgs e) { if ((txtMaLoai.Text == "") || (txtTenLoai.Text == "")) { MessageBox.Show("Lỗi nhập dữ liệu !"); } else if (blnThem && MyPublics.TonTaiKhoaChinh(txtMaLoai.Text, "MA_LOAI", "LoaiThietBi")) { MessageBox.Show("Mã loại này đã có rồi!"); txtMaLoai.Focus(); } else { bsLoaiThietBi.EndEdit(); daLoaiThietBi.Update(dsLoaiThietBi, "LoaiThietBi"); dsLoaiThietBi.AcceptChanges(); blnThem = false; DieuKhienKhiBinhThuong(); } }