48 lines
4.6 KiB
Plaintext
48 lines
4.6 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 CATTipoCaja
|
|
Inherits ClsPaginas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Region "Propiedades"
|
|
|
|
Private Property CveTipoCaja() As Int32
|
|
Get
|
|
Return If(IsNothing(ViewState("CveTipoCaja")), 0, CInt(ViewState("CveTipoCaja")))
|
|
End Get
|
|
Set
|
|
ViewState("CveTipoCaja") = Value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaTipoCaja()
|
|
End If
|
|
End Sub
|
|
Protected Sub CargaTipoCaja()
|
|
Dim ObjTipo As New ClsCGame()
|
|
If ObjTipo.GetTipoCaja(UsuarioActual.CveEmpresa) Then
|
|
GVTipoCaja.DataSource = ObjTipo.DtResultados
|
|
GVTipoCaja.DataBind()
|
|
End If
|
|
ObjTipo.Dispose()
|
|
upDatosTipo.Update()
|
|
End Sub
|
|
|
|
Protected Sub LimpiaTipoCaja()
|
|
TxtTipotipoCaja.Text = ""
|
|
DdlTipo.SelectedIndex = 0
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub LnkEditarTipo_Click(sender As Object, e As EventArgs)
|
|
LimpiaTipoCaja()
|
|
Dim gvRow As GridViewRow= DirectCast((DirectCast(sender,LinkButton)).NamingContainer,GridViewRow)
|
|
CveTipoCaja = gvRow.DataKey("CveTipoCaja").ToEntero()
|
|
TxtTipotipoCaja.Text = gvRow.DataKey("TipoCaja")
|
|
ChkTipoestatus.Checked = CBool(gvRow.DataKey("Estatus"))
|
|
DdlTipo.SelectedValueExist(gvRow.DataKey("Tipo"))
|
|
RegistraScript("$('#DModalTipoCaja').modal()")
|
|
BtnTipoADD.Visible=False
|
|
BtnTipoEdit.Visible = True
|
|
DivEstatus.Visible = True
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub LnkAgregarTipo_Click(sender As Object, e As EventArgs)
|
|
RegistraScript("$('#DModalTipoCaja').modal()")
|
|
LimpiaTipoCaja()
|
|
BtnTipoADD.Visible=True
|
|
BtnTipoEdit.Visible = False
|
|
DivEstatus.Visible = False
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub BtnTipoADD_Click(sender As Object, e As EventArgs)
|
|
If Not DdlTipo.SelectedValue.ToEntero > 0 Then
|
|
Alert("Tiene que seleccionar un tipo.", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.AddTipoCaja(TxtTipotipoCaja.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTipoCaja').modal('hide')")
|
|
LimpiaTipoCaja()
|
|
UPModalTipo.Update()
|
|
Alert("El Tipo de Caja se ha agregado")
|
|
CargaTipoCaja()
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnTipoEdit_Click(sender As Object, e As EventArgs)
|
|
If Not DdlTipo.SelectedValue.ToEntero > 0 Then
|
|
Alert("Tiene que seleccionar un tipo.", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.UpdateTipoCaja(CveTipoCaja, TxtTipotipoCaja.Text, ChkTipoestatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTipoCaja').modal('hide')")
|
|
LimpiaTipoCaja()
|
|
UPModalTipo.Update()
|
|
Alert("El Tipo de Caja se ha actualizado")
|
|
CargaTipoCaja()
|
|
End If
|
|
End Sub
|
|
Protected Sub LnkEliminarTipo_Click(sender As Object, e As EventArgs)
|
|
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
|
CveTipoCaja = gvRow.DataKey("CveTipoCaja").ToEntero()
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.RemoveTipoCaja(CveTipoCaja)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
Alert("El Tipo de Caja se ha Eliminado")
|
|
CargaTipoCaja()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GVTipoCaja_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVTipoCaja.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
|