196 lines
5.8 KiB
VB.net
196 lines
5.8 KiB
VB.net
Option Strict On
|
|
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
|
|
Partial Class RH_CatSubProyectosZonas
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Private Property ActualizarZona As Boolean
|
|
Get
|
|
If ViewState("ActualizarZona") Is Nothing Then
|
|
Return False
|
|
Else
|
|
Return DirectCast(ViewState("ActualizarZona"), Boolean)
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("ActualizarZona") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property CveSubproyectoZona As Integer
|
|
Get
|
|
If ViewState("CveSubproyectoZona") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return DirectCast(ViewState("CveSubproyectoZona"), Integer)
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveSubproyectoZona") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property SubproyectoZona As String
|
|
Get
|
|
If ViewState("SubproyectoZona") Is Nothing Then
|
|
Return ""
|
|
Else
|
|
Return ViewState("SubproyectoZona").ToString
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("SubproyectoZona") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property CveSubproyecto As Integer
|
|
Get
|
|
If ViewState("CveSubproyecto") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return DirectCast(ViewState("CveSubproyecto"), Integer)
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveSubproyecto") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property Estatus As Boolean
|
|
Get
|
|
If ViewState("Estatus") Is Nothing Then
|
|
Return False
|
|
Else
|
|
Return DirectCast(ViewState("Estatus"), Boolean)
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("Estatus") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub RH_CatSubProyectosZonas_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.Empresa.CveEmpresa, 1)
|
|
DdlSubproyecto.DataBind()
|
|
DdlSubproyecto.Items.Insert(0, New ListItem("Seleccine un subroyecto", "-1"))
|
|
CargaZonas()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub CargaZonas()
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.SubproyectoZonaGet(-1, -1, UsuarioActual.Empresa.CveEmpresa) Then
|
|
GvZonas.DataSource = objRH.DtResultados
|
|
Else
|
|
GvZonas.DataSource = Nothing
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
GvZonas.DataBind()
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub ResetFormZona()
|
|
LtlTituloModalZona.Text = "Agregar Zona"
|
|
BtnAgregarZonaModal.Text = "Agregar"
|
|
TxtSubproyectoZona.Text = ""
|
|
DdlSubproyecto.SelectedIndex = 0
|
|
ChkEstatus.Checked = True
|
|
CveSubproyectoZona = -1
|
|
|
|
UpModalZona.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub BtnAgregarZonaModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarZonaModal.Click
|
|
|
|
Dim objRH As New ClsRH
|
|
Dim _Estatus As Integer
|
|
|
|
If ChkEstatus.Checked Then _Estatus = 1 Else _Estatus = 0
|
|
|
|
If ActualizarZona Then
|
|
If objRH.SubproyectoZonaAddUpdate(CveSubproyectoZona, TxtSubproyectoZona.Text, DdlSubproyecto.SelectedValue.ToEntero, _Estatus, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa) Then
|
|
Alert("Se actualizo la zona correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
Else
|
|
If objRH.SubproyectoZonaAddUpdate(-1, TxtSubproyectoZona.Text, DdlSubproyecto.SelectedValue.ToEntero, _Estatus, UsuarioActual.CveUsuario, UsuarioActual.Empresa.CveEmpresa) Then
|
|
Alert("Se agrego la zona correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
RegistraScript("$('#divAgregarZona').modal('hide');")
|
|
|
|
CargaZonas()
|
|
ResetFormZona()
|
|
|
|
CveSubproyectoZona = -1
|
|
ActualizarZona = False
|
|
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickZona(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = True
|
|
|
|
CveSubproyectoZona = GvRow.DataKey("CveSubProyectoZona").ToString.ToEntero
|
|
TxtSubproyectoZona.Text = GvRow.DataKey("SubProyectoZona")
|
|
DdlSubproyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
|
|
If Convert.ToBoolean(GvRow.DataKey("Estatus")) Then
|
|
ChkEstatus.Checked = True
|
|
Else
|
|
ChkEstatus.Checked = False
|
|
End If
|
|
|
|
|
|
LtlTituloModalZona.Text = "Actualizar Zona"
|
|
BtnAgregarZonaModal.Text = "Actualizar"
|
|
UpModalZona.Update()
|
|
RegistraScript("$('#divAgregarZona').modal({ backdrop: 'static', keyboard: false});")
|
|
|
|
ActualizarZona = True
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickZona(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 = False
|
|
Dim CveSubproyetoZona As Integer = GvRow.DataKey("CveSubProyectoZona").ToString.ToEntero
|
|
|
|
|
|
|
|
If objRH.SubproyectoZonaRemove(CveSubproyetoZona, UsuarioActual.Empresa.CveEmpresa) Then
|
|
Alert("Zona eliminada correctamente ", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
|
|
CargaZonas()
|
|
End Sub
|
|
|
|
|
|
Protected Sub LnkAgregarZona_Click(sender As Object, e As EventArgs) Handles LnkAgregarZona.Click
|
|
ResetFormZona()
|
|
RegistraScript("$('#divAgregarZona').modal({ backdrop: 'static', keyboard: false});")
|
|
End Sub
|
|
End Class
|