265 lines
8.5 KiB
VB.net
265 lines
8.5 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class RH_CatCursosTemas
|
|
Inherits ClsPaginas
|
|
|
|
Private Sub RH_CatTemas_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
CargadatosGvTemas()
|
|
CargadatosGvSubtemas()
|
|
LoadComboTemas()
|
|
End Sub
|
|
|
|
|
|
#Region "Temas"
|
|
|
|
Private Sub CargadatosGvTemas()
|
|
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.TemasGet(-1, UsuarioActual.Empresa.CveEmpresa) Then
|
|
GvTemas.DataSource = objRH.DtResultados
|
|
Else
|
|
GvTemas.DataSource = Nothing
|
|
End If
|
|
objRH.Dispose()
|
|
|
|
GvTemas.DataBind()
|
|
UpGvTemas.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarTema_Click(sender As Object, e As EventArgs) Handles BtnAgregarTema.Click
|
|
LtlTituloModalTema.Text = "Agregar Tema"
|
|
TxtTema.Text = ""
|
|
ChkEstatusTema.Checked = True
|
|
HdModalTemaModalidad.Value = "I"
|
|
UpModalTema.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAgregarTema"))
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarTemaModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarTemaModal.Click
|
|
|
|
Dim objRH As New ClsRH
|
|
Dim estatus As Integer
|
|
Dim CveTema As Integer = HdCveTema.Value.ToEntero
|
|
If ChkEstatusTema.Checked Then
|
|
estatus = 1
|
|
Else
|
|
estatus = 0
|
|
End If
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAgregarTema"), "jsHideModalTema")
|
|
TabTemasSubtemas.ActiveTabIndex = 0
|
|
UpGral.Update()
|
|
If Not HdModalTemaModalidad.Value = "U" Then
|
|
If objRH.TemaAdd(TxtTema.Text, estatus, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa) Then
|
|
TxtTema.Text = ""
|
|
ChkEstatusTema.Checked = True
|
|
CargadatosGvTemas()
|
|
UpGvTemas.Update()
|
|
UpModalTema.Update()
|
|
Alert("Tema agregado correctamente.", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al guardar el tema.", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
If objRH.TemaUpdate(HdCveTema.Value.ToString.ToEntero, TxtTema.Text, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa, estatus) Then
|
|
|
|
TxtTema.Text = ""
|
|
ChkEstatusTema.Checked = True
|
|
CargadatosGvTemas()
|
|
UpGvTemas.Update()
|
|
UpModalTema.Update()
|
|
|
|
Alert("Tema actualizado correctamente.", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al actualizar el tema.", TipoMensaje.MsgError)
|
|
|
|
End If
|
|
End If
|
|
|
|
LoadComboTemas()
|
|
|
|
HdModalTemaModalidad.Value = "I"
|
|
objRH.Dispose()
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickTema(sender As Object, e As EventArgs)
|
|
Dim objRH As New ClsRH
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
Dim CveTema As Integer = GvRow.DataKey("CveTema")
|
|
|
|
If objRH.TemasRemove(CveTema) Then
|
|
CargadatosGvTemas()
|
|
LoadComboTemas()
|
|
Alert("Tema elimino correctamente ", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al eliminar el tema", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickTema(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
|
|
LtlTituloModalTema.Text = "Editar Tema"
|
|
HdModalTemaModalidad.Value = "U"
|
|
HdCveTema.Value = GvRow.DataKey("CveTema")
|
|
TxtTema.Text = GvRow.DataKey("Tema")
|
|
|
|
ChkEstatusTema.Checked = GvRow.DataKey("Estatus")
|
|
BtnAgregarTemaModal.Text = "Actualizar"
|
|
LoadComboTemas()
|
|
UpModalTema.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAgregarTema"))
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
#Region "Subtemas"
|
|
|
|
Private Sub LoadComboTemas()
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.TemasGet(1, UsuarioActual.Empresa.CveEmpresa) Then
|
|
DDlTema.DataSource = objRH.DtResultados
|
|
DDlTema.DataBind()
|
|
DDlTema.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
|
Else
|
|
DDlTema.DataSource = Nothing
|
|
End If
|
|
|
|
UpModalSubtema.Update()
|
|
objRH.Dispose()
|
|
|
|
End Sub
|
|
Private Sub CargadatosGvSubtemas()
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.SubtemasGet(-1, -1, UsuarioActual.Empresa.CveEmpresa) Then
|
|
GvSubtemas.DataSource = objRH.DtResultados
|
|
Else
|
|
GvSubtemas.DataSource = Nothing
|
|
End If
|
|
objRH.Dispose()
|
|
|
|
GvSubtemas.DataBind()
|
|
UpGvSubtemas.Update()
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarSubtema_Click(sender As Object, e As EventArgs) Handles BtnAgregarSubtema.Click
|
|
LtlTituloModalSubtema.Text = "Agregar Subtema"
|
|
TxtSubtema.Text = ""
|
|
ChkEstatusSubtema.Checked = True
|
|
HdModalSubtemaModalidad.Value = "I"
|
|
LoadComboTemas()
|
|
UpModalSubtema.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAgregarSubtema"))
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickSubtema(sender As Object, e As EventArgs)
|
|
Dim objRH As New ClsRH
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
Dim CveTema As Integer = GvRow.DataKey("CveSubtema")
|
|
|
|
If objRH.SubtemaRemove(CveTema) Then
|
|
CargadatosGvTemas()
|
|
Alert("Subtema Elimino Correctamente.", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al Eliminar el Subtema.", TipoMensaje.MsgError)
|
|
End If
|
|
LoadComboTemas()
|
|
CargadatosGvSubtemas()
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarSubtemaModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarSubtemaModal.Click
|
|
|
|
Dim objRH As New ClsRH
|
|
Dim estatus As Integer = 0
|
|
|
|
If ChkEstatusSubtema.Checked Then
|
|
estatus = 1
|
|
Else
|
|
estatus = 0
|
|
End If
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAgregarSubtema"), "jsHideModalSubtema")
|
|
|
|
TabTemasSubtemas.ActiveTabIndex = 1
|
|
UpGral.Update()
|
|
If Not HdModalSubtemaModalidad.Value = "U" Then
|
|
If objRH.SubtemaAdd(TxtSubtema.Text, DDlTema.SelectedValue.ToEntero, estatus, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa) Then
|
|
TxtSubtema.Text = ""
|
|
ChkEstatusSubtema.Checked = True
|
|
DDlTema.SelectedIndex = 0
|
|
|
|
CargadatosGvSubtemas()
|
|
UpGvSubtemas.Update()
|
|
UpModalSubtema.Update()
|
|
Alert("Subtema Agregado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al guardar el Subtema", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
|
|
If objRH.SubtemaUpdate(HdCveSubtema.Value.ToString.ToEntero, TxtSubtema.Text, DDlTema.SelectedValue.ToEntero, estatus, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa) Then
|
|
TxtSubtema.Text = ""
|
|
ChkEstatusSubtema.Checked = True
|
|
DDlTema.SelectedIndex = 0
|
|
|
|
CargadatosGvSubtemas()
|
|
UpGvSubtemas.Update()
|
|
UpModalSubtema.Update()
|
|
Alert("Subtema Actualizado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al Actualizar el Subtema", TipoMensaje.MsgError)
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
HdModalSubtemaModalidad.Value = "I"
|
|
|
|
objRH.Dispose()
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickSubtema(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdModalSubtemaModalidad.Value = "U"
|
|
HdCveSubtema.Value = GvRow.DataKey("CveSubtema")
|
|
DDlTema.SelectedValueExist(GvRow.DataKey("CveTema"))
|
|
TxtSubtema.Text = GvRow.DataKey("Subtema")
|
|
ChkEstatusSubtema.Checked = GvRow.DataKey("Estatus")
|
|
LtlTituloModalSubtema.Text = "Editar Subtema"
|
|
BtnAgregarSubtemaModal.Text = "Actualizar"
|
|
|
|
UpModalSubtema.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "divAgregarSubtema"))
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|
|
End Class
|