115 lines
4.8 KiB
VB.net
115 lines
4.8 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
Imports Extensiones
|
|
Partial Class General_CatRimTamanios
|
|
Inherits ClsPaginas
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property CveRinTamaño() As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveRinTamaño")), -1, CInt(ViewState("CveRinTamaño")))
|
|
End Get
|
|
Set
|
|
ViewState("CveRinTamaño") = Value
|
|
End Set
|
|
End Property
|
|
Private Property Modalidad() As String
|
|
Get
|
|
Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString))
|
|
End Get
|
|
Set
|
|
ViewState("Modalidad") = Value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaCombos()
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
#Region "CARGAS"
|
|
Private Sub CargaCombos()
|
|
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
|
|
DdlClasificacion.DataBind()
|
|
UpModal.Update()
|
|
End Sub
|
|
Private Sub CargaDatos()
|
|
Dim ObjGral As New ClsGenerales
|
|
If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjGral.DtResultados
|
|
End If
|
|
ObjGral.Dispose()
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "BOTONES"
|
|
|
|
Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
|
|
LimpiaModal()
|
|
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
|
CveRinTamaño = gvRow.DataKey("CveRinTamaño").ToEntero()
|
|
TxtRin.Text = gvRow.DataKey("RinTamaño")
|
|
TxtCodigo.Text = gvRow.DataKey("Codigo")
|
|
DdlClasificacion.SelectedValueExist(gvRow.DataKey("CveClasificacion"))
|
|
Modalidad = "U"
|
|
BtnGuardar.Text = "Actualizar"
|
|
ltlMotititulo.Text = "Actualizar Tamaño de Rin"
|
|
RegistraScript("$('#DModal').modal('show')")
|
|
UpModal.Update()
|
|
End Sub
|
|
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
|
|
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
|
Dim ObjGral As New ClsGenerales
|
|
Dim CveRinTamaño = gvRow.DataKey("CveRinTamaño").ToEntero()
|
|
If ObjGral.RemoveRimTamanio(CveRinTamaño) Then
|
|
Alert("El Tamaño de Rin se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("El Tamaño de Rin esta siendo utilizada por un Producto", TipoMensaje.MsgError)
|
|
End If
|
|
ObjGral.Dispose()
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
|
|
LimpiaModal()
|
|
Modalidad = "A"
|
|
BtnGuardar.Text = "Agregar"
|
|
ltlMotititulo.Text = "Agregar Tamaño de Rin"
|
|
UpModal.Update()
|
|
RegistraScript("$('#DModal').modal()")
|
|
End Sub
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
|
Dim ObjPS As New ClsGenerales
|
|
If Modalidad = "A" Then
|
|
If ObjPS.AddRimTamanios(DdlClasificacion.SelectedValue.ToEntero(), TxtCodigo.Text.Trim(), TxtRin.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
RegistraScript("$('#DModal').modal('hide')")
|
|
Alert("El Tamaño de Rin se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf Modalidad = "U" Then
|
|
If ObjPS.UpdateRimTamanios(CveRinTamaño, DdlClasificacion.SelectedValue.ToEntero(), TxtCodigo.Text.Trim(), TxtRin.Text.Trim()) Then
|
|
RegistraScript("$('#DModal').modal('hide')")
|
|
Alert("El Tamaño de Rin se actualizo correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
ObjPS.Dispose()
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "LIMPIAR"
|
|
Protected Sub LimpiaModal()
|
|
TxtRin.Text = ""
|
|
TxtCodigo.Text = ""
|
|
DdlClasificacion.SelectedValueExist("-1")
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "GRIDVIEW"
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
'If e.Row.DBCampo("Estatus") = "True" Then
|
|
' e.Row.Cells(1).ForeColor = Drawing.Color.Green
|
|
' e.Row.Cells(1).Font.Bold = True
|
|
' e.Row.Cells(1).Text = "Activo"
|
|
'Else
|
|
' e.Row.Cells(1).Text = "Inactivo"
|
|
' e.Row.Cells(1).ForeColor = Drawing.Color.Red
|
|
' e.Row.Cells(1).Font.Bold = True
|
|
'End If
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
End Class
|