Beispiel #1
0
        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);
        }
Beispiel #2
0
 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 đủ");
     }
 }
Beispiel #3
0
 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 đủ");
     }
 }
Beispiel #4
0
 public bool updateKTKL(DTO_KhenThuongKyLuat ktkl)
 {
     return(dalKTKL.updateKTKL(ktkl));
 }
Beispiel #5
0
 public bool insertKTKL(DTO_KhenThuongKyLuat ktkl)
 {
     return(dalKTKL.insertKTKL(ktkl));
 }