Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

195
Sistemas/CatRoles.aspx.vb Normal file
View File

@@ -0,0 +1,195 @@
Imports System.Drawing
Imports Extensiones
Imports System.Data
Partial Class CatRoles
Inherits ClsPaginas
Private Property DtRoles As DataTable
Get
Return CType(ViewState("DtRoles"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtRoles") = value
End Set
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'LnkCerrar.Style.Add("cursor", "hand")
'LnkCerrar.Attributes.Add("OnClick", "$('#DivPermisos').hide();")
'LnkCerrarP.Attributes.Add("OnClick", "$('#DivProcesos').hide();")
ViewState("Orden") = ""
ViewState("CveRol") = -1
CargaModulos()
CargaDatos()
'Permisos
'Permiso Registro
If UsuarioActual.TienePermisoProceso(4) Then HLAgregarRoles.Visible = True Else HLAgregarRoles.Visible = False
'Permiso Modificar
If UsuarioActual.TienePermisoProceso(5) Then GvDatos.Columns(4).Visible = True Else GvDatos.Columns(4).Visible = False
'Permiso Editar Modulos
' If UsuarioActual.TienePermisoProceso(16) Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(5).Visible = False
'Permiso Editar Permisos
'If UsuarioActual.TienePermisoProceso(17) Then GvDatos.Columns(6).Visible = True Else GvDatos.Columns(6).Visible = False
'Permiso Eliminar
If UsuarioActual.TienePermisoProceso(6) Then GvDatos.Columns(7).Visible = True Else GvDatos.Columns(7).Visible = False
End If
End Sub
Private Sub CargaModulos()
'DdlModulo.DataSource = GlobalDTModulos.FiltraParametros("CvePadre = 0 OR Agrupacion = 'S'")
'DdlModulo.DataBind()
'DdlModulo.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Public Sub CargaDatos()
Dim Rol As New ClsSisRoles
If Rol.GetRoles(-1, UsuarioActual.CveEmpresa) Then
DtRoles = Rol.DtResultados
If Rol.GetRoles(-1, -1) Then GlobalDTRoles(-1) = Rol.DtResultados
GvDatos.DataSource = Rol.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GvDatos.DataBind()
Else
GvDatos.DataSource = Nothing
End If
Rol.Dispose()
End Sub
'Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LbAgregar.Click
'Dim Rol As New ClsSisRoles
'If Rol.AddRol(DdlModulo.SelectedValue.ToEntero, TxtDescripcion.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
' TxtDescripcion.Text = ""
' Alert("El nuevo Rol se guardó correctamente.", TipoMensaje.MsgInformacion)
' UpTitulos.Update()
' If Rol.GetRoles(-1, -1) Then GlobalDTRoles(-1) = Rol.DtResultados : DtRoles = GlobalDTRoles(UsuarioActual.CveEmpresa)
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
'End If
'Rol.Dispose()
''"$(""#DivAltaReporte"").hide();"
' End Sub
Protected Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvDatos.RowCommand
If e.CommandName = "Permisos" Then
Dim Array = e.CommandArgument.ToString.Split("|"c)
If Array.Length = 2 Then
Dim ObjPermisos As New ClsSisRoles()
ViewState("CveRol") = Array(0).ToEntero
If ObjPermisos.GetRolesModulos(Array(0).ToEntero, -1) Then
GvPermisos.DataSource = ObjPermisos.DtResultados.FiltraParametros("AGRUPACION ='N'")
Else
GvPermisos.DataSource = Nothing
End If
ObjPermisos.Dispose()
GvPermisos.DataBind()
LbPermisos.Text = String.Format("Asignación de Permisos: {0}", Array(1).ToString)
UPPAltaRep.Update()
UPAlta.Update()
RegistraScript("$('#DivPermisos').modal();")
End If
End If
If e.CommandName = "Procesos" Then
Dim Array = e.CommandArgument.ToString.Split("|"c)
If Array.Length = 2 Then
Dim ObjPermisos As New ClsSisRoles()
ViewState("CveProceso") = Array(0).ToEntero
If ObjPermisos.GetRolesProcesos(Array(0).ToEntero, -1) Then
GvProcesos.DataSource = ObjPermisos.DtResultados
Else
GvProcesos.DataSource = Nothing
End If
ObjPermisos.Dispose()
GvProcesos.DataBind()
LbProcesos.Text = String.Format("Asignación de Procesos: {0}", Array(1).ToString)
UPPAltaProcesos.Update()
UpAltaP.Update()
RegistraScript("$('#DivProcesos').modal();")
End If
End If
End Sub
Protected Sub GvPermisos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPermisos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If (e.Row.DBCampo("CveModuloAcceso")) <> "" Then e.Row.FCCheckBox("ChkP").Checked = True
End If
End Sub
Protected Sub GvProcesos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProcesos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If (e.Row.DBCampo("CveModuloAcceso")) <> "" Then
e.Row.Cells(0).CssClass = "bg-yellow"
End If
If (e.Row.DBCampo("CveProcesoAcceso")) <> "" Then e.Row.FCCheckBox("ChkP").Checked = True
End If
End Sub
Protected Sub CmdGuardar_Click(sender As Object, e As EventArgs) Handles CmdGuardar.Click
Dim Roles As New ClsSisRoles
For Each Row As GridViewRow In GvPermisos.Rows
Roles.UpdateRolesModulos(Row.DataKey("CveRol").ToEntero, Row.DataKey("CveModulo").ToEntero, If(Row.FCCheckBox("ChkP").Checked, 1, 0), UsuarioActual.CveUsuario)
Next
Roles.Dispose()
RegistraScript("$('#DivPermisos').modal('hide');")
End Sub
Protected Sub BtnGuardaProcesos_Click(sender As Object, e As EventArgs) Handles BtnGuardaProcesos.Click
Dim Roles As New ClsSisRoles
For Each Row As GridViewRow In GvProcesos.Rows
Roles.UpdateRolesProcesos(Row.DataKey("CveRol").ToEntero, Row.DataKey("CveProceso").ToEntero, If(Row.FCCheckBox("ChkP").Checked, 1, 0), UsuarioActual.CveUsuario)
Next
Roles.Dispose()
RegistraScript("$('#DivProcesos').modal('hide');")
End Sub
#Region "G V D A T O S"
Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Liga As String = String.Format("/Sistemas/RolesDetalle.aspx?CveRol={0}", e.Row.DataKey("CveRol"))
e.Row.FCHyperLink("HlRolDetalle").NavigateUrl = Liga
End If
End Sub
Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim Rol As New ClsSisRoles
Dim Clave = GvDatos.Rows(e.RowIndex).DataKey("CveRol").ToEntero
If Rol.RemoveRol(Clave) Then
Alert("Se ha eliminado correctamente.", TipoMensaje.MsgInformacion)
UpDatos.Update()
End If
Rol.Dispose()
CargaDatos()
End Sub
#End Region
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Response.Redirect($"/Sistemas/RolesDetalle.aspx?&CveRol={GvRow.DataKey("CveRol")}", True)
UpDatos.Update()
End Sub
End Class