Files
SIG/OI/SubidasADS.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

171 lines
7.2 KiB
VB.net

Imports System.Data
Imports Extensiones
Imports System.Linq
Imports Microsoft.Reporting.WebForms
Imports System.Data.OleDb
Partial Class OI_SubidasADS
Inherits ClsPaginas
Private Property Datos As DataTable
Get
If ViewState("Datos") Is Nothing Then
Return New DataTable
Else
Return DirectCast(ViewState("Datos"), DataTable)
End If
End Get
Set(value As DataTable)
ViewState("Datos") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
TxtFechaI.Text = Now.AddDays(-30).ToString("dd/MM/yyyy")
TxtFechaFin.Text = Now.ToString("dd/MM/yyyy")
If UsuarioActual.CveRol = 1 Then
CargaDatosSubidasPendientes()
ActualizarGV()
End If
CargaDatosSubidasPendientes()
End If
End Sub
Public Sub CargaDatosSubidasPendientes()
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloSubidaRepGet(TxtFechaI.Text.ToDate, TxtFechaFin.Text.ToDate, DdlOpcion.SelectedValue.ToEntero) Then
Datos = ObjDesarrollo.DtResultados
Datos.Columns.Add("ListaSubida")
Datos.Columns.Add("Comprometido")
Datos.AcceptChanges()
Else
Datos = Nothing
End If
If ObjDesarrollo.DesarrolloSubidaGet(-1, -1, "-1", -1) Then
Dim ComprometidosEnum = From row In ObjDesarrollo.DtResultados.FiltraParametros("CveSubidaCom > 0").AsEnumerable()
Select row.Field(Of String)("Comprometido") Distinct
LblComprometidos.Text = $"<strong>Comprometidos: <br/>"
For Each itemC In ComprometidosEnum
LblComprometidos.Text = LblComprometidos.Text & itemC.ToString & "<br/>"
Next
LblComprometidos.Text = LblComprometidos.Text & "</strong>"
For Each Drow As DataRow In Datos.Rows
Dim DTSubidas As New DataTable
'Dim ListaSubida As String = $"<a class='texto' data-toggle='collapse' data-target='#DV{Drow("CveDesarrollo").ToString }'>Mostrar subida</a> <br> <div id='DV{Drow("CveDesarrollo").ToString }' class='collapse'> <Table class='table table-striped' style='width:100%';><thead><tr><th>Tipo</th><th>Archivo</th><th>DB</th><th>Tabla</th><th>Campo</th><th>Tipo</th><th>Relacion</th><th>Procedimiento</th><th>Script</th></tr></thead><tbody>"
Dim ListaSubida As String = $"<a class='texto' data-toggle='collapse' data-target='#DV{Drow("CveDesarrollo").ToString }'>Mostrar subida</a> <br> <div id='DV{Drow("CveDesarrollo").ToString }' class='collapse'> <Table class='table table-striped' style='width:100%';><thead><tr><th>Tipo</th><th>Archivo</th><th>DB</th><th>Tabla</th><th>Campo</th><th>Tipo</th><th>Relacion</th><th>Procedimiento</th><th>Script</th></tr></thead><tbody>"
DTSubidas = ObjDesarrollo.DtResultados.FiltraParametros($"CveDesarrollo = {Drow("CveDesarrollo").ToString }")
For Each dRow2 As DataRow In DTSubidas.Rows
If dRow2("CveSubidaCom").ToString.Length > 0 Then
ListaSubida = ListaSubida & $"<tr style='background-color:#90C3D4;opacity: 0.5;'><td>{dRow2("SubidaTipo").ToString }</td><td>{dRow2("Subida").ToString}</td><td>{dRow2("DB").ToString}</td><td>{dRow2("Tabla").ToString}</td><td>{dRow2("Campo").ToString}</td><td>{dRow2("TipoDato").ToString}</td><td>{dRow2("LlaveForanea").ToString}</td><td>{dRow2("Procedimiento").ToString}</td><td> <a href='#' data-toggle='modal' data-target='#DVMensaje' onclick='copyToClipboard(""#DVC{ dRow2("CveSubida").ToString }"")' > { If(dRow2("Script").ToString.Trim.Length > 0, "<i class='fa fa-clipboard' aria-hidden='true'></i>", "") }</a> <div style='display:none' id='DVC{ dRow2("CveSubida").ToString }'>{ If(dRow2("Script").ToString.Trim.Length > 0, dRow2("Script").ToString, "") }</div></td></tr>"
Drow("Comprometido") = "1"
Else
ListaSubida = ListaSubida & $"<tr><td>{dRow2("SubidaTipo").ToString }</td><td>{dRow2("Subida").ToString}</td><td>{dRow2("DB").ToString}</td><td>{dRow2("Tabla").ToString}</td><td>{dRow2("Campo").ToString}</td><td>{dRow2("TipoDato").ToString}</td><td>{dRow2("LlaveForanea").ToString}</td><td>{dRow2("Procedimiento").ToString}</td><td> <a href='#' data-toggle='modal' data-target='#DVMensaje' onclick='copyToClipboard(""#DVC{ dRow2("CveSubida").ToString }"")' > { If(dRow2("Script").ToString.Trim.Length > 0, "<i class='fa fa-clipboard' aria-hidden='true'></i>", "") }</a> <div style='display:none' id='DVC{ dRow2("CveSubida").ToString }'>{ If(dRow2("Script").ToString.Trim.Length > 0, dRow2("Script").ToString, "") }</div></td></tr>"
If Drow("Comprometido").ToString = "" Then
Drow("Comprometido") = "0"
End If
End If
Next
ListaSubida = ListaSubida & "</tbody></table></div> "
Drow("Listasubida") = ListaSubida
Next
End If
GvDatos.DataSource = Datos
GvDatos.DataBind()
UPDatos.Update()
End Sub
Private Sub ActualizarGV()
GvDatos.DataSource = Datos
GvDatos.DataBind()
UPDatos.Update()
End Sub
Private Sub BtnGaurdar_Click(sender As Object, e As EventArgs) Handles BtnGaurdar.Click
Dim ObjDesarrollo As New ClsDesarrollo
For Each GvRow As GridViewRow In GvDatos.Rows
Dim ChkCompletado As CheckBox = GvRow.FCCheckBox("ChkCompletado")
If Not ChkCompletado Is Nothing And GvRow.DataKey("Actualizable").ToEntero = 1 Then
If ChkCompletado.Checked Then
If Not ObjDesarrollo.DesarrolloAddUpdate(GvRow.DataKey("CveDesarrollo").ToEntero, GvRow.DataKey("Desarrollo"), GvRow.DataKey("CveEvento").ToEntero, GvRow.DataKey("CveUsuarioResponsable").ToEntero, GvRow.DataKey("CveUsuarioPruebas"), GvRow.DataKey("CveModulo").ToEntero, GvRow.DataKey("Descripcion"), GvRow.DataKey("CveUsuarioAsignado").ToEntero, Nothing, -1, 5, -1, UsuarioActual.CveUsuario) Then
Alert("Se presento un error al actulizar los estados")
Exit For
End If
End If
End If
Next
ObjDesarrollo.Dispose()
CargaDatosSubidasPendientes()
ActualizarGV()
End Sub
Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("Actualizable").ToEntero = 1 And e.Row.DataKey("CveDesarrolloEstado").ToEntero = 4 Then
e.Row.FCCheckBox("ChkCompletado").Enabled = True
Else
e.Row.FCCheckBox("ChkCompletado").Visible = False
'e.Row.FCCheckBox("ChkCompletado").Checked = True
End If
End If
End Sub
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatosSubidasPendientes()
End Sub
End Class