Commit inicial Ventas Productivo
This commit is contained in:
245
Sistemas/CatFuncionalidades.aspx.vb
Normal file
245
Sistemas/CatFuncionalidades.aspx.vb
Normal file
@@ -0,0 +1,245 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Sistemas_CatFuncionalidades
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Sub Sistemas_CatFuncionalidades_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
DdlEmpresa.SelectedValue = UsuarioActual.CveEmpresa.ToString
|
||||
CargaEmpresasFuncionalidad(UsuarioActual.CveEmpresa)
|
||||
CargaEmpresas()
|
||||
CargaFuncionalidades()
|
||||
CargaEmpresaFuncionalidad()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "E M P R E S A S - F U N C I O N A L I D A D E S"
|
||||
Private Sub DdlEmpresa_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEmpresa.SelectedIndexChanged
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
End Sub
|
||||
|
||||
Private Sub CargaEmpresasFuncionalidad(CveEmpresa As Integer)
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
|
||||
If ObjSis.GetEmpresasFuncionalidades(CveEmpresa) Then
|
||||
GvEmpresas.DataSource = ObjSis.DtResultados.FiltraParametros("", Orderby:="CveFuncionalidad ASC")
|
||||
Else
|
||||
GvEmpresas.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
GvEmpresas.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaEmpresas()
|
||||
Dim ObjSiS As New ClsSisEmpresas
|
||||
|
||||
If ObjSiS.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then
|
||||
DdlEmpresa.DataSource = ObjSiS.DtResultados
|
||||
Else
|
||||
DdlEmpresa.DataSource = Nothing
|
||||
End If
|
||||
ObjSiS.Dispose()
|
||||
DdlEmpresa.DataBind()
|
||||
UpTitulosE.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaEmpresaFuncionalidad()
|
||||
Dim ObjSiS As New ClsSisEmpresas
|
||||
|
||||
If ObjSiS.GetFuncionalidades() Then
|
||||
DdlFuncionalidad.DataSource = ObjSiS.DtResultados
|
||||
Else
|
||||
DdlFuncionalidad.DataSource = Nothing
|
||||
End If
|
||||
ObjSiS.Dispose()
|
||||
DdlFuncionalidad.DataBind()
|
||||
UpTitulosE.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GvEmpresas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEmpresas.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GvEmpresas_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvEmpresas.RowEditing
|
||||
GvEmpresas.EditIndex = e.NewEditIndex
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
End Sub
|
||||
|
||||
Private Sub GvEmpresas_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvEmpresas.RowCancelingEdit
|
||||
GvEmpresas.EditIndex = -1
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
End Sub
|
||||
Private Sub GvEmpresas_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvEmpresas.RowUpdating
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
Dim CveFuncionalidad = GvEmpresas.Rows(e.RowIndex).DataKey("CveFuncionalidad").ToEntero
|
||||
Dim Valor = DirectCast(GvEmpresas.Rows(e.RowIndex).FindControl("TxtValordEdit"), TextBox).Text.Trim
|
||||
|
||||
If Not ObjSis.UpdateEmpresaFuncionalidad(CveFuncionalidad, Valor, DdlEmpresa.SelectedValue.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
GvEmpresas.EditIndex = -1
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
Else
|
||||
Alert("Error al actualizar los cambios.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
UpDatos.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GvEmpresas_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvEmpresas.RowDeleting
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
Dim CveFuncionalidad = GvEmpresas.Rows(e.RowIndex).DataKey("CveFuncionalidad").ToEntero
|
||||
|
||||
If Not ObjSis.RemoveEmpresasFuncionalidades(CveFuncionalidad, DdlEmpresa.SelectedValue.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
GvEmpresas.EditIndex = -1
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
Else
|
||||
Alert("Error al actualizar los cambios.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
UpDatos.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub LbAgregarFuncionalidadEmpresa_Click(sender As Object, e As EventArgs) Handles LbAgregarFuncionalidadEmpresa.Click
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
If Not ObjSis.AddUpdateEmpresaFuncionalidades(DdlEmpresa.SelectedValue.ToEntero, DdlFuncionalidad.SelectedValue.ToEntero, TxtValor.Text.Trim) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
Alert("Se guardo correctamente", TipoMensaje.MsgInformacion)
|
||||
TxtValor.Text = ""
|
||||
CargaEmpresasFuncionalidad(DdlEmpresa.SelectedValue.ToEntero)
|
||||
Else
|
||||
Alert("Error al guardar Funcionalidad", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "F U N C I O N A L I D A D E S"
|
||||
Private Sub CargaFuncionalidades()
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
|
||||
If ObjSis.GetFuncionalidades() Then
|
||||
GvFuncionalidad.DataSource = ObjSis.DtResultados
|
||||
Else
|
||||
GvFuncionalidad.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
GvFuncionalidad.DataBind()
|
||||
UpFuncionalidad.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GvFuncionalidad_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvFuncionalidad.RowEditing
|
||||
GvFuncionalidad.EditIndex = e.NewEditIndex
|
||||
CargaFuncionalidades()
|
||||
End Sub
|
||||
|
||||
Private Sub GvFuncionalidad_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvFuncionalidad.RowCancelingEdit
|
||||
GvFuncionalidad.EditIndex = -1
|
||||
CargaFuncionalidades()
|
||||
End Sub
|
||||
|
||||
Private Sub GvFuncionalidad_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvFuncionalidad.RowUpdating
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
Dim CveFuncionalidad = GvFuncionalidad.Rows(e.RowIndex).DataKey("CveFuncionalidad").ToEntero
|
||||
Dim Funcionalidad = DirectCast(GvFuncionalidad.Rows(e.RowIndex).FindControl("TxtFuncionalidadEdit"), TextBox).Text.Trim
|
||||
Dim Descripcion = DirectCast(GvFuncionalidad.Rows(e.RowIndex).FindControl("TxtDescripcionEdit"), TextBox).Text.Trim
|
||||
|
||||
If Not ObjSis.UpdateFuncionalidades(CveFuncionalidad, Funcionalidad, Descripcion) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
GvFuncionalidad.EditIndex = -1
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
CargaFuncionalidades()
|
||||
CargaEmpresaFuncionalidad()
|
||||
Else
|
||||
Alert("Error al actualizar los cambios.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
UpFuncionalidad.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub GvFuncionalidad_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvFuncionalidad.RowDeleting
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
Dim CveFuncionalidad = GvFuncionalidad.Rows(e.RowIndex).DataKey("CveFuncionalidad").ToEntero
|
||||
|
||||
If Not ObjSis.RemoveFuncionalidades(CveFuncionalidad) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
GvFuncionalidad.EditIndex = -1
|
||||
Alert("Se eliminador datos correctamente", TipoMensaje.MsgInformacion)
|
||||
CargaFuncionalidades()
|
||||
CargaEmpresaFuncionalidad()
|
||||
Else
|
||||
Alert("Error al eliminar", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
UpFuncionalidad.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub LbAgregarFuncionalidad_Click(sender As Object, e As EventArgs) Handles LbAgregarFuncionalidad.Click
|
||||
Dim ObjSis As New ClsSisEmpresas
|
||||
Dim TieneError = False
|
||||
|
||||
If Not ObjSis.AddFuncionalidades(TxtClave.Text.Trim.ToEntero, TxtFuncionalidad.Text.Trim, TxtDescripcion.Text.Trim) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjSis.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
Alert("Se guardo correctamente", TipoMensaje.MsgInformacion)
|
||||
TxtClave.Text = ""
|
||||
TxtFuncionalidad.Text = ""
|
||||
TxtDescripcion.Text = ""
|
||||
CargaFuncionalidades()
|
||||
CargaEmpresaFuncionalidad()
|
||||
Else
|
||||
Alert("Error al guardar Funcionalidad", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user