134 lines
4.9 KiB
VB.net
134 lines
4.9 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
Imports Extensiones
|
|
|
|
Partial Class Ventas_ClientesClasificaciones
|
|
Inherits ClsPaginas
|
|
|
|
#Region "PROPIEDADES"
|
|
|
|
#End Region
|
|
|
|
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " CARGAS "
|
|
Private Sub CargaDatos()
|
|
Dim Objeto As New ClsClientes
|
|
If Objeto.GetClienteClasificacion(UsuarioActual.CveEmpresa) Then
|
|
GvClasificacion.DataSource = Objeto.DtResultados
|
|
End If
|
|
GvClasificacion.DataBind()
|
|
CargaGlobal()
|
|
Objeto.Dispose()
|
|
OrdenaDatos()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " GV Clasificaciones Y AGREGAR "
|
|
Private Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
|
|
Dim Objeto As New ClsClientes
|
|
If HdnModalidad.Value = "I" Then
|
|
If Objeto.AddClienteClasificacion(TxtClasificacion.Text, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, True) Then
|
|
TxtClasificacion.Text = ""
|
|
Alert("La Clasificación se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
CargaDatos()
|
|
UpGvClasificacion.Update()
|
|
Objeto.Dispose()
|
|
OcultaDiv()
|
|
End If
|
|
|
|
Else
|
|
If HdnID.Value.ToEntero <> -1 Then
|
|
If Objeto.UpdateClienteClasificacion(TxtClasificacion.Text, HdnID.Value.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, True) Then
|
|
Alert("Se actualizó correctamente la Clasificación.", TipoMensaje.MsgInformacion)
|
|
CargaDatos()
|
|
UpGvClasificacion.Update()
|
|
Objeto.Dispose()
|
|
OcultaDiv()
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvClasificacion_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvClasificacion.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
Dim URL As String = String.Format("javascript:CleanObjects();SetValue('HdnModalidad', 'U');SetValue('HdnID', '{0}'); SetObjects('{1}');ShowDivRegistro();return false;", e.Row.DBCampo("CveClienteClasificacion").ToEntero, e.Row.DBCampo("ClienteClasificacion"))
|
|
'GeneroLigas
|
|
Dim Liga As String = String.Format("<a class=""LinkBlanco"" href=""{0}"">", URL)
|
|
e.Row.VerticalAlign = VerticalAlign.Middle
|
|
e.Row.FCLinkButton("ImgE").OnClientClick = URL
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvClasificacion_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvClasificacion.RowEditing
|
|
GvClasificacion.EditIndex = e.NewEditIndex
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
Protected Sub GvClasificacion_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvClasificacion.RowUpdating
|
|
|
|
Dim Update As New ClsClientes
|
|
Dim Clasificacion = GvClasificacion.Rows(e.RowIndex).FCTextBox("TxtClasificacion").Text.Trim
|
|
Dim Clave = GvClasificacion.Rows(e.RowIndex).DataKey("CveClienteClasificacion").ToEntero
|
|
|
|
If Update.UpdateClienteClasificacion(Clasificacion, Clave, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, True) Then
|
|
Alert("Se actualizó correctamente la Clasificación.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
GvClasificacion.EditIndex = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Protected Sub GvClasificacion_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvClasificacion.RowCancelingEdit
|
|
GvClasificacion.EditIndex = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub GvClasificacion_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvClasificacion.RowDeleting
|
|
Dim Objeto As New ClsClientes
|
|
Dim Clave = GvClasificacion.Rows(e.RowIndex).DataKey("CveClienteClasificacion").ToEntero
|
|
If Objeto.RemoveClienteClasificacion(Clave) Then
|
|
Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
Objeto.Dispose()
|
|
GvClasificacion.EditIndex = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region " O R D E N A M I E N T O JAVASCRIPT"
|
|
Private Sub OrdenaDatos()
|
|
If (GvClasificacion.Rows.Count > 0) Then
|
|
GvClasificacion.UseAccessibleHeader = True
|
|
GvClasificacion.HeaderRow.TableSection = TableRowSection.TableHeader
|
|
RegistraScript("OrdenarGV();")
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
Private Sub CargaGlobal()
|
|
GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) = Nothing
|
|
End Sub
|
|
|
|
|
|
Private Sub OcultaDiv()
|
|
ScriptManager.RegisterStartupScript(Me, Me.GetType, "Llave", "HideDivRegistro();", True)
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|