120 lines
4.3 KiB
VB.net
120 lines
4.3 KiB
VB.net
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Partial Class GPS_CatConductores
|
|
Inherits ClsPaginas
|
|
#Region "Propiedades"
|
|
Public Property CveConductor As Integer
|
|
Get
|
|
Return ViewState("CveConductor").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveConductor") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property EsEditar As Integer
|
|
Get
|
|
Return ViewState("EsEditar").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("EsEditar") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
EsEditar = 0
|
|
CargaConductores()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaConductores()
|
|
Dim ObjGps As New ClsGPS
|
|
If ObjGps.ConductoresGet(-1, "-1", -1, UsuarioActual.CveCliente) Then
|
|
GvConductores.DataSource = ObjGps.DtResultados
|
|
GvConductores.DataBind()
|
|
End If
|
|
ObjGps.Dispose()
|
|
End Sub
|
|
|
|
Private Sub LimpiarDatos()
|
|
TxtConductor.Text = ""
|
|
TxtFechaNacimiento.Text = ""
|
|
TxtSerieLicencia.Text = ""
|
|
TxtFechaVencimiento.Text = ""
|
|
chkEstatus.Checked = False
|
|
UpAgregar.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvConductores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvConductores.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
e.Row.VerticalAlign = VerticalAlign.Middle
|
|
If e.Row.DBCampo("Estatus").ToString = "True" Then
|
|
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Green
|
|
Else
|
|
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Red
|
|
End If
|
|
|
|
e.Row.FCLinkButton("imgE").CommandArgument = e.Row.DBCampo("CveConductor")
|
|
e.Row.FCLinkButton("imgD").CommandArgument = e.Row.DBCampo("CveConductor")
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvConductores_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvConductores.RowDeleting
|
|
Dim ObjGps As New ClsGPS
|
|
Dim CveConductor As Integer = GvConductores.Rows(e.RowIndex).DataKey("CveConductor").ToEntero
|
|
|
|
If ObjGps.ConductoresDelete(CveConductor) Then
|
|
Alert("El Conductor se eliminó correctamente.")
|
|
CargaConductores()
|
|
UpDatos.Update()
|
|
End If
|
|
|
|
ObjGps.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub imgE_Click(sender As Object, e As EventArgs)
|
|
Dim Boton = CType(sender, LinkButton)
|
|
Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow)
|
|
CveConductor = Boton.CommandArgument.ToEntero
|
|
EsEditar = 1
|
|
|
|
TxtConductor.Text = GvRow.DataKey("Conductor").ToString
|
|
TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToString
|
|
TxtSerieLicencia.Text = GvRow.DataKey("SerieLicencia").ToString
|
|
TxtFechaVencimiento.Text = GvRow.DataKey("VencimientoLicencia").ToString
|
|
|
|
If GvRow.DataKey("Estatus").ToString = "True" Then chkEstatus.Checked = True Else chkEstatus.Checked = False
|
|
|
|
UpAgregar.Update()
|
|
RegistraScript("$('#divAgregarTipo').modal()")
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs)
|
|
Dim ObjGps As New ClsGPS
|
|
If EsEditar = 0 Then
|
|
If ObjGps.ConductorAdd(TxtConductor.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, TxtSerieLicencia.Text, TxtFechaNacimiento.Text.ToDate, TxtFechaVencimiento.Text.ToDate, UsuarioActual.CveCliente) Then
|
|
Alert("El Conductor se agregó correctamente.")
|
|
End If
|
|
Else
|
|
If ObjGps.ConductoresUpdate(CveConductor, TxtConductor.Text, chkEstatus.Checked, TxtSerieLicencia.Text, TxtFechaNacimiento.Text.ToDate, TxtFechaVencimiento.Text.ToDate) Then
|
|
Alert("El Conductor se actualizó correctamente.")
|
|
End If
|
|
End If
|
|
|
|
LimpiarDatos()
|
|
CargaConductores()
|
|
UpDatos.Update()
|
|
ObjGps.Dispose()
|
|
End Sub
|
|
|
|
Private Sub linkAgregar_Click(sender As Object, e As EventArgs) Handles linkAgregar.Click
|
|
LimpiarDatos()
|
|
RegistraScript("$('#divAgregarTipo').modal()")
|
|
End Sub
|
|
End Class
|