118 lines
4.2 KiB
VB.net
118 lines
4.2 KiB
VB.net
Imports Extensiones
|
|
|
|
Partial Class Inventarios_CatPaqueterias
|
|
Inherits ClsPaginas
|
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
Dim ObjGral As New ClsGenerales
|
|
' Dim dt As Data.DataTable
|
|
If ObjGral.GetGralPaqueterias() Then
|
|
GvDatos.DataSource = ObjGral.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
ObjGral.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
End Sub
|
|
|
|
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
|
Dim ObjGral As New ClsGenerales
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnID.Value = GvRow.DataKey("CvePaqueteria")
|
|
UpDatos.Update()
|
|
If ObjGral.RemoveGralPaqueterias(HdnID.Value.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
CargaDatos()
|
|
End If
|
|
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
|
ObjGral.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnModalidad.Value = "U"
|
|
HdnID.Value = GvRow.DataKey("CvePaqueteria")
|
|
UpDatos.Update()
|
|
BtnAgregarPaqueteria.Text = "Actualizar"
|
|
myModalLabel.InnerText = "Actualizar Paqueteria"
|
|
'DdlSucursal.SelectedValueExist(GvRow.DataKey("CveSucursal"))
|
|
'DdlTipoPaqueteria.SelectedValueExist(GvRow.DataKey("CveTipoPaqueteria"))
|
|
TxtPaqueteria.Text = GvRow.DataKey("Paqueteria")
|
|
TxtLiga.Text = GvRow.DataKey("Liga")
|
|
divEstatus.Visible = True
|
|
ChkEstatus.Checked = If((GvRow.DataKey("Estatus")) = "Activo", True, False)
|
|
UpAddPaqueteria.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddPaqueteria"))
|
|
|
|
End Sub
|
|
|
|
Private Sub LnkPaqueteria_Click(sender As Object, e As EventArgs) Handles LnkPaqueteria.Click
|
|
Agregar()
|
|
End Sub
|
|
|
|
Public Sub Agregar()
|
|
HdnModalidad.Value = "A"
|
|
UpDatos.Update()
|
|
|
|
BtnAgregarPaqueteria.Text = "Agregar"
|
|
myModalLabel.InnerText = "Agregar Paquetería"
|
|
TxtPaqueteria.Text = ""
|
|
TxtLiga.Text = ""
|
|
ChkEstatus.Checked = True
|
|
divEstatus.Visible = False
|
|
UpAddPaqueteria.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddPaqueteria"))
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnAgregarPaqueteria_Click(sender As Object, e As EventArgs) Handles BtnAgregarPaqueteria.Click
|
|
Dim ObjGral As New ClsGenerales
|
|
Dim TieneError = False
|
|
Dim Estatus = 0
|
|
If ChkEstatus.Checked Then Estatus = 1
|
|
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjGral.AddGralPaqueterias(TxtPaqueteria.Text.Trim, TxtLiga.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("Se guardó correctamente la paquetería.", TipoMensaje.MsgInformacion)
|
|
UpDatos.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddPaqueteria"))
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
ElseIf ObjGral.UpdateGralPaqueterias(TxtPaqueteria.Text.Trim, TxtLiga.Text.Trim, Estatus, HdnID.Value.ToEntero) Then
|
|
Alert("El Paqueteria se actualizo correctamente.", TipoMensaje.MsgInformacion)
|
|
UpDatos.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddPaqueteria"))
|
|
End If
|
|
|
|
ObjGral.Dispose()
|
|
RecargaGlobal()
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#Region "G L O B L A L"
|
|
Private Sub RecargaGlobal()
|
|
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
|
|
Hilo.Start()
|
|
End Sub
|
|
Private Sub GeneraGlobalDT()
|
|
Dim ObjGenerales As New ClsGenerales
|
|
|
|
If ObjGenerales.GetGralPaqueterias(-1) Then
|
|
Application("GlobalDTPaqueterias") = ObjGenerales.DtResultados
|
|
End If
|
|
|
|
ObjGenerales.Dispose()
|
|
End Sub
|
|
#End Region
|
|
End Class
|