CatEstatus listo en sitio falta checar los PA
This commit is contained in:
@@ -114,12 +114,12 @@
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
<ajax:TabPanel runat="server" ID="TabConfiguracion" HeaderText="Configuracion">
|
||||
<ajax:TabPanel runat="server" ID="TabPanel3" HeaderText="Configuración">
|
||||
<ContentTemplate>
|
||||
|
||||
<asp:UpdatePanel ID="UPPEmp" runat="server" UpdateMode="Conditional">
|
||||
<asp:UpdatePanel ID="UpPrueba" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvEstatusUsuarios" GridLines="None" CssClass="table table-striped table-advance table-hover" Width="100%" runat="server" AutoGenerateColumns="False" DataKeyNames="CveUsuario" EmptyDataText="No se encontraron Usuarios Registrados" ToolTip="Listado de Usuarios">
|
||||
<asp:GridView ID="Prueba" GridLines="None" CssClass="table table-striped table-advance table-hover" Width="100%" runat="server" AutoGenerateColumns="false" DataKeyNames="CveUsuario" EmptyDataText="No se encontraron Usuarios Registrados" ToolTip="Listado de Usuarios" style="text-align:center">
|
||||
<HeaderStyle VerticalAlign="Middle" />
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
@@ -129,177 +129,10 @@
|
||||
<asp:Label Font-Bold="true" Width="250px" ID="LblUsuario" runat="server" Text='<%# Eval("Nombre")%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus1" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios1" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior1" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites1" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus2" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios2" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior2" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites2" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus3" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios3" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior3" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites3" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus4" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios4" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior4" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites4" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus5" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios5" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior5" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites5" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus6" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios6" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior6" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites6" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus7" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios7" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior7" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites7" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus8" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios8" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior8" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites8" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus9" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios9" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior9" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites9" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
<ItemTemplate>
|
||||
<table style="text-align: center; width: 100%">
|
||||
<tr>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<asp:CheckBox ID="chkEstatus10" runat="server" /><asp:HiddenField runat="server" ID="hdnCveEstatusUsuarios10" />
|
||||
</td>
|
||||
<td style="width: 50%; text-align: left">
|
||||
<asp:Label ID="lblSuperior10" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
<asp:Label ID="lblLimites10" Font-Size="7" Font-Italic="true" runat="server"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<div style="width:100%;text-align:center">
|
||||
<asp:Button ID="btnGuardarEstatusUsuariosREQ" Text="Guardar" runat="server" Visible="true" CssClass="btn btn-primary" />
|
||||
<div style="width: 100%; text-align: center">
|
||||
<asp:Button ID="BtnGuardarPruebas" Text="Guardar" runat="server" Visible="true" CssClass="btn btn-primary" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
@@ -42,18 +42,34 @@ Partial Class OS_CatEstatusOrdenServicio
|
||||
ViewState("DTEstatusUsuarios") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DTUsuarios As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTUsuarios"), DataTable)
|
||||
End Get
|
||||
Set(value As Data.DataTable)
|
||||
ViewState("DTUsuarios") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtEstatusUsuariosAsociados As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtEstatusUsuariosAsociados"), DataTable)
|
||||
End Get
|
||||
Set(value As Data.DataTable)
|
||||
ViewState("DtEstatusUsuariosAsociados") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
DTUsuarios = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
CargaDatos()
|
||||
CreaGrid("Req")
|
||||
CargaGridEstatusUsuarios()
|
||||
ViewState("Orden") = ""
|
||||
|
||||
'CreaGrid()
|
||||
'CargaGridEstatusUsuarios()
|
||||
AsociarEstatusUsuarios()
|
||||
CargarUsuarioConEstatus()
|
||||
CveEstatuOS = -1
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -171,79 +187,65 @@ Partial Class OS_CatEstatusOrdenServicio
|
||||
#End Region
|
||||
|
||||
#Region "Configuracion"
|
||||
Private Sub CreaGrid(Tipo As String)
|
||||
Dim i As Integer = 1
|
||||
|
||||
For Each Row As DataRow In GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).Rows
|
||||
|
||||
GvEstatusUsuarios.Columns(i).HeaderText = Row("EstatusOrdenServicio").ToString.ToUpper
|
||||
GvEstatusUsuarios.Columns(i).FooterText = Row("CveEstatusOrdenServicio").ToString
|
||||
|
||||
i += 1
|
||||
Private Sub AsociarEstatusUsuarios()
|
||||
Dim tableResultado As DataTable = DTUsuarios
|
||||
For Each Estatus As DataRow In DtEstatusOS.Rows
|
||||
Dim CveColumnaEstatus As String = Estatus.Item("CveEstatusOrdenServicio").ToString
|
||||
tableResultado.Columns.Add(CveColumnaEstatus, Type.GetType("System.Boolean"))
|
||||
For Each Usuario As DataRow In tableResultado.Rows
|
||||
Usuario.Item(CveColumnaEstatus) = Not IsNothing(DTEstatusUsuarios.FiltroPrimero(String.Format("CveUsuario = {0} and CveEstatusOrdenServicio = {1}", Usuario.Item("CveUsuario"), CveColumnaEstatus)))
|
||||
Next
|
||||
Next
|
||||
|
||||
While i <= 10
|
||||
GvEstatusUsuarios.Columns(i).Visible = False
|
||||
i += 1
|
||||
End While
|
||||
DtEstatusUsuariosAsociados = tableResultado
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaGridEstatusUsuarios()
|
||||
GvEstatusUsuarios.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
GvEstatusUsuarios.DataBind()
|
||||
'UPPEmp.Update()
|
||||
Private Sub CargarUsuarioConEstatus()
|
||||
For Each Estatus As DataRow In DtEstatusOS.Rows
|
||||
Dim test As New CheckBoxField
|
||||
test.HeaderText = Estatus.Item("EstatusOrdenServicio").ToString
|
||||
test.DataField = Estatus.Item("CveEstatusOrdenServicio").ToString
|
||||
Prueba.Columns.Add(test)
|
||||
Next
|
||||
Prueba.DataSource = DtEstatusUsuariosAsociados
|
||||
Prueba.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub btnGuardarEstatusUsuariosREQ_Click(sender As Object, e As EventArgs) Handles btnGuardarEstatusUsuariosREQ.Click
|
||||
Private Sub Prueba_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Prueba.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim PermisosDeUsuario As DataTable = DTEstatusUsuarios.FiltraParametros(String.Format("CveUsuario = {0}", e.Row.DBCampo("CveUsuario").ToString))
|
||||
For i As Integer = 1 To e.Row.Cells.Count - 1
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim checkBox As CheckBox = TryCast(e.Row.Cells(i).Controls(0), CheckBox)
|
||||
checkBox.Enabled = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GuardarDatosPrueba(sender As Object, e As EventArgs) Handles BtnGuardarPruebas.Click
|
||||
Dim objEstatusOC As New ClsOS
|
||||
objEstatusOC.IniciaTransacSQL()
|
||||
Dim HuboErrores As Boolean = False
|
||||
Dim CveSubProyecto = 59
|
||||
|
||||
For Each Row As GridViewRow In GvEstatusUsuarios.Rows
|
||||
Dim r As Integer = 1
|
||||
For i = 0 To Row.Cells.Count - 1
|
||||
|
||||
Dim CveEstatus As Integer = If(IsNumeric(GvEstatusUsuarios.Columns(i).FooterText), GvEstatusUsuarios.Columns(i).FooterText.ToEntero, 0)
|
||||
|
||||
If CveEstatus > 0 Then
|
||||
|
||||
If Row.FCCheckBox("chkEstatus" + r.ToString).Checked = False Then
|
||||
'Eliminar el registro existente
|
||||
If Not objEstatusOC.RemoveEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
ElseIf Row.FCCheckBox("chkEstatus" + r.ToString).Checked = True Then
|
||||
'Guardado masivo cuando sea SubProyecto "Todos"
|
||||
If CveSubProyecto = -2 Then
|
||||
For Each dr As DataRow In GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).Rows
|
||||
If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero, CveSubProyecto) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If HuboErrores Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Insertar el nuevo registro
|
||||
Else
|
||||
If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero, CveSubProyecto) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
For Each Row As GridViewRow In Prueba.Rows
|
||||
Dim controles As Integer = Row.Controls.Count
|
||||
For i = 1 To Row.Cells.Count - 1
|
||||
Dim chk As CheckBox = CType(Row.Cells(i).Controls(0), CheckBox)
|
||||
Dim CveEstatus As Integer = DtEstatusOS.FiltroPrimeroValor("CveEstatusOrdenServicio", String.Format("EstatusOrdenServicio = '{0}'", Prueba.Columns(i).HeaderText)).ToEntero
|
||||
If Not chk.Checked Then
|
||||
If Not objEstatusOC.RemoveEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
ElseIf chk.Checked Then
|
||||
'Guardado masivo cuando sea SubProyecto "Todos"
|
||||
If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero, CveSubProyecto) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
r += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
'Si tubo algun error terminamos el proceso (FOR)
|
||||
If HuboErrores Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not HuboErrores Then
|
||||
@@ -253,27 +255,7 @@ Partial Class OS_CatEstatusOrdenServicio
|
||||
objEstatusOC.RollBack()
|
||||
Alert("Ocurrió un error al guardar los cambios. Por favor vuelva a intentar", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
objEstatusOC.Dispose()
|
||||
CargaDatos()
|
||||
CargaGridEstatusUsuarios()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvEstatusUsuarios_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstatusUsuarios.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim PermisosDeUsuario As DataTable = DTEstatusUsuarios.FiltraParametros(String.Format("CveUsuario = {0}", e.Row.DBCampo("CveUsuario").ToString))
|
||||
Dim CveUsuario As String = e.Row.DBCampo("CveUsuario").ToString
|
||||
For i As Integer = 1 To 10
|
||||
Dim CveEstatus As Integer = GvEstatusUsuarios.Columns(i).FooterText.ToEntero
|
||||
If CveEstatus > 0 Then
|
||||
Dim auxiliarBandera As DataRow = PermisosDeUsuario.FiltroPrimero(String.Format("CveEstatusOrdenServicio = {0}", CveEstatus.ToString))
|
||||
If auxiliarBandera IsNot Nothing Then
|
||||
Dim chkEstatus As CheckBox = e.Row.FCCheckBox(String.Format("chkEstatus{0}", i))
|
||||
chkEstatus.Checked = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user