Commit inicial Ventas Productivo
This commit is contained in:
119
AF/CatModelos.aspx.vb
Normal file
119
AF/CatModelos.aspx.vb
Normal file
@@ -0,0 +1,119 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class AF_CatModelos
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES"
|
||||
|
||||
#End Region
|
||||
Private Sub AF_CatOperadores_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaMarcaAF()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "CARGA´S"
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjAF As New ClsAF
|
||||
If ObjAF.GetModelosActivosFijos(UsuarioActual.CveEmpresa, -1) Then
|
||||
GvModelos.DataSource = ObjAF.DtResultados
|
||||
GvModelos.DataBind()
|
||||
End If
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Private Sub CargaMarcaAF()
|
||||
Dim ObjAF As New ClsAF
|
||||
If ObjAF.GetMarcasActivosFijos(UsuarioActual.CveEmpresa) Then
|
||||
DdlMarcaActivoFijo.DataSource = ObjAF.DtResultados
|
||||
DdlMarcaActivoFijo.DataBind()
|
||||
End If
|
||||
DdlMarcaActivoFijo.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "A G R E G A R M A R C A"
|
||||
Private Sub LnkModelo_Click(sender As Object, e As EventArgs) Handles LnkModelo.Click
|
||||
HdnModalidad.Value = "A"
|
||||
UpDatos.Update()
|
||||
BtnAgregarModelo.Text = "Agregar"
|
||||
myModalLabel.InnerText = "Agregar Modelo"
|
||||
TxtModelo.Text = ""
|
||||
DdlMarcaActivoFijo.SelectedIndex = 0
|
||||
ChkEstatus.Checked = True
|
||||
divEstatus.Visible = False
|
||||
UpAddModelos.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddModelos"))
|
||||
End Sub
|
||||
Private Sub BtnAgregarModelo_Click(sender As Object, e As EventArgs) Handles BtnAgregarModelo.Click
|
||||
Dim ObjAF As New ClsAF
|
||||
Dim Estatus = False
|
||||
If ChkEstatus.Checked Then Estatus = True
|
||||
|
||||
If HdnModalidad.Value = "A" Then
|
||||
If ObjAF.AddModelosActivosFijos(TxtModelo.Text.Trim, DdlMarcaActivoFijo.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ElseIf HdnModalidad.Value = "U" Then
|
||||
If ObjAF.UpdateModelosActivosFijos(HdnID.Value.ToEntero, TxtModelo.Text.Trim, DdlMarcaActivoFijo.SelectedValue.ToEntero, Estatus, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddModelos"))
|
||||
CargaDatos()
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
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("CveModeloActivoFijo")
|
||||
UpDatos.Update()
|
||||
BtnAgregarModelo.Text = "Actualizar"
|
||||
myModalLabel.InnerText = "Actualizar Modelo"
|
||||
TxtModelo.Text = GvRow.DataKey("ModeloActivoFijo")
|
||||
DdlMarcaActivoFijo.SelectedValueExist(GvRow.DataKey("CveMarcaActivoFijo"))
|
||||
|
||||
divEstatus.Visible = True
|
||||
ChkEstatus.Checked = If(GvRow.DataKey("Estatus") = "Activo", True, False)
|
||||
UpAddModelos.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddModelos"))
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "GV "
|
||||
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjAF As New ClsAF()
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HdnID.Value = GvRow.DataKey("CveModeloActivoFijo")
|
||||
UpDatos.Update()
|
||||
If ObjAF.RemoveModelosActivosFijos(HdnID.Value.ToEntero) Then
|
||||
CargaDatos()
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ObjAF.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Private Sub GvModelo_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvModelos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("Estatus") = "Activo" 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 Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user