104 lines
4.1 KiB
VB.net
104 lines
4.1 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.Linq
|
|
Imports Extensiones
|
|
|
|
Partial Class Compras_CatProveedoresClasificaciones
|
|
Inherits ClsPaginas
|
|
|
|
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 ObjProveedorClasificacion As New ClsCompProveedores
|
|
|
|
If ObjProveedorClasificacion.GetProveedorClasificacion(UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjProveedorClasificacion.DtResultados
|
|
Else
|
|
Me.GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
|
|
|
|
GvDatos.DataBind()
|
|
ObjProveedorClasificacion.Dispose()
|
|
End Sub
|
|
|
|
|
|
#Region "G V D A T O S"
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
End If
|
|
End Sub
|
|
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
|
Dim ObjProveedorClasificacion As New ClsCompProveedores
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnID.Value = GvRow.DataKey("CveProveedorClasificacion")
|
|
UpDatos.Update()
|
|
If ObjProveedorClasificacion.RemoveProveedorClasificacion(HdnID.Value.ToEntero) Then
|
|
CargaDatos()
|
|
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjProveedorClasificacion.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "AGREGAR / EDITAR"
|
|
Private Sub BtanAgregarClasificacion_Click(sender As Object, e As EventArgs) Handles BtanAgregarClasificacion.Click
|
|
HdnModalidad.Value = "A"
|
|
BtnAddClasificacion.Text = "Agregar"
|
|
TxtClasificacion.Text = ""
|
|
ChkEstatus.Checked = True
|
|
DivEstatus.Visible = False
|
|
|
|
UpDatos.Update()
|
|
UpAddClasificación.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddClasificacion"))
|
|
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("CveProveedorClasificacion")
|
|
BtnAddClasificacion.Text = "Actualizar"
|
|
TxtClasificacion.Text = GvRow.DataKey("ProveedorClasificacion")
|
|
DivEstatus.Visible = True
|
|
If GvRow.DataKey("Estatus") = "Activo" Then ChkEstatus.Checked = True Else ChkEstatus.Checked = False
|
|
|
|
UpDatos.Update()
|
|
UpAddClasificación.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddClasificacion"))
|
|
End Sub
|
|
Private Sub BtnAddClasificacion_Click(sender As Object, e As EventArgs) Handles BtnAddClasificacion.Click
|
|
Dim ObjProveedorClasificacion As New ClsCompProveedores
|
|
Dim Estatus = False
|
|
If ChkEstatus.Checked Then Estatus = True
|
|
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjProveedorClasificacion.AddProveedorClasificacion(TxtClasificacion.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("La Nueva Clasificación de Proveedores se guardó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If ObjProveedorClasificacion.UpdateProveedorClasificacion(TxtClasificacion.Text.Trim, Estatus, HdnID.Value.ToEntero) Then
|
|
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
|
|
|
End If
|
|
End If
|
|
|
|
If ObjProveedorClasificacion.GetProveedorClasificacion(UsuarioActual.CveEmpresa) Then
|
|
GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa) = ObjProveedorClasificacion.DtResultados
|
|
End If
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddClasificacion"))
|
|
CargaDatos()
|
|
ObjProveedorClasificacion.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
End Class
|