128 lines
3.9 KiB
VB.net
128 lines
3.9 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
Imports Extensiones
|
|
|
|
Partial Class Sistemas_CatPAC
|
|
Inherits ClsPaginas
|
|
|
|
#Region "PROPIEDADES"
|
|
|
|
#End Region
|
|
|
|
Private Sub General_CatMarcas_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " CARGAS "
|
|
Private Sub CargaDatos()
|
|
Dim Objeto As New ClsSisEmpresas
|
|
If Objeto.GetPacs() Then
|
|
GVPac.DataSource = Objeto.DtResultados
|
|
End If
|
|
GVPac.DataBind()
|
|
Objeto.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " GV MARCAS Y AGREGAR "
|
|
Private Sub LbAgregarC_Click(sender As Object, e As EventArgs) Handles LbAgregarC.Click
|
|
Dim Objeto As New ClsSisEmpresas
|
|
Dim PAC = TxtPAC.Text
|
|
Dim Estatus = ChkEstatus.Checked
|
|
|
|
If Objeto.AddPacs(PAC, Estatus, UsuarioActual.CveUsuario) Then
|
|
TxtPAC.Text = ""
|
|
Alert("La Marca se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
CargaDatos()
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
|
|
|
|
Protected Sub GVPac_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVPac.RowDataBound
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
'ESTATUS NORMAL
|
|
If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then
|
|
If e.Row.DBCampo("Estatus") = "True" Then
|
|
e.Row.FCLabel("LtlEstatus").ForeColor = Drawing.Color.Green
|
|
e.Row.FCLabel("LtlEstatus").Font.Bold = True
|
|
e.Row.FCLabel("LtlEstatus").Text = "Activo"
|
|
Else
|
|
e.Row.FCLabel("LtlEstatus").Text = "Inactivo"
|
|
e.Row.FCLabel("LtlEstatus").ForeColor = Drawing.Color.Red
|
|
e.Row.FCLabel("LtlEstatus").Font.Bold = True
|
|
End If
|
|
End If
|
|
|
|
|
|
'ESTATUS EDICION
|
|
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
|
|
|
|
If e.Row.DBCampo("Estatus") = "True" Then
|
|
e.Row.FCCheckBox("ChkEstatus").Checked = True
|
|
Else
|
|
e.Row.FCCheckBox("ChkEstatus").Checked = False
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Protected Sub GVPac_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GVPac.RowEditing
|
|
GVPac.EditIndex = e.NewEditIndex
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
Protected Sub GVPac_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GVPac.RowUpdating
|
|
Dim Update As New ClsSisEmpresas
|
|
Dim PAC = GVPac.Rows(e.RowIndex).FCTextBox("TxtPAC").Text.Trim
|
|
Dim Estatus = GVPac.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked
|
|
Dim Clave = GVPac.Rows(e.RowIndex).DataKey("CvePAC").ToEntero
|
|
|
|
If Update.UpdatePacs(PAC, Estatus, UsuarioActual.CveUsuario, Clave) Then
|
|
Alert("Se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
GVPac.EditIndex = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Protected Sub GVPac_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GVPac.RowCancelingEdit
|
|
GVPac.EditIndex = -1
|
|
CargaDatos()
|
|
Alert("Se canceló la edición de los campos.")
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub GvMarcas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVPac.RowDeleting
|
|
Dim Objeto As New ClsSisEmpresas
|
|
Dim Clave = GVPac.Rows(e.RowIndex).DataKey("CvePAC").ToEntero
|
|
If Objeto.RemovePacs(Clave) Then
|
|
Alert("Se eliminó correctamente el PAC.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
Objeto.Dispose()
|
|
GVPac.EditIndex = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Class
|