41 lines
4.1 KiB
Plaintext
41 lines
4.1 KiB
Plaintext
Option Strict On
|
|
Imports System.Data
|
|
Imports System.Collections.Generic
|
|
Imports System.Linq
|
|
Imports System.Web
|
|
Imports System.Web.UI.WebControls
|
|
Imports Extensiones
|
|
|
|
Partial Class CATTamaños
|
|
Inherits ClsPaginas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Region "Propiedades"
|
|
|
|
Private Property CveTamaño() As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveTamaño")), -1, CInt(ViewState("CveTamaño")))
|
|
End Get
|
|
Set
|
|
ViewState("CveTamaño") = Value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaTamaños()
|
|
End If
|
|
End Sub
|
|
Protected Sub CargaTamaños()
|
|
Dim ObjTama As New ClsCGame()
|
|
If ObjTama.GetTamaños(UsuarioActual.CveEmpresa) Then
|
|
GVTamaños.DataSource = ObjTama.DtResultados
|
|
GVTamaños.DataBind()
|
|
End If
|
|
ObjTama.Dispose()
|
|
upDatosTama.Update()
|
|
End Sub
|
|
|
|
Protected Sub LimpiaTamaños()
|
|
TxtTamatamaño.Text = ""
|
|
UPModalTama.Update()
|
|
End Sub
|
|
Protected Sub LnkEditarTama_Click(sender As Object, e As EventArgs)
|
|
LimpiaTamaños()
|
|
Dim gvRow As GridViewRow= DirectCast((DirectCast(sender,LinkButton)).NamingContainer,GridViewRow)
|
|
CveTamaño = gvRow.DataKey("CveTamaño").ToEntero()
|
|
TxtTamatamaño.Text = gvRow.DataKey("Tamaño")
|
|
ChkTamaestatus.Checked = CBool(gvRow.DataKey("Estatus"))
|
|
RegistraScript("$('#DModalTamaños').modal()")
|
|
BtnTamaADD.Visible=False
|
|
BtnTamaEdit.Visible = True
|
|
DivEstatus.Visible = True
|
|
UPModalTama.Update()
|
|
End Sub
|
|
Protected Sub LnkAgregarTama_Click(sender As Object, e As EventArgs)
|
|
RegistraScript("$('#DModalTamaños').modal()")
|
|
LimpiaTamaños()
|
|
BtnTamaADD.Visible=True
|
|
BtnTamaEdit.Visible = False
|
|
DivEstatus.Visible = False
|
|
UPModalTama.Update()
|
|
End Sub
|
|
Protected Sub BtnTamaADD_Click(sender As Object, e As EventArgs)
|
|
Dim ObjTama As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTama.AddTamaños(TxtTamatamaño.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
ObjTama.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTamaños').modal('hide')")
|
|
LimpiaTamaños()
|
|
UPModalTama.Update()
|
|
Alert("El Tamaño se ha agregado")
|
|
CargaTamaños()
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnTamaEdit_Click(sender As Object, e As EventArgs)
|
|
Dim ObjTama As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTama.UpdateTamaños(CveTamaño, TxtTamatamaño.Text, ChkTamaestatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
ObjTama.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTamaños').modal('hide')")
|
|
LimpiaTamaños()
|
|
UPModalTama.Update()
|
|
Alert("El Tamaño se ha actualizado")
|
|
CargaTamaños()
|
|
End If
|
|
End Sub
|
|
Protected Sub LnkEliminarTama_Click(sender As Object, e As EventArgs)
|
|
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
|
CveTamaño = gvRow.DataKey("CveTamaño").ToEntero()
|
|
Dim ObjTama As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTama.RemoveTamaños(CveTamaño)
|
|
ObjTama.Dispose()
|
|
If (Continuar) Then
|
|
Alert("El Tamaños se ha eliminado")
|
|
CargaTamaños()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GVTamaños_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVTamaños.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If CBool(e.Row.DBCampo("Estatus")) = True Then
|
|
e.Row.FCLabel("lblestatus").Text = "Activo"
|
|
e.Row.FCLabel("lblestatus").ForeColor = Drawing.Color.Green
|
|
Else
|
|
e.Row.FCLabel("lblestatus").Text = "Inactivo"
|
|
e.Row.FCLabel("lblestatus").ForeColor = Drawing.Color.Red
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class
|