227 lines
6.8 KiB
VB.net
227 lines
6.8 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
|
|
Partial Class Acumuladores_Tamaños
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveTamaño As Integer
|
|
Get
|
|
If Not ViewState("CveTamaño") Is Nothing Then
|
|
Return ViewState("CveTamaño").ToString.ToEntero
|
|
Else
|
|
Return -1
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveTamaño") = value
|
|
End Set
|
|
|
|
End Property
|
|
|
|
Private Property Actualizar As Boolean
|
|
Get
|
|
If Not ViewState("Actualizar") Is Nothing Then
|
|
Return DirectCast(ViewState("Actualizar"), Boolean)
|
|
Else
|
|
Return False
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("Actualizar") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Sub RH_Tamanios_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargadatosGvTamanio()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#Region "Tamaño"
|
|
|
|
Private Sub CargadatosGvTamanio()
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
|
|
If objAcum.TamañoGet(-1, UsuarioActual.Empresa.CveEmpresa) Then
|
|
GvTamanios.DataSource = objAcum.DtResultados
|
|
recargaTamaños()
|
|
Else
|
|
GvTamanios.DataSource = Nothing
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
UPGvTamanios.DataBind()
|
|
UpGral.Update()
|
|
|
|
CargaGvTamanioBitacora()
|
|
|
|
End Sub
|
|
Private Sub recargaTamaños()
|
|
Dim objAcum As New ClsAcumuladores
|
|
If objAcum.TamañoGet(-1, -1) Then Application("GlobalDTAcumTamaños") = objAcum.DtResultados Else Application("GlobalDTAcumTamaños") = Nothing
|
|
objAcum.Dispose()
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaGvTamanioBitacora()
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
|
|
If objAcum.TamañoBitacoraGet(UsuarioActual.Empresa.CveEmpresa) Then
|
|
GvBitacora.DataSource = objAcum.DtResultados
|
|
Else
|
|
GvBitacora.DataSource = Nothing
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
UpGvBitacora.DataBind()
|
|
UpGral.Update()
|
|
|
|
|
|
End Sub
|
|
Protected Sub BtnAgregarTamanio_Click(sender As Object, e As EventArgs) Handles BtnAgregarTamanio.Click
|
|
LtlTituloModalTamanio.Text = "Agregar Tamaño"
|
|
BtnAgregarTamanioModal.Text = "Agregar"
|
|
|
|
|
|
TxtTamanio.Text = ""
|
|
TxtCargo.Text = ""
|
|
TxtBonificacion.Text = ""
|
|
TxtCompra.Text = ""
|
|
TxtPuntos.Text = ""
|
|
|
|
DdlPS.Items.Clear()
|
|
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
|
DdlPS.DataBind()
|
|
DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
Actualizar = False
|
|
UpGral.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTamanio"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarTamanioModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarTamanioModal.Click
|
|
|
|
Dim ObjAcum As New ClsAcumuladores
|
|
Dim Cargo, Bonificacion, Compra, Puntos As Decimal
|
|
|
|
Cargo = If(TxtCargo.Text.ToDecimal > 0, TxtCargo.Text.ToDecimal, -1)
|
|
Bonificacion = If(TxtBonificacion.Text.ToDecimal > 0, TxtBonificacion.Text.ToDecimal, -1)
|
|
Compra = If(TxtCompra.Text.ToDecimal > 0, TxtCompra.Text.ToDecimal, -1)
|
|
Puntos = If(TxtPuntos.Text.ToDecimal > 0, TxtPuntos.Text.ToDecimal, -1)
|
|
|
|
|
|
If Not Actualizar Then
|
|
If ObjAcum.TamañoAdd(TxtTamanio.Text, Cargo, Bonificacion, Compra, Puntos, DdlPS.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
|
|
TxtTamanio.Text = ""
|
|
TxtCargo.Text = ""
|
|
TxtBonificacion.Text = ""
|
|
TxtCompra.Text = ""
|
|
TxtPuntos.Text = ""
|
|
|
|
CargadatosGvTamanio()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTamanio"), "jsHideModalTamanio")
|
|
UpGral.Update()
|
|
|
|
Alert("Tamaño Agregado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al guardar el Tamaño", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
If ObjAcum.TamañoUpdate(CveTamaño, TxtTamanio.Text, Cargo, Bonificacion, Compra, Puntos, DdlPS.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then
|
|
|
|
TxtTamanio.Text = ""
|
|
TxtCargo.Text = ""
|
|
TxtBonificacion.Text = ""
|
|
TxtCompra.Text = ""
|
|
TxtPuntos.Text = ""
|
|
|
|
CargadatosGvTamanio()
|
|
UpModalTamanio.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTamanio"), "jsHideModalTamanio")
|
|
|
|
UpGral.Update()
|
|
Alert("Tamaño Actualizado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al Actualizar el Tamaño", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
CveTamaño = -1
|
|
Actualizar = False
|
|
|
|
ObjAcum.Dispose()
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickTamanio(sender As Object, e As EventArgs)
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = False
|
|
Dim CveCapacitador As Integer = GvRow.DataKey("CveTamaño").ToEntero
|
|
|
|
If objAcum.TamañoRemove(CveCapacitador, UsuarioActual.CveEmpresa) Then
|
|
CargadatosGvTamanio()
|
|
|
|
Alert("Capacitador Elimino Correctamente ", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrio un error al Eliminar el Tamaño", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
CargadatosGvTamanio()
|
|
|
|
CveTamaño = -1
|
|
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickTamanio(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
LtlTituloModalTamanio.Text = "Editar Tamaño"
|
|
Actualizar = True
|
|
|
|
CveTamaño = GvRow.DataKey("CveTamaño").ToEntero
|
|
|
|
TxtTamanio.Text = GvRow.DataKey("Tamaño")
|
|
TxtCargo.Text = GvRow.DataKey("Cargo").ToDecimal.ToString("###,###,###.00")
|
|
TxtBonificacion.Text = GvRow.DataKey("Bonificacion").ToDecimal.ToString("###,###,###.00")
|
|
TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00")
|
|
TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00")
|
|
|
|
DdlPS.Items.Clear()
|
|
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
|
DdlPS.DataBind()
|
|
DdlPS.SelectedValueExist(GvRow.DataKey("CvePSCargo").ToEntero)
|
|
|
|
BtnAgregarTamanioModal.Text = "Actualizar"
|
|
|
|
UpModalTamanio.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTamanio"))
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
End Class
|