Commit inicial Ventas Productivo
This commit is contained in:
120
General/CatModelos.aspx.vb
Normal file
120
General/CatModelos.aspx.vb
Normal file
@@ -0,0 +1,120 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports Extensiones
|
||||
Partial Class General_CatModelos
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property CveModelo() As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveModelo")), -1, CInt(ViewState("CveModelo")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("CveModelo") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Modalidad() As String
|
||||
Get
|
||||
Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString))
|
||||
End Get
|
||||
Set
|
||||
ViewState("Modalidad") = Value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "CARGAS"
|
||||
Private Sub CargaCombos()
|
||||
Dim ObjPS As New ClsProductosServicios()
|
||||
If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then
|
||||
DdlMarca.DataSource = ObjPS.DtResultados
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
DdlMarca.DataBind()
|
||||
UpModal.Update()
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjGral As New ClsGenerales
|
||||
If ObjGral.GetModelos(UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjGral.DtResultados
|
||||
End If
|
||||
ObjGral.Dispose()
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "BOTONES"
|
||||
|
||||
Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
|
||||
LimpiaModal()
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
CveModelo = gvRow.DataKey("CveModelo").ToEntero()
|
||||
TxtModelo.Text = gvRow.DataKey("Modelo")
|
||||
TxtCodigo.Text = gvRow.DataKey("Codigo")
|
||||
DdlMarca.SelectedValueExist(gvRow.DataKey("CveMarca"))
|
||||
ChkEstatus.Checked = CBool(gvRow.DataKey("Estatus"))
|
||||
Modalidad = "U"
|
||||
BtnGuardar.Text = "Actualizar"
|
||||
ltlMotititulo.Text = "Actualizar Modelo"
|
||||
DivEstatus.Visible = True
|
||||
RegistraScript("$('#DModal').modal('show')")
|
||||
UpModal.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
Dim ObjPS As New ClsGenerales
|
||||
Dim CveMarca = gvRow.DataKey("CveModelo").ToEntero
|
||||
If ObjPS.RemoveModelos(CveMarca) Then
|
||||
Alert("El modelo se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("El modelo esta siendo utilizada por un Producto", TipoMensaje.MsgError)
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
|
||||
LimpiaModal()
|
||||
Modalidad = "A"
|
||||
BtnGuardar.Text = "Agregar"
|
||||
ltlMotititulo.Text = "Agregar Modelo"
|
||||
DivEstatus.Visible = False
|
||||
UpModal.Update()
|
||||
RegistraScript("$('#DModal').modal()")
|
||||
End Sub
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjPS As New ClsGenerales
|
||||
If Modalidad = "A" Then
|
||||
If ObjPS.AddModelos(DdlMarca.SelectedValue.ToEntero(), TxtCodigo.Text.Trim(), TxtModelo.Text.Trim(), True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
RegistraScript("$('#DModal').modal('hide')")
|
||||
Alert("El modelo se agregó correctamente.", TipoMensaje.MsgInformacion)
|
||||
|
||||
End If
|
||||
ElseIf Modalidad = "U" Then
|
||||
If ObjPS.UpdateModelos(CveModelo, DdlMarca.SelectedValue.ToEntero(), TxtCodigo.Text.Trim(), TxtModelo.Text.Trim(), ChkEstatus.Checked, UsuarioActual.CveUsuario) Then
|
||||
RegistraScript("$('#DModal').modal('hide')")
|
||||
Alert("El modelo se actualizo correctamente.", TipoMensaje.MsgInformacion)
|
||||
|
||||
End If
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "LIMPIAR"
|
||||
Protected Sub LimpiaModal()
|
||||
TxtModelo.Text = ""
|
||||
TxtCodigo.Text = ""
|
||||
DdlMarca.SelectedValueExist("-1")
|
||||
End Sub
|
||||
Reference in New Issue
Block a user