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

1053 lines
37 KiB
VB.net

Option Strict On
Imports System.Data
Imports Extensiones
Imports System.IO
Imports System.Globalization
Partial Class OI_DesarrolloWizard
Inherits ClsPaginas
Property CveDesarrollo As Integer
Get
If ViewState("CveDesarrollo") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveDesarrollo"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveDesarrollo") = value
End Set
End Property
Property Desarrollo As String
Get
If ViewState("Desarrollo") Is Nothing Then
Return ""
Else
Return ViewState("Desarrollo").ToString
End If
End Get
Set(value As String)
ViewState("Desarrollo") = value
End Set
End Property
Property CveDesarrolloEstado As Integer
Get
If ViewState("CveDesarrolloEstado") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveDesarrolloEstado"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveDesarrolloEstado") = value
End Set
End Property
Property CveUsuarioAsignado As Integer
Get
If ViewState("CveUsuarioAsignado") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveUsuarioAsignado"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveUsuarioAsignado") = value
End Set
End Property
Property CveUsuarioPruebas As Integer
Get
If ViewState("CveUsuarioPruebas") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveUsuarioPruebas"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveUsuarioPruebas") = value
End Set
End Property
Property CveUsuarioResponsable As Integer
Get
If ViewState("CveUsuarioResponsable") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveUsuarioResponsable"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveUsuarioResponsable") = value
End Set
End Property
Property CveEvento As Integer
Get
If ViewState("CveEvento") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveEvento"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveEvento") = value
End Set
End Property
Property CveUsuario As Integer
Get
If ViewState("CveUsuario") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveUsuario"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveUsuario") = value
End Set
End Property
Property Descripcion As String
Get
If ViewState("Descripcion") Is Nothing Then
Return ""
Else
Return ViewState("Descripcion").ToString
End If
End Get
Set(value As String)
ViewState("Descripcion") = value
End Set
End Property
Property TiempoEstimado As Integer
Get
If ViewState("TiempoEstimado") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("TiempoEstimado"), Integer)
End If
End Get
Set(value As Integer)
ViewState("TiempoEstimado") = value
End Set
End Property
Property CveModuloDesarrollo As Integer
Get
If ViewState("CveModuloDesarrollo") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveModuloDesarrollo"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveModuloDesarrollo") = value
End Set
End Property
#Region "Subida"
Property CveSubida As Integer
Get
If ViewState("CveSubida") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveSubida"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveSubida") = value
End Set
End Property
Property Subida As String
Get
If ViewState("Subida") Is Nothing Then
Return "-1"
Else
Return ViewState("Subida").ToString
End If
End Get
Set(value As String)
ViewState("Subida") = value
End Set
End Property
Property CveSubidaTipo As Integer
Get
If ViewState("CveSubidaTipo") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveSubidaTipo"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveSubidaTipo") = value
End Set
End Property
Property SubidaTipo As String
Get
If ViewState("SubidaTipo") Is Nothing Then
Return "-1"
Else
Return ViewState("SubidaTipo").ToString
End If
End Get
Set(value As String)
ViewState("SubidaTipo") = value
End Set
End Property
Property Tabla As String
Get
If ViewState("Tabla") Is Nothing Then
Return "-1"
Else
Return ViewState("Tabla").ToString
End If
End Get
Set(value As String)
ViewState("Tabla") = value
End Set
End Property
Property DB As String
Get
If ViewState("DB") Is Nothing Then
Return "-1"
Else
Return ViewState("DB").ToString
End If
End Get
Set(value As String)
ViewState("DB") = value
End Set
End Property
Property Campo As String
Get
If ViewState("Campo") Is Nothing Then
Return "-1"
Else
Return ViewState("Campo").ToString
End If
End Get
Set(value As String)
ViewState("Campo") = value
End Set
End Property
Property Procedimiento As String
Get
If ViewState("Procedimiento") Is Nothing Then
Return "-1"
Else
Return ViewState("Procedimiento").ToString
End If
End Get
Set(value As String)
ViewState("Procedimiento") = value
End Set
End Property
#End Region
Private Sub OI_DesarrolloWizard_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Not Request.QueryString("CveDesarrollo") Is Nothing Then
CveDesarrollo = Request.QueryString("CveDesarrollo").ToString.ToEntero
CargaComboSubidaTipo()
CargaDesarrollo()
CargaDesarrolloDetallesTareas()
CargaDesarrolloDetallesPruebas()
CargaSubidas()
CargaAdjuntos()
PosisicionarPasoActual(CveDesarrolloEstado - 1)
End If
End If
End Sub
Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
RegistraScript("$(document).ready(function(){$('#form_wizard_1').bootstrapWizard('previous');}); ")
End Sub
Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
Dim Siguiente As Boolean = True
If CveDesarrolloEstado = 2 Then
Siguiente = ValidaPasoUno()
If Siguiente Then
Dim ObjDesarrollo As New ClsDesarrollo
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 3, -1, UsuarioActual.CveUsuario)
ObjDesarrollo.Dispose()
Response.Redirect($"DesarrolloWizard.aspx?CveDesarrollo={CveDesarrollo}")
End If
End If
If CveDesarrolloEstado = 3 Then
Siguiente = ValidaPasoDos()
If Siguiente Then
Dim ObjDesarrollo As New ClsDesarrollo
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 4, -1, UsuarioActual.CveUsuario)
ObjDesarrollo.Dispose()
Response.Redirect($"DesarrolloWizard.aspx?CveDesarrollo={CveDesarrollo}")
End If
End If
If Siguiente Then
RegistraScript("$(document).ready(function(){$('#form_wizard_1').bootstrapWizard('next');}); ")
End If
End Sub
Private Sub CargaDesarrolloDetallesTareas()
If CveDesarrollo > 0 Then
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloDetalleGet(-1, CveDesarrollo, -1, "-1", -1) Then
Dim DtDatosDetalles As New DataTable
DtDatosDetalles = ObjDesarrollo.DtResultados
GvFTTareas.DataSource = DtDatosDetalles.FiltraParametros("CveDesarrolloDetalleTipo = 1")
GvFTTareas.DataBind()
GvFTComprobaciones.DataSource = DtDatosDetalles.FiltraParametros("CveDesarrolloDetalleTipo = 2")
GvFTComprobaciones.DataBind()
GvFTRecomendaciones.DataSource = DtDatosDetalles.FiltraParametros("CveDesarrolloDetalleTipo = 3")
GvFTRecomendaciones.DataBind()
Else
GvFTTareas.DataSource = Nothing
GvFTTareas.DataBind()
GvFTComprobaciones.DataSource = Nothing
GvFTComprobaciones.DataBind()
GvFTRecomendaciones.DataSource = Nothing
GvFTRecomendaciones.DataBind()
End If
UpFT.Update()
ObjDesarrollo.Dispose()
End If
End Sub
Private Sub CargaDesarrolloDetallesPruebas()
If CveDesarrollo > 0 Then
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloDetalleGet(-1, CveDesarrollo, -1, "-1", -1) Then
Dim DtDatosDetalles As New DataTable
DtDatosDetalles = ObjDesarrollo.DtResultados
GvPruebasBasicas.DataSource = DtDatosDetalles.FiltraParametros("CveDesarrolloDetalleTipo = 4")
GvPruebasBasicas.DataBind()
GvPruebaspecificas.DataSource = DtDatosDetalles.FiltraParametros("CveDesarrolloDetalleTipo = 5")
GvPruebaspecificas.DataBind()
Else
GvPruebasBasicas.DataSource = Nothing
GvPruebasBasicas.DataBind()
GvPruebaspecificas.DataSource = Nothing
GvPruebaspecificas.DataBind()
End If
UpPruebas.Update()
ObjDesarrollo.Dispose()
End If
End Sub
Private Sub CargaDesarrollo()
If CveDesarrollo > 0 Then
Dim objDesarrolo As New ClsDesarrollo
If objDesarrolo.DesarrolloGet(CveDesarrollo, -1, -1, -1, -1, -1, "-1", -1, -1, -1) Then
If objDesarrolo.DtResultados.Rows.Count > 0 Then
LblDesarrollo.Text = objDesarrolo.DtResultados(0)("Desarrollo").ToString '
CveDesarrolloEstado = objDesarrolo.DtResultados(0)("CveDesarrolloEstado").ToString.ToEntero
CveUsuarioAsignado = objDesarrolo.DtResultados(0)("CveUsuarioAsignado").ToString.ToEntero
CveUsuarioResponsable = objDesarrolo.DtResultados(0)("CveUsuarioResponsable").ToString.ToEntero '
CveUsuarioPruebas = objDesarrolo.DtResultados(0)("CveUsuarioPruebas").ToString.ToEntero
CveEvento = objDesarrolo.DtResultados(0)("CveEvento").ToString.ToEntero
CveUsuario = objDesarrolo.DtResultados(0)("CveUsuario").ToString.ToEntero
Descripcion = objDesarrolo.DtResultados(0)("Descripcion").ToString
TiempoEstimado = objDesarrolo.DtResultados(0)("Descripcion").ToString.ToEntero
CveModuloDesarrollo = objDesarrolo.DtResultados(0)("CveModulo").ToString.ToEntero
If CveDesarrolloEstado < 4 Then
ChkProduccion.Checked = False
ChkProduccion.Enabled = False
ChkClienteNotificado.Checked = False
ChkClienteNotificado.Enabled = False
End If
If CveDesarrolloEstado = 4 Then
ChkProduccion.Checked = False
ChkProduccion.Enabled = True
ChkClienteNotificado.Checked = False
ChkClienteNotificado.Enabled = False
End If
If CveDesarrolloEstado = 5 Then
ChkProduccion.Checked = True
ChkClienteNotificado.Checked = False
ChkClienteNotificado.Enabled = False
End If
If CveDesarrolloEstado = 6 Then
ChkProduccion.Checked = True
ChkClienteNotificado.Checked = True
ChkClienteNotificado.Enabled = True
End If
End If
If CveDesarrolloEstado = 1 Then
Response.Redirect("./RepDesarrollo.aspx")
End If
If Not UsuarioActual.CveUsuario = CveUsuarioResponsable Then
If Not (UsuarioActual.CveUsuario = CveUsuarioAsignado And CveDesarrolloEstado = 2) Then
If Not (UsuarioActual.CveUsuario = CveUsuarioPruebas And CveDesarrolloEstado = 3) Then
Response.Redirect("./RepDesarrollo.aspx")
End If
End If
End If
End If
objDesarrolo.Dispose()
End If
End Sub
Private Sub CargaComboSubidaTipo()
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloSubidaTipoGet Then
DdlSubidaTipo.DataSource = ObjDesarrollo.DtResultados
DdlSubidaTipo.DataBind()
DdlSubidaTipo.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
Else
DdlSubidaTipo.DataSource = Nothing
DdlSubidaTipo.DataBind()
DdlSubidaTipo.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End If
UpModalSubida.Update()
End Sub
Private Sub CargaSubidas()
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloSubidaGet(-1, CveDesarrollo, "-1", -1) Then
GVSubida.DataSource = ObjDesarrollo.DtResultados
GVSubida.DataBind()
End If
ObjDesarrollo.Dispose()
UpFT.Update()
End Sub
Private Sub PosisicionarPasoActual(PasoActual As Integer)
Dim x As Integer = 1
Dim sPasos As String = ""
Select Case CveDesarrolloEstado
Case 1
Exit Select
Case 2
Exit Select
Case 3
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
Exit Select
Case 4
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
Exit Select
Case 5
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
Exit Select
Case 6
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
sPasos = sPasos & "$('#form_wizard_1').bootstrapWizard('next');"
Exit Select
End Select
RegistraScript("$(document).ready(function(){" & sPasos & "}); ")
End Sub
'Private Sub ActulizarGrids()
' Dim objDesarrollo As New ClsDesarrollo
' If CveDesarrolloEstado = 1 Then
' For Each drow As GridViewRow In GvFTTareas.Rows
' 'CveDesarrolloDetalle,CveDesarrollo,CveDesarrolloDetalleTipo, Descripcion,Comentario, Estatus,CveUsuario,P1,P2,P3
' objDesarrollo.DesarrolloDetalleAddUpdate(drow.DBCampo("CveDesarrolloDetalle").ToString.ToEntero, drow.DBCampo("CveDesarrollo").ToString.ToEntero,
' drow.DBCampo("CveDesarrolloDetalleTipo").ToString.ToEntero, drow.DBCampo("Descripcion").ToString,
' "-1", If(drow.FCCheckBox("ChkEstatus").Checked, 1, 0),
' UsuarioActual.CveUsuario, -1, -1, -1)
' Next
' For Each drow As GridViewRow In GvFTComprobaciones.Rows
' objDesarrollo.DesarrolloDetalleAddUpdate(drow.DBCampo("CveDesarrolloDetalle").ToString.ToEntero, drow.DBCampo("CveDesarrollo").ToString.ToEntero,
' drow.DBCampo("CveDesarrolloDetalleTipo").ToString.ToEntero, drow.DBCampo("Descripcion").ToString,
' "-1", If(drow.FCCheckBox("ChkEstatus").Checked, 1, 0),
' UsuarioActual.CveUsuario, -1, -1, -1)
' Next
' For Each drow As GridViewRow In GvFTRecomendaciones.Rows
' objDesarrollo.DesarrolloDetalleAddUpdate(drow.DBCampo("CveDesarrolloDetalle").ToString.ToEntero, drow.DBCampo("CveDesarrollo").ToString.ToEntero,
' drow.DBCampo("CveDesarrolloDetalleTipo").ToString.ToEntero, drow.DBCampo("Descripcion").ToString,
' "-1", If(drow.FCCheckBox("ChkEstatus").Checked, 1, 0),
' UsuarioActual.CveUsuario, -1, -1, -1)
' Next
' End If
' If CveDesarrolloEstado = 2 Then
' For Each drow As GridViewRow In GvPruebasBasicas.Rows
' objDesarrollo.DesarrolloDetalleAddUpdate(drow.DBCampo("CveDesarrolloDetalle").ToString.ToEntero, drow.DBCampo("CveDesarrollo").ToString.ToEntero,
' drow.DBCampo("CveDesarrolloDetalleTipo").ToString.ToEntero, drow.DBCampo("Descripcion").ToString,
' "-1", -1,
' UsuarioActual.CveUsuario, If(drow.FCCheckBox("ChkP1").Checked, 1, 0), If(drow.FCCheckBox("ChkP2").Checked, 1, 0), If(drow.FCCheckBox("ChkP3").Checked, 1, 0))
' Next
' For Each drow As GridViewRow In GvPruebaspecificas.Rows
' objDesarrollo.DesarrolloDetalleAddUpdate(drow.DBCampo("CveDesarrolloDetalle").ToString.ToEntero, drow.DBCampo("CveDesarrollo").ToString.ToEntero,
' drow.DBCampo("CveDesarrolloDetalleTipo").ToString.ToEntero, drow.DBCampo("Descripcion").ToString,
' "-1", -1,
' UsuarioActual.CveUsuario, If(drow.FCCheckBox("ChkP1").Checked, 1, 0), If(drow.FCCheckBox("ChkP2").Checked, 1, 0), If(drow.FCCheckBox("ChkP3").Checked, 1, 0))
' Next
' End If
' objDesarrollo.Dispose()
'End Sub
Private Function ValidaPasoUno() As Boolean
Dim Respuesta = False
For Each drow As GridViewRow In GvFTTareas.Rows
If drow.FCCheckBox("ChkEstatus").Checked Then
Respuesta = True
Else
Return False
End If
Next
For Each drow As GridViewRow In GvFTComprobaciones.Rows
If drow.FCCheckBox("ChkEstatus").Checked Then
Respuesta = True
Else
Return False
End If
Next
Return Respuesta
End Function
Private Function ValidaPasoDos() As Boolean
Dim Respuesta = False
For Each drow As GridViewRow In GvPruebasBasicas.Rows
If drow.FCCheckBox("ChkP1").Checked And drow.FCCheckBox("ChkP2").Checked And drow.FCCheckBox("ChkP3").Checked Then
Respuesta = True
Else
Return False
End If
Next
For Each drow As GridViewRow In GvPruebaspecificas.Rows
If drow.FCCheckBox("ChkP1").Checked And drow.FCCheckBox("ChkP2").Checked And drow.FCCheckBox("ChkP3").Checked Then
Respuesta = True
Else
Return False
End If
Next
Return Respuesta
End Function
Public Sub ChkTareas_Click(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
Dim Drow As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow)
If ObjDesarrollo.DesarrolloDetalleAddUpdate(Drow.DataKey("CveDesarrolloDetalle").ToString.ToEntero, Drow.DataKey("CveDesarrollo").ToString.ToEntero,
Drow.DataKey("CveDesarrolloDetalleTipo").ToString.ToEntero, Drow.DataKey("Descripcion").ToString,
"-1", If(Drow.FCCheckBox("ChkEstatus").Checked, 1, 0),
UsuarioActual.CveUsuario, -1, -1, -1, Drow.DataKey("CvePrioridad").ToString.ToEntero) Then
Else
Alert("Se presento un error al actualizar el registro.")
End If
If ValidaPasoUno() Then
'ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 3, -1, UsuarioActual.CveUsuario)
'ObjDesarrollo.Dispose()
'Response.Redirect($"DesarrolloWizard.aspx?CveDesarrollo={CveDesarrollo}")
Else
If CveDesarrolloEstado <> 2 Then
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 2, -1, UsuarioActual.CveUsuario)
ObjDesarrollo.DesarrolloDetalleCamniaEstadoDesarrollo(CveDesarrollo)
ObjDesarrollo.Dispose()
Response.Redirect($"DesarrolloWizard.aspx?CveDesarrollo={CveDesarrollo}")
End If
ObjDesarrollo.Dispose()
End If
End Sub
Public Sub ChkPruebas_Click(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
Dim Drow As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow)
If ObjDesarrollo.DesarrolloDetalleAddUpdate(Drow.DataKey("CveDesarrolloDetalle").ToString.ToEntero, Drow.DataKey("CveDesarrollo").ToString.ToEntero,
Drow.DataKey("CveDesarrolloDetalleTipo").ToString.ToEntero, Drow.DataKey("Descripcion").ToString,
"-1", 0,
UsuarioActual.CveUsuario, If(Drow.FCCheckBox("ChkP1").Checked, 1, 0), If(Drow.FCCheckBox("ChkP2").Checked, 1, 0), If(Drow.FCCheckBox("ChkP3").Checked, 1, 0), Drow.DataKey("CvePrioridad").ToString.ToEntero) Then
Else
Alert("Se presento un error al actualizar el registro.")
End If
If ValidaPasoDos() Then
'ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 4, -1, UsuarioActual.CveUsuario)
'ObjDesarrollo.Dispose()
'ChkClienteNotificado.Checked = False
'ChkProduccion.Checked = False
'UpTerminado.Update()
Response.Redirect($"./DesarrolloWizard.aspx?CveDesarrollo={CveDesarrollo}")
Else
If CveDesarrolloEstado <> 3 Then
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, 3, -1, UsuarioActual.CveUsuario)
End If
ObjDesarrollo.Dispose()
End If
End Sub
Protected Sub ChkProduccion_CheckedChanged(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
CveDesarrolloEstado = If(ChkProduccion.Checked, 5, 4)
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, CveDesarrolloEstado, -1, UsuarioActual.CveUsuario)
ObjDesarrollo.Dispose()
If ChkProduccion.Checked Then
ChkClienteNotificado.Enabled = True
Else
ChkClienteNotificado.Enabled = False
ChkClienteNotificado.Checked = False
End If
UpTerminado.Update()
End Sub
Protected Sub ChkClienteNotificado_CheckedChanged(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
CveDesarrolloEstado = If(ChkClienteNotificado.Checked, 6, 5)
ObjDesarrollo.DesarrolloAddUpdate(CveDesarrollo, LblDesarrollo.Text, CveEvento, CveUsuario, CveUsuarioPruebas, CveModuloDesarrollo, Descripcion, CveUsuarioAsignado, Nothing, TiempoEstimado, CveDesarrolloEstado, -1, UsuarioActual.CveUsuario)
ObjDesarrollo.Dispose()
End Sub
Public Sub EditSubida_Click(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveSubida = GvRow.DataKey("CveSubida").ToEntero
TxtSubidaArchivo.Text = GvRow.DataKey("Subida").ToString
DdlSubidaTipo.SelectedValueExist(GvRow.DataKey("CveSubidaTipo").ToString.ToEntero)
TxtSubidaDB.Text = GvRow.DataKey("DB").ToString
TxtSubidaTabla.Text = GvRow.DataKey("Tabla").ToString
TxtSubidaCampo.Text = GvRow.DataKey("Campo").ToString
TxtSubidaProcedimiento.Text = GvRow.DataKey("Procedimiento").ToString
TxtSubidaTipoDato.Text = GvRow.DataKey("TipoDato").ToString
TxtSubidaLlaveForanea.Text = GvRow.DataKey("LlaveForanea").ToString
TxtSubidaScript.Text = GvRow.DataKey("Script").ToString
LnkModalAgregarSubida.Text = "Actualizar"
LtlTituloModalSubida.Text = "Actualizar subida"
UpModalSubida.Update()
ActuzliaModal()
RegistraScript("$('#DivModalSubida').modal({ backdrop: 'static', keyboard: false});", "RSSubida")
End Sub
Public Sub DeleteSubida_Click(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim _CveSubida = GvRow.DataKey("CveSubida").ToEntero
If ObjDesarrollo.DesarrolloSubidaRemove(_CveSubida) Then
Else
Alert("Se presento un error al elminar la subida", TipoMensaje.MsgError)
End If
CargaSubidas()
ObjDesarrollo.Dispose()
End Sub
Private Sub LnkAgregarbubida_Click(sender As Object, e As EventArgs) Handles LnkAgregarbubida.Click
CveSubida = -1
DdlSubidaTipo.SelectedIndex = 0
ActuzliaModal()
LnkModalAgregarSubida.Text = "Guardar"
LtlTituloModalSubida.Text = "Agregar Subida"
TxtSubidaArchivo.Text = ""
TxtSubidaDB.Text = ""
TxtSubidaTabla.Text = ""
TxtSubidaCampo.Text = ""
TxtSubidaProcedimiento.Text = ""
TxtSubidaTipoDato.Text = ""
TxtSubidaLlaveForanea.Text = ""
TxtSubidaScript.Text = ""
ActuzliaModal()
UpModalSubida.Update()
RegistraScript("$('#DivModalSubida').modal({ backdrop: 'static', keyboard: false});", "RSSubida")
End Sub
Private Sub DdlSubidaTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubidaTipo.SelectedIndexChanged
LimpiaModalSubida()
End Sub
Private Sub LimpiaModalSubida()
TxtSubidaArchivo.Text = ""
TxtSubidaDB.Text = ""
TxtSubidaTabla.Text = ""
TxtSubidaCampo.Text = ""
TxtSubidaProcedimiento.Text = ""
TxtSubidaTipoDato.Text = ""
TxtSubidaLlaveForanea.Text = ""
TxtSubidaScript.Text = ""
ActuzliaModal()
End Sub
Private Sub ActuzliaModal()
If DdlSubidaTipo.SelectedValue.ToEntero = -1 Then
RfvTxtSubidaArchivo.Enabled = False
DvSubidaArchivo.Visible = False
DvSubidaDB.Visible = False
RfvTxtSubidaDB.Enabled = False
DvSubidaTabla.Visible = False
RfvTxtSubidaTabla.Enabled = False
DvSubidaCampo.Visible = False
RfvTxtSubidaCampo.Enabled = False
DvSubidaLlabeForanea.Visible = False
' RfvTxtSubidaLlaveForanea.Enabled = False
DvSubidaTipoDato.Visible = False
RfvTxtSubidaTipoDato.Enabled = False
DvSubidaProcedimiento.Visible = False
RfvTxtSubidaProcedimiento.Enabled = False
DvSubidaScript.Visible = False
End If
If DdlSubidaTipo.SelectedValue.ToEntero = 1 Then
RfvTxtSubidaArchivo.Enabled = True
DvSubidaArchivo.Visible = True
DvSubidaDB.Visible = False
RfvTxtSubidaDB.Enabled = False
DvSubidaTabla.Visible = False
RfvTxtSubidaTabla.Enabled = False
DvSubidaCampo.Visible = False
RfvTxtSubidaCampo.Enabled = False
DvSubidaLlabeForanea.Visible = False
' RfvTxtSubidaLlaveForanea.Enabled = False
DvSubidaTipoDato.Visible = False
RfvTxtSubidaTipoDato.Enabled = False
DvSubidaProcedimiento.Visible = False
RfvTxtSubidaProcedimiento.Enabled = False
DvSubidaScript.Visible = False
End If
If DdlSubidaTipo.SelectedValue.ToEntero = 2 Then
RfvTxtSubidaArchivo.Enabled = False
DvSubidaArchivo.Visible = False
DvSubidaDB.Visible = True
RfvTxtSubidaDB.Enabled = True
DvSubidaTabla.Visible = True
RfvTxtSubidaTabla.Enabled = True
DvSubidaLlabeForanea.Visible = False
' RfvTxtSubidaLlaveForanea.Enabled = False
DvSubidaTipoDato.Visible = False
RfvTxtSubidaTipoDato.Enabled = False
DvSubidaCampo.Visible = False
RfvTxtSubidaCampo.Enabled = False
DvSubidaProcedimiento.Visible = False
RfvTxtSubidaProcedimiento.Enabled = False
DvSubidaScript.Visible = True
End If
If DdlSubidaTipo.SelectedValue.ToEntero = 3 Then
RfvTxtSubidaArchivo.Enabled = False
DvSubidaArchivo.Visible = False
DvSubidaDB.Visible = True
RfvTxtSubidaDB.Enabled = True
DvSubidaTabla.Visible = True
RfvTxtSubidaTabla.Enabled = True
DvSubidaCampo.Visible = True
RfvTxtSubidaCampo.Enabled = True
DvSubidaLlabeForanea.Visible = True
DvSubidaTipoDato.Visible = True
RfvTxtSubidaTipoDato.Enabled = True
DvSubidaProcedimiento.Visible = False
RfvTxtSubidaProcedimiento.Enabled = False
DvSubidaScript.Visible = True
End If
If DdlSubidaTipo.SelectedValue.ToEntero = 4 Then
RfvTxtSubidaArchivo.Enabled = False
DvSubidaArchivo.Visible = False
DvSubidaDB.Visible = True
RfvTxtSubidaDB.Enabled = True
DvSubidaTabla.Visible = False
RfvTxtSubidaTabla.Enabled = False
DvSubidaCampo.Visible = False
RfvTxtSubidaCampo.Enabled = False
DvSubidaLlabeForanea.Visible = False
DvSubidaTipoDato.Visible = False
RfvTxtSubidaTipoDato.Enabled = False
DvSubidaProcedimiento.Visible = True
RfvTxtSubidaProcedimiento.Enabled = True
DvSubidaScript.Visible = True
End If
UpModalSubida.Update()
End Sub
Private Sub LnkModalAgregarSubida_Click(sender As Object, e As EventArgs) Handles LnkModalAgregarSubida.Click
Dim objDesarrollo As New ClsDesarrollo
Dim _SubidaArchivo As String = If(TxtSubidaArchivo.Text.Trim.Length = 0, "-1", TxtSubidaArchivo.Text.Trim)
Dim _DB As String = If(TxtSubidaDB.Text.Trim.Length = 0, "-1", TxtSubidaDB.Text.Trim)
Dim _Procedimiento As String = If(TxtSubidaProcedimiento.Text.Trim.Length = 0, "-1", TxtSubidaProcedimiento.Text.Trim)
Dim _Tabla As String = If(TxtSubidaTabla.Text.Trim.Length = 0, "-1", TxtSubidaTabla.Text.Trim)
Dim _Campo As String = If(TxtSubidaCampo.Text.Trim.Length = 0, "-1", TxtSubidaCampo.Text.Trim)
Dim _LlaveForanea As String = If(TxtSubidaLlaveForanea.Text.Trim.Length = 0, "-1", TxtSubidaLlaveForanea.Text.Trim)
Dim _TipoDato As String = If(TxtSubidaTipoDato.Text.Trim.Length = 0, "-1", TxtSubidaTipoDato.Text.Trim)
Dim _Script As String = If(TxtSubidaScript.Text.Trim.Length = 0, "-1", TxtSubidaScript.Text)
If objDesarrollo.DesarrolloSubidaAddUpdate(CveSubida, CveDesarrollo, _SubidaArchivo, DdlSubidaTipo.SelectedValue.ToEntero, _DB, _Procedimiento, _Tabla, _Campo, UsuarioActual.CveUsuario, _LlaveForanea, _TipoDato, _Script) Then
If Not ChkModalSubidaContinuarAgregando.Checked Then
RegistraScript("$('#DivModalSubida').modal('hide');", "RSSubida")
End If
DdlSubidaTipo.SelectedIndex = 0
CargaSubidas()
LimpiaModalSubida()
Else
If CveSubida > 0 Then
Alert("Se presento un error al agregar la subida", TipoMensaje.MsgError)
Else
Alert("Se presento un error al actualizar la subida", TipoMensaje.MsgError)
End If
End If
objDesarrollo.Dispose()
End Sub
Private Sub LnkMostrarAdjuntos_Click(sender As Object, e As EventArgs) Handles LnkMostrarAdjuntos.Click
CargaAdjuntos()
RegistraScript("$('#DIVModalAdjuntos').modal({ backdrop: 'static', keyboard: false});", "MAdjuntos")
End Sub
Private Sub CargaAdjuntos()
If CveDesarrollo > 0 Then
Dim ObjDesarrollo As New ClsDesarrollo
If ObjDesarrollo.DesarrolloAdjuntoGet(-1, CveDesarrollo, "-1") Then
GvAdjuntos.DataSource = ObjDesarrollo.DtResultados
GvAdjuntos.DataBind()
If ObjDesarrollo.DtResultados.Rows.Count > 0 Then
LnkMostrarAdjuntos.Visible = True
UpModalTools.Update()
Else
LnkMostrarAdjuntos.Visible = False
UpModalTools.Update()
End If
Else
GvAdjuntos.DataSource = Nothing
GvAdjuntos.DataBind()
LnkMostrarAdjuntos.Visible = False
UpModalTools.Update()
End If
ObjDesarrollo.Dispose()
UpAdjunto.Update()
End If
End Sub
Public Sub DowloadAdjunto_Click(sender As Object, e As EventArgs)
Dim ObjDesarrollo As New ClsDesarrollo
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim _DesarrolloAdjuntoArchivo As String = GvRow.DataKey("DesarrolloAdjuntoArchivo")
Dim RutaAdjunto As String = Server.MapPath("~/") & "Empresas\2\Desarrollo\Adjuntos\" & _DesarrolloAdjuntoArchivo
Response.ClearContent()
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", $"attachment; filename={ _DesarrolloAdjuntoArchivo };")
Response.TransmitFile(RutaAdjunto)
Response.Flush()
Response.End()
End Sub
Private Sub GvAdjuntos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAdjuntos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim _DesarrolloAdjuntoArchivo As String = e.Row.DataKey("DesarrolloAdjuntoArchivo")
Dim RutaAdjunto As String = Server.MapPath("~/").ToString & "\Empresas\2\Desarrollo\Adjuntos\" & _DesarrolloAdjuntoArchivo
Dim LnkDescarga As LinkButton = e.Row.FCLinkButton("ImgD")
If File.Exists(RutaAdjunto) Then
LnkDescarga.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDescarga)
Else
LnkDescarga.Visible = False
End If
End If
End Sub
End Class