BKI_DichVuMatDat.NghiepVu.NhanSu.f329_lap_hop_dong_v5.delete_data C# (CSharp) Метод

delete_data() приватный Метод

private delete_data ( ) : void
Результат void
        private void delete_data()
        {
            int[] v_selected_row = m_grv.GetSelectedRows();
            if(v_selected_row.Length > 1)
            {
                XtraMessageBox.Show("Bạn chỉ được chọn 1 dòng để xóa!", "Xác nhận", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            int v_focused_row = m_grv.FocusedRowHandle;
            if(v_focused_row >= 0)
            {
                string v_str_confirm = "Bạn có chắc chắn muốn xóa hợp đồng này?\nViệc xóa hợp đồng chỉ nên thực hiện khi bạn cập nhật sai.\nViệc xóa hợp đồng có thể ảnh hưởng tới các dữ liệu tiền lương đã tính trước đó!";
                DialogResult v_dialog = XtraMessageBox.Show(v_str_confirm, "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                if(v_dialog == DialogResult.Yes)
                {
                    decimal v_id_hop_dong = Convert.ToDecimal(m_grv.GetRowCellValue(v_focused_row, "ID"));
                    US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(v_id_hop_dong);
                    v_us.Delete();
                    XtraMessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    load_data_to_grid();
                }
            }
            else
            {
                string v_str_error = "Bạn chưa chọn hợp đồng để xóa!";
                XtraMessageBox.Show(v_str_error, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }