Exemplo n.º 1
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (p_ma_tuyen_dung_old != null)
                {
                    if (MessageBox.Show("Bạn thực sự muốn xoá hợp đồng này?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        oHopdong = new Business.HDQD.CNVC_HopDong();
                        oHopdong.Delete(thongTinCNVC1.txt_MaNV.Text, p_ma_tuyen_dung_old);

                        MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Xoá không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Hợp đồng chưa được nhập. Không thể xóa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Có lỗi xảy ra!\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (dtgv_DSHD.CurrentRow != null)
     {
         if (MessageBox.Show("Bạn thực sự muốn xoá hợp đồng này?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             try
             {
                 string m_ma_nv         = dtgv_DSHD.CurrentRow.Cells["ma_nv"].Value.ToString();
                 string m_ma_tuyen_dung = dtgv_DSHD.CurrentRow.Cells["ma_hop_dong"].Value.ToString();
                 if (oHopDong.Delete(m_ma_nv, m_ma_tuyen_dung))
                 {
                     MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 RefreshDataSource();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Xóa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }