public bool insertKTKL(DTO_KhenThuongKyLuat ktkl) { try { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_InsertDataIntoKTKL"; cmd.Parameters.AddWithValue("maKTKL", ktkl.maKTKL); cmd.Parameters.AddWithValue("loai", ktkl.loai); cmd.Parameters.AddWithValue("moTa", ktkl.moTa); cmd.Parameters.AddWithValue("maNV", ktkl.maNV); if (cmd.ExecuteNonQuery() > 0) { return(true); } } catch (Exception) { } finally { conn.Close(); } return(false); }
private void btLuu_Click(object sender, EventArgs e) { if (txtMaKTKL.Text != "" && txtMoTa.Text != "" && cmbLoai.Text != "" && cmbMaNV.Text != "") { DTO_KhenThuongKyLuat ktkl = new DTO_KhenThuongKyLuat(txtMaKTKL.Text, txtMoTa.Text, cmbMaNV.Text, cmbLoai.SelectedIndex); if (busKTKL.insertKTKL(ktkl)) { MessageBox.Show("Thêm thành công"); LoadGridView_KTKL(); CloseTextbox(); } else { MessageBox.Show("Thêm không thành công"); } } else { MessageBox.Show("Xin hãy nhập đầy đủ"); } }
private void btSua_Click(object sender, EventArgs e) { if (txtMaKTKL.Text != "" && txtMoTa.Text != "" && cmbLoai.Text != "" && cmbMaNV.Text != "") { DTO_KhenThuongKyLuat ktkl = new DTO_KhenThuongKyLuat(txtMaKTKL.Text, txtMoTa.Text, cmbMaNV.Text, cmbLoai.SelectedIndex); if (MessageBox.Show("Bạn có chắc muốn sửa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (busKTKL.updateKTKL(ktkl)) { MessageBox.Show("Sửa thành công"); LoadGridView_KTKL(); CloseTextbox(); } else { MessageBox.Show("Sửa không thành công"); } } } else { MessageBox.Show("Xin hãy nhập đầy đủ"); } }
public bool updateKTKL(DTO_KhenThuongKyLuat ktkl) { return(dalKTKL.updateKTKL(ktkl)); }
public bool insertKTKL(DTO_KhenThuongKyLuat ktkl) { return(dalKTKL.insertKTKL(ktkl)); }