153 lines
3.9 KiB
VB.net
153 lines
3.9 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Ventas_CatProcedimientos
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Public Property CveProcedimiento As Integer
|
|
Get
|
|
If ViewState("CveProcedimiento") Is Nothing Then
|
|
ViewState("CveProcedimiento") = -1
|
|
End If
|
|
Return ViewState("CveProcedimiento").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProcedimiento") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If ObjVentas.GetProcedimientos(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvDatos.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
|
|
Dim ProcesoOK = False
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
|
|
If CveProcedimiento > 0 Then
|
|
If ObjVentas.UpdateProcedimiento(CveProcedimiento, TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = True
|
|
End If
|
|
Else
|
|
If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) > 0 Then
|
|
ProcesoOK = True
|
|
End If
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
Alert($"Procedimiento {If(CveProcedimiento > 0, "Actualizado", "Guardado")} Correctamente.")
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal('hide');")
|
|
CargaDatos()
|
|
CargaGlobal()
|
|
UpDatos.Update()
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
#Region "G V D A T O S"
|
|
|
|
|
|
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveProcedimiento = GvRow.DataKey("CveProcedimiento").ToEntero
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim ProcesoOK = False
|
|
|
|
If ObjVentas.RemoveProcedimiento(CveProcedimiento, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = True
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
|
|
If ProcesoOK Then
|
|
Alert("Procedimiento eliminando correctamente.")
|
|
|
|
CargaDatos()
|
|
CargaGlobal()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "CARGA GLOBAL"
|
|
Private Sub CargaGlobal()
|
|
GlobalDTProcedimientos(UsuarioActual.CveEmpresa) = Nothing
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
Public Sub LnkAgregarProcedimiento_Click(sender As Object, e As EventArgs)
|
|
|
|
LbAgregar.Text = "Agregar"
|
|
LtlTituloModal.Text = "Agregar Procedimiento"
|
|
|
|
TxtProcedimiento.Text = ""
|
|
|
|
DVEstatus.Visible = False
|
|
ChkEstatus.Checked = True
|
|
|
|
UpModal.Update()
|
|
|
|
CveProcedimiento = -1
|
|
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal();")
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveProcedimiento = GvRow.DataKey("CveProcedimiento").ToEntero
|
|
|
|
TxtProcedimiento.Text = GvRow.DataKey("Procedimiento")
|
|
|
|
ChkEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus"))
|
|
|
|
DVEstatus.Visible = True
|
|
LbAgregar.Text = "Actualizar"
|
|
LtlTituloModal.Text = $"Actualizar Procedimiento {TxtProcedimiento.Text}"
|
|
|
|
UpModal.Update()
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal();")
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
End Class |