Commit inicial Ventas Productivo
This commit is contained in:
122
Acarreos/CatChoferes.aspx.vb
Normal file
122
Acarreos/CatChoferes.aspx.vb
Normal file
@@ -0,0 +1,122 @@
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Acarreos_CatChoferes
|
||||
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES"
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
CargaDdlTransportista()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjAcar As New ClsAcarreos()
|
||||
If ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, -1,-1) Then
|
||||
GvChofer.DataSource = ObjAcar.DtResultados
|
||||
GvChofer.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CargaDdlTransportista()
|
||||
Dim ObjAcar As New ClsAcarreos()
|
||||
If ObjAcar.GetTransportista(-1, UsuarioActual.CveEmpresa, 1) Then
|
||||
DdlTransportista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlTransportista.DataSource = ObjAcar.DtResultados
|
||||
DdlTransportista.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpAddChofer.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarChofer_Click(sender As Object, e As EventArgs) Handles BtnAgregarChofer.Click
|
||||
If DdlTransportista.SelectedValue = "-1" Then
|
||||
Alert("Tiene que seleccionar un transportista.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
|
||||
Dim ObjAcar As New ClsAcarreos
|
||||
Dim Estatus = 0
|
||||
If ChkEstatus.Checked Then Estatus = 1
|
||||
If HdnModalidad.Value = "A" Then
|
||||
If ObjAcar.AddChofer(TxtChofer.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlTransportista.SelectedValue) Then
|
||||
CargaDatos()
|
||||
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ElseIf HdnModalidad.Value = "U" Then
|
||||
If ObjAcar.UpdateChofer(HdnID.Value, TxtChofer.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Estatus, DdlTransportista.SelectedValue) Then
|
||||
CargaDatos()
|
||||
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddChofer"))
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnModalidad.Value = "U"
|
||||
HdnID.Value = GvRow.DataKey("CveChofer")
|
||||
UpDatos.Update()
|
||||
BtnAgregarChofer.Text = "Actualizar"
|
||||
myModalLabel.InnerText = "Actualizar Chofer"
|
||||
TxtChofer.Text = GvRow.DataKey("Chofer")
|
||||
DdlTransportista.SelectedValueExist(GvRow.DataKey("CveTransportista"))
|
||||
divEstatus.Visible = True
|
||||
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
||||
UpAddChofer.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChofer"))
|
||||
End Sub
|
||||
|
||||
Public Sub Agregar()
|
||||
HdnModalidad.Value = "A"
|
||||
UpDatos.Update()
|
||||
BtnAgregarChofer.Text = "Agregar"
|
||||
myModalLabel.InnerText = "Agregar Chofer"
|
||||
TxtChofer.Text = ""
|
||||
ChkEstatus.Checked = True
|
||||
divEstatus.Visible = False
|
||||
UpAddChofer.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChofer"))
|
||||
End Sub
|
||||
|
||||
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjAcar As New ClsAcarreos()
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnID.Value = GvRow.DataKey("CveChofer")
|
||||
UpDatos.Update()
|
||||
If ObjAcar.RemoveChofer(HdnID.Value) Then
|
||||
CargaDatos()
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GvChofer_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvChofer.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If 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
|
||||
|
||||
Private Sub LnkChofer_Click(sender As Object, e As EventArgs) Handles LnkChofer.Click
|
||||
Agregar()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user