2021-01-22 14:59:35 +00:00
/ * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Instituto Costarricense de Acueductos y Alcantarillados . - 2017
* Administración de la Seguridad
* Nombre de la Pantalla : frwBusquedaSolicitud . aspx
*
* Explicación de los contenidos del archivo
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* HISTORIAL
*
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
* Esteban Gutierrez Rapso 20 – 04 - 2015 Se inicia con el diseño de la pagina
* … … … … … … … … … … … … … … … … … … … … … …
* … … … … … … … … … … … … … … … … … … … … … …
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Derechos Reservados ( C ) 2017 AyA .
* ESTE CÓDIGO ES PROVEÍDO “ TAL CUAL ES ” SIN GARANTÍA ALGUNA
* DE NINGÚN TIPO , SEA IMPLICITA O EXPLICITA .
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL , NI SU COMERCIALIZACIÓN
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* /
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Data ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using System.Web.UI.HtmlControls ;
using AyABL ;
using AyABL.AUT.Autenticacion ;
using AyABL.APL ;
using AyADAL ;
using System.Configuration ;
using AyABL.RCS ;
using AyABL.Tran ;
using AyABL.Usuario ;
using AyABL.TRA ;
using System.Text ;
using System.Security.Cryptography ;
using System.IO ;
public partial class Forms_Trans_frwCriterioPA : General
{
#region Inicializar Formulario ( R0 )
override protected void OnInit ( EventArgs e ) //M0
{
try
{
base . OnInit ( e ) ;
InicializarFormulario ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R0M0" , ex ) ;
}
}
private void InicializarFormulario ( ) //M1
{
try
{
Response . Cache . SetCacheability ( HttpCacheability . NoCache ) ;
construirGridView ( ) ;
Javascript . CheckAllGridViewItems ( Page ) ;
// EjecutarScript("inicializaTab('formulario');");
}
catch ( Exception ex )
{
MensajeError ( "Error en R0M1" , ex ) ;
}
}
#endregion
#region Variables ( R1 )
inspeccionapBL objInspeccionBL ;
GridView grvListaVisitaSolicitudTemp ;
string strNumSolicitudTMP = "0" ;
#region variables del estandar
string strPagina = string . Empty ;
string strScript = string . Empty ;
#endregion
#endregion
#region Eventos Formulario ( R2 )
protected void Page_Load ( object sender , EventArgs e ) //M0
{
try
{
if ( Session [ "ACTIVIDADFINALIZADA" ] ! = null )
Session [ "ACTIVIDADFINALIZADA" ] = null ;
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnNuevo);
ScriptManager . GetCurrent ( Page ) . RegisterPostBackControl ( grvListaVisitaSolicitud ) ;
if ( ViewState [ "MODO" ] ! = null )
{
if ( ViewState [ "MODO" ] . ToString ( ) = = "Firmador" )
{
obtenerDocumentoFirmado ( ) ;
}
}
strNumSolicitudTMP = Session [ "SOLICITUD" ] . ToString ( ) ;
if ( Session [ "FKREUTILIZA" ] ! = null & & Session [ "FKREUTILIZA" ] . ToString ( ) ! = string . Empty & & Session [ "FKREUTILIZA" ] . ToString ( ) ! = " " )
nPKReutilizaTMP = int . Parse ( Session [ "FKREUTILIZA" ] . ToString ( ) ) ;
lblNumSolicitud . Text = strNumSolicitudTMP ;
if ( ( ! IsPostBack ) & & ( Session . Count > 0 ) )
{
limpiarCampos ( ) ;
Session [ "Pagina" ] = "" ;
txtLatitud . Text = "" ;
txtLongitud . Text = "" ;
//txtLatitud.Text = "9.939217784106827";
//txtLongitud.Text = "-84.11818447726546";
EjecutarScript ( "inicializaTab('grid');" ) ;
// EjecutarScript("myMap(" + txtLatitud.Text + "," + txtLongitud.Text + ");");
// mostrarFilaTabla(1);
ComandosxMenu ( ) ;
llenarDDLtipoEstructuraExistente ( ) ;
//llenarDDLInspector();
llenarGridVisitaSolicitud ( ) ;
//llenarDDLEncargado(true);
}
else
{
if ( Session . Count = = 0 )
{ ClientScript . RegisterStartupScript ( this . GetType ( ) , "Error" , "<script>javascript: window.parent.VentanaCerrarActividades();window.parent.VentanaCerrarFormularioAP();window.location.href = '../wfrLogin.aspx?sesion=expiro';</script>" ) ; }
}
//{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: window.parent.VentanaCerrarActividades();window.parent.VentanaCerrarFormularioAP();</script>"); }
}
catch ( Exception ex )
{
MensajeError ( "Error en R2M0" , ex ) ;
}
}
#endregion
#region Eventos Controles Web ( R3 )
///<summary>
///Activar el botón de Refrescar
///</summary>
///<param name="sender"></param>
///<param name="e"></param>
protected void btnRefrescar_Click ( object sender , System . Web . UI . ImageClickEventArgs e ) //M1
{
try
{
llenarGridVisitaSolicitud ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M2" + MensajesAplicacion . RefrescarFallido . ToString ( ) , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('grid');" ) ;
}
}
/// <summary>
/// Metodo que se utiliza para la paginación del Grid en caso de que el usuario desee ver mas registros
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grvListaVisitaSolicitud_PageIndexChanging ( object sender , GridViewPageEventArgs e ) //M1
{
try
{
grvListaVisitaSolicitud . PageIndex = e . NewPageIndex ;
llenarGridVisitaSolicitud ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M1" , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('grid');" ) ;
}
}
/// <summary>
/// Metodo que se utiliza para borrar el rol del listado de roles
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grvListaVisitaSolicitud_RowCommand ( object sender , GridViewCommandEventArgs e ) //M5
{
try
{
if ( validarSesion ( ) = = false )
EjecutarScript ( "window.parent.VentanaCerrarFormularioAPSesion();" ) ;
{
int i = Convert . ToInt32 ( e . CommandArgument ) ;
GridViewRow selectedRow = grvListaVisitaSolicitud . Rows [ i ] ;
Session [ "PKINSPECCION" ] = int . Parse ( selectedRow . Cells [ 0 ] . Text ) ;
Session [ "FKDEPENDENCIASIGDD" ] = selectedRow . Cells [ 11 ] . Text ;
if ( e . CommandName = = "ver" )
{
limpiarCampos ( ) ;
//deshabilitarCampos();
int nPk = int . Parse ( selectedRow . Cells [ 0 ] . Text ) ;
cargarFormularioCriterioAP ( nPk ) ;
ViewState [ "MODO" ] = "Modificar" ;
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
if ( e . CommandName = = "enviar" )
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( selectedRow . Cells [ 0 ] . Text ) ;
DataSet dsInspeccion = objInspeccionBL . listarInspecciones ( null ) ;
llenarDDLEncargado ( true ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows . Count ! = 0 )
if ( ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "REVISIONREVISIONFORMULARIO" ] . ToString ( ) . ToLower ( ) = = "" ) | | ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "REVISIONREVISIONFORMULARIO" ] . ToString ( ) . ToLower ( ) = = "false" ) ) // && dsInspeccion.Tables[0].Rows[0]["FECHARECIBIDOREVISIONFORMULARIO"].ToString() != dsInspeccion.Tables[0].Rows[0]["FECHAREVISIONREVISIONFORMULARIO"].ToString()))
{
EjecutarScript ( "VentanaAbrirCorreo();" ) ;
}
else
{
EjecutarScript ( "inicializaTab('grid','revision');" ) ;
}
}
if ( e . CommandName = = "firmar" )
{
//limpiarCampos();
string strNombreCarta = Session [ "SOLICITUD" ] . ToString ( ) ;
firmarDocumento ( strNombreCarta ) ;
EjecutarScript ( "inicializaTab('grid');" ) ;
}
if ( e . CommandName = = "verpdf" )
{
//limpiarCampos();
char delimitador = '-' ;
string strNombreCarta = selectedRow . Cells [ 1 ] . Text ;
string [ ] arrayNombre = strNombreCarta . Split ( delimitador ) ;
string pdfPath = ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + arrayNombre [ 0 ] . ToString ( ) + "-" + arrayNombre [ 1 ] . ToString ( ) + "-" + arrayNombre [ 2 ] . ToString ( ) + @"\" + strNombreCarta + "-AP.pdf" ;
string targetURL = "'../../DocumentosPDF/" + arrayNombre [ 0 ] . ToString ( ) + "-" + arrayNombre [ 1 ] . ToString ( ) + "-" + arrayNombre [ 2 ] . ToString ( ) + "/" + strNombreCarta + "-AP.pdf'" ;
string ruta = ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + arrayNombre [ 0 ] . ToString ( ) + "-" + arrayNombre [ 1 ] . ToString ( ) + "-" + arrayNombre [ 2 ] . ToString ( ) ;
//if (System.IO.File.Exists(pdfPath))
//{
// EjecutarScript("abrirPDF(" + targetURL + ");inicializaTab('grid','');");
//}
//if (!File.Exists(pdfPath))
{
//obtener la constancia y ponerla en la carpeta compartida para el envio de correo
//se el registro de vision 2020
Documento oDoc = new Documento ( ) ;
string strResultado = oDoc . Consultar_Documento ( arrayNombre [ 0 ] . ToString ( ) + "-" + arrayNombre [ 1 ] . ToString ( ) + "-" + arrayNombre [ 2 ] . ToString ( ) + "|Criterio técnico AP" , strNombreCarta , strNombreCarta + "-AP.pdf" ) ;
if ( strResultado ! = string . Empty & & strResultado ! = "No existe" )
{
//strResultado += pdfPath + ";"; ;
EjecutarScript ( "abrirPDF('" + strResultado + "');inicializaTab('grid','');" ) ;
}
else
{
ClientScript . RegisterStartupScript ( this . GetType ( ) , "Error" , "<script>javascript: MensajeInformativo('No se ha generado el documento PDF." + pdfPath + "');inicializaTab('grid','');</script>" ) ;
}
}
}
}
}
catch ( Exception ex )
{
//MensajeError("Error en R3M5", ex);
EjecutarScript ( "alert('Error: " + ex . Message . ToString ( ) + "');inicializaTab('grid','');" ) ;
}
}
protected void btnNuevo_Click ( object sender , EventArgs e ) //M6
{
try
{
if ( validarSesion ( ) = = false )
EjecutarScript ( "window.parent.VentanaCerrarFormularioAPSesion();" ) ;
else
{
int pkRegistro = GuardarDatosVisitaSolicitud ( ) ;
if ( pkRegistro = = 0 )
// EjecutarScript("exportarPDF();");
// EjecutarScript("inicializaTab('grid','Exitoso')");
MensajeAlerta ( "Por favor vuelva a guardar el formulario." ) ;
else
{
EjecutarScript ( "exportarPDF();" ) ;
EjecutarScript ( "inicializaTab('grid','Exitoso')" ) ;
//limpiarCampos();
}
llenarGridVisitaSolicitud ( ) ;
}
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M6" , ex ) ;
}
}
protected void btnAprobar_Click ( object sender , EventArgs e )
{
try
{
int pkRegistro = GuardarDatosVisitaSolicitud ( ) ;
int nValorRetornadoRevision = 0 ;
if ( pkRegistro = = 0 )
EjecutarScript ( "inicializaTab('formulario','Alerta');" ) ;
else
{
//cambia el estado de la revision del formulario t_dis_revisionformulario
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKREVISIONFORMULARIO = int . Parse ( ViewState [ "PKREVISIONFORMULARIO" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . REVISIONREVISIONFORMULARIO = true ;
objInspeccionBL . objinspeccionapEL . FECHAREVISIONREVISIONFORMULARIO = DateTime . Now ;
nValorRetornadoRevision = objInspeccionBL . modificarRevisionFormulario ( ) ;
if ( nValorRetornadoRevision ! = 0 )
{
nValorRetornadoRevision = 0 ;
//cambia el estado de la inspeccion general t_dis_inspeccion
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . FKESTADOINSPECCION = 1 ; //asignada t_adm_estadoinspeccion
nValorRetornadoRevision = objInspeccionBL . modificarEstadoInspecciongeneral ( ) ;
if ( nValorRetornadoRevision ! = 0 )
{
GuardarDatosActividad ( "aprueba" ) ;
#region Envio de correo
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”" ;
AyABL . TRA . correoBL objcorreoBL = new AyABL . TRA . correoBL ( ) ;
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = "Revisión de Criterio Técnico - SIGDD" ;
objcorreoBL . objcorreoEL . CONTENIDO = "La solicitud de disponibilidad " + Session [ "SOLICITUD" ] . ToString ( ) + " se aprobó el día " + DateTime . Now . ToString ( ) + ", para ver los detalles ingrese al sistema en el siguiente hipervínculo, ingrese al sistema <a href=http://" + HttpContext . Current . Request . Url . Authority + "/Forms/wfrLogin> SIGDD</a>" + strPiePagina ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( Session [ "PKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornadoRevision = objcorreoBL . insertarCorreo ( ) ;
#endregion
ObservacionesBL objObservacionesBL = new ObservacionesBL ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . OBSERVACIONES = "El usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " aprobó el formulario de inspección de agua potable de la solicitud N°" + Session [ "SOLICITUD" ] . ToString ( ) ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . USUARIO = Session [ "LOGIN" ] . ToString ( ) ;
int nValorRetornadoObservacion = objObservacionesBL . insertarObservaciones ( ) ;
}
}
EjecutarScript ( "exportarPDF();" ) ;
//limpiarCampos();
}
EjecutarScript ( "exportarPDF();" ) ;
llenarGridVisitaSolicitud ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M6" , ex ) ;
}
}
protected void btnDenegar_Click ( object sender , EventArgs e )
{
try
{
int pkRegistro = GuardarDatosVisitaSolicitud ( ) ;
int nValorRetornadoRevision = 0 ;
if ( pkRegistro = = 0 )
EjecutarScript ( "exportarPDF();" ) ;
else
{
//cambia el estado de la revision del formulario t_dis_revisionformulario
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKREVISIONFORMULARIO = int . Parse ( ViewState [ "PKREVISIONFORMULARIO" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . REVISIONREVISIONFORMULARIO = false ;
objInspeccionBL . objinspeccionapEL . FECHAREVISIONREVISIONFORMULARIO = DateTime . Now ;
nValorRetornadoRevision = objInspeccionBL . modificarRevisionFormulario ( ) ;
if ( nValorRetornadoRevision ! = 0 )
{
nValorRetornadoRevision = 0 ;
//cambia el estado de la inspeccion general t_dis_inspeccion
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . FKESTADOINSPECCION = 3 ; //reinspeccion t_adm_estadoinspeccion
nValorRetornadoRevision = objInspeccionBL . modificarEstadoInspecciongeneral ( ) ;
if ( nValorRetornadoRevision ! = 0 )
{
GuardarDatosActividad ( "deniega" ) ;
#region Envio de correo
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”" ;
AyABL . TRA . correoBL objcorreoBL = new AyABL . TRA . correoBL ( ) ;
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = "Revisión de Criterio Técnico - SIGDD" ;
objcorreoBL . objcorreoEL . CONTENIDO = "La solicitud de disponibilidad " + Session [ "SOLICITUD" ] . ToString ( ) + " se denegó el día " + DateTime . Now . ToString ( ) + ", para ver los detalles ingrese al sistema en el siguiente hipervínculo, ingrese al sistema <a href=http://" + HttpContext . Current . Request . Url . Authority + "/Forms/wfrLogin> SIGDD</a>" + strPiePagina ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( Session [ "PKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornadoRevision = objcorreoBL . insertarCorreo ( ) ;
#endregion
ObservacionesBL objObservacionesBL = new ObservacionesBL ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . OBSERVACIONES = "El usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " denegó el formulario de inspección de agua potable de la solicitud N°" + Session [ "SOLICITUD" ] . ToString ( ) ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . USUARIO = Session [ "LOGIN" ] . ToString ( ) ;
int nValorRetornadoObservacion = objObservacionesBL . insertarObservaciones ( ) ;
}
}
EjecutarScript ( "exportarPDF();" ) ;
//limpiarCampos();
}
EjecutarScript ( "exportarPDF();" ) ;
llenarGridVisitaSolicitud ( ) ;
}
catch ( Exception ex )
{
MensajeError ( "Error en R3M6" , ex ) ;
}
}
protected void ddlInspector_SelectedIndexChanged ( object sender , EventArgs e )
{
}
protected void rblTipoPrevista_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblTipoPrevista . SelectedValue . ToString ( ) = = "4" )
{
txtOtrosPrevista . Visible = true ;
txtOtrosPrevista . Enabled = true ;
}
else
{
txtOtrosPrevista . Text = string . Empty ;
txtOtrosPrevista . Visible = false ;
txtOtrosPrevista . Enabled = false ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error al seleccionar el tipo de prevista." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblTuberiaDistribucion_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblTuberiaDistribucion . SelectedValue . ToString ( ) = = "true" )
{
dvTuberiaDistribucion . Visible = true ;
dvTuberiaDistribucion2 . Visible = true ;
if ( rblDiametro . SelectedValue . ToString ( ) = = "Otro" )
{
dvTuberiaDistribucion3 . Visible = true ;
}
else
{
dvTuberiaDistribucion3 . Visible = false ;
}
}
else
{
dvTuberiaDistribucion . Visible = false ;
dvTuberiaDistribucion2 . Visible = false ;
dvTuberiaDistribucion3 . Visible = false ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblDiametro_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblDiametro . SelectedValue . ToString ( ) = = "Otro" )
{
dvTuberiaDistribucion3 . Visible = true ;
}
else
{
dvTuberiaDistribucion3 . Visible = false ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblDisponibilidadAP_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblDisponibilidadAP . SelectedValue . ToString ( ) = = "false" )
{
siAP . Visible = true ;
divCCH1 . Visible = true ;
2021-02-09 20:27:11 +00:00
txtOtraRazon . Visible = false ;
2021-01-22 14:59:35 +00:00
}
else
{
siAP . Visible = false ;
divCCH1 . Visible = false ;
divCCH2 . Visible = false ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
2021-02-09 20:27:11 +00:00
protected void chkId32_CheckedChanged ( object sender , EventArgs e )
{
try
{
if ( chkId32 . Checked = = true )
{
txtOtraRazon . Visible = true ;
}
else
{
txtOtraRazon . Visible = false ;
txtOtraRazon . Text = "" ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
2021-01-22 14:59:35 +00:00
protected void rblExisteCCH_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblExisteCCH . SelectedValue . ToString ( ) = = "true" )
{
divCCH2 . Visible = true ;
rblUbicacionMedidor . ClearSelection ( ) ;
rblPrevista . ClearSelection ( ) ;
rblTipoPrevista . ClearSelection ( ) ;
txtLindero . Text = "" ;
txtLindero . Enabled = true ;
rblTipoMedidor . ClearSelection ( ) ;
rblDiametroMedidor . ClearSelection ( ) ;
}
else
{
divCCH2 . Visible = false ;
rblUbicacionMedidor . SelectedValue = "5" ;
rblPrevista . SelectedValue = "false" ;
rblTipoPrevista . SelectedValue = "5" ;
txtLindero . Text = "N/A" ;
txtLindero . Enabled = false ;
rblTipoMedidor . SelectedValue = "3" ;
rblDiametroMedidor . SelectedValue = "0.00" ;
}
}
catch ( Exception ex )
{
MensajeError ( "Se dio un error." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblExisteNis_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblExisteNis . SelectedValue = = "true" )
txtNisExistente . Enabled = true ;
else
txtNisExistente . Enabled = false ;
}
catch ( Exception ex )
{
MensajeError ( "Se produjo un error al seleccionar la opcion." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblEstructuraExistente_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblEstructuraExistente . SelectedValue = = "true" )
txtTipoEstructuraExistente . Enabled = true ;
else
txtTipoEstructuraExistente . Enabled = false ;
}
catch ( Exception ex )
{
MensajeError ( "Se produjo un error al seleccionar la opcion." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void rblExisteDisponibilidad_SelectedIndexChanged ( object sender , EventArgs e )
{
try
{
if ( rblExisteDisponibilidad . SelectedValue = = "true" )
txtDisponibilidadAsociada . Enabled = true ;
else
txtDisponibilidadAsociada . Enabled = false ;
}
catch ( Exception ex )
{
MensajeError ( "Se produjo un error al seleccionar la opcion." , ex ) ;
}
finally
{
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
}
protected void btnHabilitar_Click ( object sender , EventArgs e )
{
decimal dCaudal = 0 ;
try
{
if ( validarSesion ( ) = = false )
EjecutarScript ( "window.parent.VentanaCerrarFormularioAPSesion();" ) ;
else
{
ViewState [ "MODO" ] = "Nuevo" ;
//deshabilitarCampos();
habilitarCampos ( ) ;
rfvCaudalReservado . ErrorMessage = "" ;
revPresionMinima . ErrorMessage = "" ;
revPresionMaxima . ErrorMessage = "" ;
limpiarCampos ( ) ;
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
//dCaudal = Decimal.Multiply(dCaudal, decimal.Parse("0.8"));
//txtCaudalReservado.Text = dCaudal.ToString("N2");
DataSet dsInspeccion = objInspeccionBL . listarInspecciones ( null ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows . Count ! = 0 )
{
foreach ( DataRow row in dsInspeccion . Tables [ 0 ] . Rows )
{
if ( row [ "DESCRIPCIONESTADOINSPECCION" ] . ToString ( ) . ToLower ( ) = = "asignada" | | row [ "DESCRIPCIONESTADOINSPECCION" ] . ToString ( ) . ToLower ( ) = = "pendiente revisión" )
{
rblExisteNis . SelectedValue = "false" ;
txtNisExistente . Text = string . Empty ;
lblProposito . Text = string . Empty ;
EjecutarScript ( "inicializaTab('grid','existe');" ) ;
}
}
}
else //si no existen formularios asociados a la solicitud actual se carga la informacion de la solicitud de origen de la prorroga o revision
{
if ( nPKReutilizaTMP ! = 0 )
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = nPKReutilizaTMP ;
DataSet dsInspeccionBL = objInspeccionBL . listarInspecciones ( null ) ;
if ( dsInspeccionBL . Tables [ 0 ] . Rows . Count > 0 )
{
cargarFormularioCriterioAP ( int . Parse ( dsInspeccionBL . Tables [ 0 ] . Rows [ 0 ] [ "PKINSPECCION" ] . ToString ( ) ) ) ;
habilitarCampos ( ) ;
}
}
}
solicitudBL objSolicitudBL = new solicitudBL ( ) ;
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
DataSet ds = objSolicitudBL . dsListaSolicitudProgramacion ( null ) ;
if ( ds . Tables [ 0 ] . Rows . Count ! = 0 )
{
rblExisteNis . SelectedValue = ds . Tables [ 0 ] . Rows [ 0 ] [ "TIENESERVICIOSOLICITUD" ] . ToString ( ) . ToLower ( ) ;
txtNisExistente . Text = ds . Tables [ 0 ] . Rows [ 0 ] [ "NUMERONISSOLICITUD" ] . ToString ( ) ;
lblProposito . Text = ds . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONPROYECTO" ] . ToString ( ) ;
Session [ "PKTIPOINSPECCION" ] = ds . Tables [ 0 ] . Rows [ 0 ] [ "FKTIPOINSPECCION" ] . ToString ( ) ;
if ( rblExisteNis . SelectedValue = = "true" )
txtNisExistente . Enabled = true ;
else
txtNisExistente . Enabled = false ;
int nCantidadEdificaciones = int . Parse ( ds . Tables [ 0 ] . Rows [ 0 ] [ "CANTIDADEDIFICACIONESSOLICITUD" ] . ToString ( ) . ToLower ( ) ) ;
if ( nCantidadEdificaciones > 0 )
rblEstructuraExistente . SelectedValue = "true" ;
else
rblEstructuraExistente . SelectedValue = "false" ;
txtTipoEstructuraExistente . Text = ds . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONUSOEDIFICACIONSOLICITUD" ] . ToString ( ) ;
BloquearIntros ( ) ;
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
dCaudal = objInspeccionBL . obtenerCaudal ( ) ;
txtCaudalReservado . Text = dCaudal . ToString ( ) ;
EjecutarScript ( "inicializaTab('formulario');" ) ;
}
else
{
EjecutarScript ( "inicializaTab('grid');" ) ;
}
}
}
catch ( Exception ex )
{
MensajeError ( "Se produjo un error." , ex ) ;
}
}
2021-02-09 04:44:03 +00:00
2021-01-22 14:59:35 +00:00
protected void btnEnviarRevision_Click ( object sender , EventArgs e )
{
int nValorRetornado = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
//objInspeccionBL.objinspeccionapEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
objInspeccionBL . objinspeccionapEL . PKINSPECCION = nPKReutilizaTMP ;
DataSet dsInspeccion = objInspeccionBL . listarInspecciones ( null ) ;
ObservacionesBL objObservacionesBL = new ObservacionesBL ( ) ;
int nValorRetornadoObservacion = 0 ;
if ( int . Parse ( ddlEncargadoRevision . SelectedValue ) ! = - 1 )
{
//si existe un arevision pendiente se finaliza para iniciar con la siguiente revision
if ( int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKESTADOINSPECCION" ] . ToString ( ) ) = = 2 )
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKREVISIONFORMULARIO = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKREVISIONFORMULARIO" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . REVISIONREVISIONFORMULARIO = false ;
objInspeccionBL . objinspeccionapEL . FECHAREVISIONREVISIONFORMULARIO = DateTime . Now ;
int nValorRetornadoRevision = objInspeccionBL . cancelarRevisionFormulario ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . OBSERVACIONES = "El usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " ha cancelado la revision de inspeccion de agua potable de la solicitud N°" + Session [ "SOLICITUD" ] . ToString ( ) ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . USUARIO = Session [ "LOGIN" ] . ToString ( ) ;
nValorRetornadoObservacion = objObservacionesBL . insertarObservaciones ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . DELETE . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha cancelado la revision de inspeccion de agua potable de la solicitud N° " + Session [ "SOLICITUD" ] . ToString ( ) + " por el usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) ,
"frwCriterioPA.aspx" ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
#region crea inspeccion nueva
ViewState [ "MODO" ] = "Modificar" ;
EjecutarScript ( "inicializaTab('grid');" ) ;
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . REVISIONREVISIONFORMULARIO = false ;
objInspeccionBL . objinspeccionapEL . FECHARECIBIDOREVISIONFORMULARIO = DateTime . Now ;
objInspeccionBL . objinspeccionapEL . FECHAREVISIONREVISIONFORMULARIO = DateTime . Now ;
objInspeccionBL . objinspeccionapEL . FKUSUARIOXDEPENDENCIA = int . Parse ( ddlEncargadoRevision . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
nValorRetornado = objInspeccionBL . insertarRevision ( null ) ;
if ( nValorRetornado ! = 0 )
{
nValorRetornado = 0 ;
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . FKESTADOINSPECCION = 2 ; //pendiente revision
nValorRetornado = objInspeccionBL . modificarEstadoInspecciongeneral ( ) ;
if ( nValorRetornado ! = 0 )
{
ViewState [ "MODO" ] = "Nuevo" ;
AsignaActividadesUsuarios ( ) ;
#region Envio de correo
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”" ;
AyABL . TRA . correoBL objcorreoBL = new AyABL . TRA . correoBL ( ) ;
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = "Revisión de Criterio Técnico - SIGDD" ;
objcorreoBL . objcorreoEL . CONTENIDO = "La solicitud de disponibilidad " + Session [ "SOLICITUD" ] . ToString ( ) + " se envía para su respectiva aprobación para ver los detalles ingrese al sistema en el siguiente hipervínculo, ingrese al sistema <a href=http://" + HttpContext . Current . Request . Url . Authority + "/Forms/wfrLogin> SIGDD</a>" + strPiePagina ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( ddlEncargadoRevision . SelectedValue ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornado = objcorreoBL . insertarCorreo ( ) ;
}
}
llenarGridVisitaSolicitud ( ) ;
#endregion
objObservacionesBL = new ObservacionesBL ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . OBSERVACIONES = "El usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " envia formulario de inspección de agua potable de la solicitud N°" + Session [ "SOLICITUD" ] . ToString ( ) + " a revisión con el usuario " + ddlEncargadoRevision . SelectedItem . ToString ( ) + "." ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . USUARIO = Session [ "LOGIN" ] . ToString ( ) ;
nValorRetornadoObservacion = objObservacionesBL . insertarObservaciones ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . DELETE . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha creado la revision de inspeccion de agua potable del formulario " + Session [ "SOLICITUD" ] . ToString ( ) + " por el usuario " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) ,
"frwCriterioPA.aspx" ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
#endregion
}
else
{
MensajeAlerta ( "Debe seleccionar un encargado para la revisión del formulario" ) ;
}
}
catch ( Exception ex )
{
throw ex ;
}
finally
{
EjecutarScript ( "inicializaTab('grid');" ) ;
}
}
#endregion
#region Metodos Personalizados ( R4 )
/// <summary>
/// Oculta las filas que lo requieran
/// </summary>
/// <param name="p_intFila"></param>
private void mostrarFilaTabla ( int p_intFila ) //M0
{
try
{
switch ( p_intFila )
{
case 1 : divDatosSuperiores . Visible = true ; divDatosInferiores . Visible = false ; break ;
case 2 : divDatosInferiores . Visible = true ; divDatosSuperiores . Visible = false ; break ;
}
}
catch ( Exception ex )
{
throw ex ;
}
}
/// <summary>
/// Oculta las filas que lo requieran
/// </summary>
/// <param name="p_intFila"></param>
private void ComandosxMenu ( ) //M2
{
try
{
//DataSet dsComandos = getComandos();
//if (dsComandos != null)
//{
// foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
// {
// switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
// {
//case "NUEVO":
//Div2.Visible = true;
// break;
//case "MODIFICA":
// //Inicio de variable tipo VIEWSTATE
// ViewState["PUEDEMODIFICAR"] = true;
// break;
// }
// }
//}
}
catch ( Exception ex )
{
throw ex ;
}
}
/// <summary>
/// Metodo que se utiliza para remover el role asignado al usuario
/// </summary>
/// <param name="p_nPk"></param>
private bool removerVisitaSolicitud ( int p_nPk ) //M3
{
bool blnValorRetornado = false ;
try
{
//objInspeccionBL = new visitaSolicitudBL();
//objInspeccionBL.objVisitaSolicitudEL.PK = p_nPk;
//objInspeccionBL.eliminarVisitaSolicitud();
blnValorRetornado = true ;
}
catch ( Exception ex )
{
throw ex ;
}
return blnValorRetornado ;
}
/// <summary>
/// Metodo que se utiliza para contruir el Grid al inicio de la pantalla
/// </summary>
private void construirGridView ( ) //M4
{
try
{
grvListaVisitaSolicitudTemp = ( GridView ) tdLista . FindControl ( "grvListaVisitaSolicitud" ) ;
GridViewBoundField bdfPk = new GridViewBoundField ( "PKINSPECCION" , "PK" , false , false , false ) ;
GridViewBoundField bdfNumeroSolicitud = new GridViewBoundField ( "NUMEROSOLICITUDSOLICITUD" , "Solicitud" , false , false , true ) ;
GridViewBoundField bdfTipoEstructura = new GridViewBoundField ( "TIPOESTRUCTURAINSPECCION" , "Tipo estructura" , true , false , true ) ;
GridViewBoundField bdfOficioObrasCondominio = new GridViewBoundField ( "CONDOMINIOINSPECCION" , "Oficio obras condominio" , true , false , true ) ;
GridViewBoundField bdfFechaAsignacion = new GridViewBoundField ( "FECHAINSPECCION" , "Fecha asignación" , true , true , true ) ;
GridViewBoundField bdfEstadoDocumento = new GridViewBoundField ( "DESCRIPCIONESTADOINSPECCION" , "Estado" , true , false , true ) ;
GridViewBoundField bdfFkReutiliza = new GridViewBoundField ( "FKREUTILIZA" , "Reutiliza" , false , false , false ) ;
GridViewBoundField bdfFkDependenciaSIGDD = new GridViewBoundField ( "FKDEPENDENCIASIGDD" , "FK" , false , false , false ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfPk ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfNumeroSolicitud ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfTipoEstructura ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfOficioObrasCondominio ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfFechaAsignacion ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfEstadoDocumento ) ;
grvListaVisitaSolicitudTemp . Columns [ 0 ] . ItemStyle . Width = 125 ;
grvListaVisitaSolicitudTemp . Columns [ 1 ] . HeaderStyle . HorizontalAlign = HorizontalAlign . Center ;
grvListaVisitaSolicitudTemp . Columns [ 1 ] . ItemStyle . HorizontalAlign = HorizontalAlign . Center ;
grvListaVisitaSolicitudTemp . Columns [ 1 ] . ItemStyle . Width = 125 ;
ButtonField bf = new ButtonField ( ) ;
bf . ButtonType = ButtonType . Image ;
bf . Text = "Ver formulario" ;
bf . HeaderText = "" ;
bf . ImageUrl = "~/Images/MiniBotones/formulario.png" ;
bf . CommandName = "ver" ;
grvListaVisitaSolicitudTemp . Columns . Add ( bf ) ;
//if (Request["d"] != null)
//{
// if (Request["d"].ToString() != "deshabilitar")
// {
// ButtonField bfEnviar = new ButtonField();
// bfEnviar.ButtonType = ButtonType.Image;
// bfEnviar.Text = "Enviar a revisión";
// bfEnviar.HeaderText = "";
// bfEnviar.ImageUrl = "~/Images/MiniBotones/revision.png";
// bfEnviar.CommandName = "enviar";
// grvListaVisitaSolicitud.Columns.Add(bfEnviar);
// ButtonField bfFirmar = new ButtonField();
// bfFirmar.ButtonType = ButtonType.Image;
// bfFirmar.Text = "Firmar";
// bfFirmar.HeaderText = "";
// bfFirmar.ImageUrl = "~/Images/MiniBotones/Firma digittal.png";
// bfFirmar.CommandName = "firmar";
// grvListaVisitaSolicitud.Columns.Add(bfFirmar);
// }
//}
//else
{
ButtonField bfEnviar = new ButtonField ( ) ;
bfEnviar . ButtonType = ButtonType . Image ;
bfEnviar . Text = "Enviar a revisión" ;
bfEnviar . HeaderText = "" ;
bfEnviar . ImageUrl = "~/Images/MiniBotones/revision.png" ;
bfEnviar . CommandName = "enviar" ;
grvListaVisitaSolicitud . Columns . Add ( bfEnviar ) ;
ButtonField bfFirmar = new ButtonField ( ) ;
bfFirmar . ButtonType = ButtonType . Image ;
bfFirmar . Text = "Firmar" ;
bfFirmar . HeaderText = "" ;
bfFirmar . ImageUrl = "~/Images/MiniBotones/Firma digittal.png" ;
bfFirmar . CommandName = "firmar" ;
grvListaVisitaSolicitud . Columns . Add ( bfFirmar ) ;
}
ButtonField bfVer = new ButtonField ( ) ;
bfVer . ButtonType = ButtonType . Image ;
bfVer . Text = "Firmar" ;
bfVer . HeaderText = "" ;
bfVer . ImageUrl = "~/Images/MiniBotones/ConsultarExpediente.png" ;
bfVer . CommandName = "verpdf" ;
grvListaVisitaSolicitud . Columns . Add ( bfVer ) ;
//cuwBusquedaList.LlenarCHKLBusqueda(grvListaVisitaSolicitudTemp);
grvListaVisitaSolicitudTemp . Columns . Add ( bdfFkReutiliza ) ;
grvListaVisitaSolicitudTemp . Columns . Add ( bdfFkDependenciaSIGDD ) ;
}
catch ( Exception ex )
{
throw ex ;
}
}
public void habilitarCampos ( )
{
2021-02-09 04:44:03 +00:00
2021-01-22 14:59:35 +00:00
if ( ! Request . UrlReferrer . ToString ( ) . Contains ( "frwBusquedaSolicitud" ) )
{
//rblExisteNis.ClearSelection();
//txtNisExistente.Text = string.Empty;
txtNisExistente . Enabled = true ;
//rblExisteNis.Enabled = true;
rblEstructuraExistente . Enabled = true ;
//txtTipoEstructuraExistente.Enabled = true;
rblExisteDisponibilidad . Enabled = true ;
//txtDisponibilidadAsociada.Enabled = true;
txtOficioRecepcion . Enabled = true ;
txtPresionMinima . Enabled = true ;
txtPresionMaxima . Enabled = true ;
txtSistemaAsociado . Enabled = true ;
txtCaudalReservado . Enabled = true ;
rblTuberiaDistribucion . Enabled = true ;
rblMaterial . Enabled = true ;
rblDiametro . Enabled = true ;
txtOtroDiametro . Enabled = true ;
rblDisponibilidadAP . Enabled = true ;
chkId18 . Enabled = true ;
2021-02-09 04:44:03 +00:00
//chkId19.Enabled = true;
2021-01-22 14:59:35 +00:00
chkId21 . Enabled = true ;
chkId22 . Enabled = true ;
chkId23 . Enabled = true ;
chkId25 . Enabled = true ;
chkId26 . Enabled = true ;
chkId27 . Enabled = true ;
2021-02-09 04:44:03 +00:00
chkId30 . Enabled = true ;
chkId31 . Enabled = true ;
chkId32 . Enabled = true ;
2021-01-22 14:59:35 +00:00
rblExisteCCH . Enabled = true ;
txtObservacionesExtensionRamal . Enabled = true ;
rblUbicacionMedidor . Enabled = true ;
txtLindero . Enabled = true ;
rblPrevista . Enabled = true ;
rblTipoPrevista . Enabled = true ;
txtOtrosPrevista . Enabled = true ;
//txtOtrosPrevista.Visible = true;
rblTipoMedidor . Enabled = true ;
rblDiametroMedidor . Enabled = true ;
txtObservacionesCritec . Enabled = true ;
btnAprobar . Enabled = true ;
btnDenegar . Enabled = true ;
btnNuevo . Enabled = true ;
}
}
public void deshabilitarCampos ( )
{
//rblExisteNis.ClearSelection();
//rblExisteNis.Text = string.Empty;
txtNisExistente . Enabled = false ;
rblExisteNis . Enabled = false ;
rblEstructuraExistente . Enabled = false ;
txtTipoEstructuraExistente . Enabled = false ;
rblExisteDisponibilidad . Enabled = false ;
txtDisponibilidadAsociada . Enabled = false ;
txtOficioRecepcion . Enabled = false ;
txtPresionMinima . Enabled = false ;
txtPresionMaxima . Enabled = false ;
txtSistemaAsociado . Enabled = false ;
txtCaudalReservado . Enabled = false ;
rblTuberiaDistribucion . Enabled = false ;
rblMaterial . Enabled = false ;
rblDiametro . Enabled = false ;
txtOtroDiametro . Enabled = false ;
rblDisponibilidadAP . Enabled = false ;
chkId18 . Enabled = false ;
2021-02-09 04:44:03 +00:00
//chkId19.Enabled = false;
2021-01-22 14:59:35 +00:00
chkId21 . Enabled = false ;
chkId22 . Enabled = false ;
chkId23 . Enabled = false ;
chkId25 . Enabled = false ;
chkId26 . Enabled = false ;
chkId27 . Enabled = false ;
2021-02-09 04:44:03 +00:00
chkId30 . Enabled = false ;
chkId31 . Enabled = false ;
chkId32 . Enabled = false ;
2021-02-09 20:27:11 +00:00
txtOtraRazon . Enabled = false ;
2021-01-22 14:59:35 +00:00
rblExisteCCH . Enabled = false ;
txtObservacionesExtensionRamal . Enabled = false ;
rblUbicacionMedidor . Enabled = false ;
txtLindero . Enabled = false ;
rblPrevista . Enabled = false ;
rblTipoPrevista . Enabled = false ;
txtOtrosPrevista . Enabled = false ;
txtOtrosPrevista . Visible = false ;
rblTipoMedidor . Enabled = false ;
rblDiametroMedidor . Enabled = false ;
txtObservacionesCritec . Enabled = false ;
btnAprobar . Enabled = false ;
btnDenegar . Enabled = false ;
btnNuevo . Enabled = false ;
}
public void limpiarCampos ( )
{
//rblExisteNis.ClearSelection();
//txtNisExistente.Text = string.Empty;
txtLatitud . Text = string . Empty ;
txtLongitud . Text = string . Empty ;
rblEstructuraExistente . ClearSelection ( ) ;
rblEstructuraExistente . SelectedValue = "false" ;
txtTipoEstructuraExistente . Text = string . Empty ;
rblExisteDisponibilidad . ClearSelection ( ) ;
rblExisteDisponibilidad . SelectedValue = "false" ;
txtDisponibilidadAsociada . Text = string . Empty ;
txtOficioRecepcion . Text = string . Empty ;
txtPresionMinima . Text = string . Empty ;
txtPresionMaxima . Text = string . Empty ;
txtSistemaAsociado . Text = string . Empty ;
txtCaudalReservado . Text = string . Empty ;
rblTuberiaDistribucion . ClearSelection ( ) ;
rblMaterial . ClearSelection ( ) ;
rblDiametro . ClearSelection ( ) ;
txtOtroDiametro . Text = string . Empty ;
rblDisponibilidadAP . ClearSelection ( ) ;
chkId18 . Checked = false ;
2021-02-09 04:44:03 +00:00
//chkId19.Checked = false;
2021-01-22 14:59:35 +00:00
chkId21 . Checked = false ;
chkId22 . Checked = false ;
chkId23 . Checked = false ;
chkId25 . Checked = false ;
chkId26 . Checked = false ;
chkId27 . Checked = false ;
2021-02-09 04:44:03 +00:00
chkId30 . Checked = false ;
chkId31 . Checked = false ;
chkId32 . Checked = false ;
2021-01-22 14:59:35 +00:00
rblExisteCCH . ClearSelection ( ) ;
txtObservacionesExtensionRamal . Text = string . Empty ;
rblUbicacionMedidor . ClearSelection ( ) ;
txtLindero . Text = string . Empty ;
rblPrevista . ClearSelection ( ) ;
rblTipoPrevista . ClearSelection ( ) ;
txtOtrosPrevista . Text = string . Empty ;
rblTipoMedidor . ClearSelection ( ) ;
rblDiametroMedidor . ClearSelection ( ) ;
txtObservacionesCritec . Text = string . Empty ;
btnNuevo . Visible = true ;
btnAprobar . Visible = false ;
btnDenegar . Visible = false ;
dvTuberiaDistribucion . Visible = false ;
dvTuberiaDistribucion2 . Visible = false ;
dvTuberiaDistribucion3 . Visible = false ;
//divDatosInferiores.Visible = false;
siAP . Visible = false ;
divCCH1 . Visible = false ;
divCCH2 . Visible = false ;
}
public bool ValidarCampos ( )
{
try
{
//if (txtLatitud.Text == string.Empty)
//{
// txtOficioRecepcion.Focus();
// EjecutarScript("inicializaTab('formulario','Mensaje','Latitud.'); $('#address').focus();");
// return false;
//}
//if (txtLongitud.Text == string.Empty)
//{
// txtOficioRecepcion.Focus();
// EjecutarScript("inicializaTab('formulario','Mensaje','Longitud.'); $('#address').focus();");
// return false;
//}
//if (rblExisteNis.SelectedValue == "")
//{
// rblExisteNis.Focus();
// return false;
//}
//if (txtNisExistente.Text == string.Empty && rblExisteNis.SelectedValue == "1")
//{
// txtNisExistente.Focus();
// return false;
//}
if ( rblEstructuraExistente . SelectedValue = = "" )
{
rblEstructuraExistente . Focus ( ) ;
return false ;
}
if ( txtTipoEstructuraExistente . Text = = null & & rblEstructuraExistente . SelectedValue = = "1" )
{
txtTipoEstructuraExistente . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Tipo de estructura.');" ) ;
return false ;
}
if ( rblExisteDisponibilidad . SelectedValue = = "" )
{
rblExisteDisponibilidad . Focus ( ) ;
return false ;
}
if ( txtDisponibilidadAsociada . Text = = string . Empty & & rblExisteDisponibilidad . SelectedValue = = "1" )
{
txtDisponibilidadAsociada . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Disponibilidad asociada.');" ) ;
return false ;
}
//if (txtOficioRecepcion.Text == string.Empty)
//{
// txtOficioRecepcion.Focus();
// return false;
//}
if ( txtPresionMinima . Text = = string . Empty )
{
txtPresionMinima . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Presión mínima.');" ) ;
return false ;
}
if ( txtPresionMaxima . Text = = string . Empty )
{
txtPresionMaxima . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Presión máxima.');" ) ;
return false ;
}
//if (txtSistemaAsociado.Text == string.Empty)
//{
// txtSistemaAsociado.Focus();
// return false;
//}
if ( txtCaudalReservado . Text = = string . Empty )
{
txtCaudalReservado . Focus ( ) ;
return false ;
}
if ( rblTuberiaDistribucion . SelectedValue = = "" )
{
rblTuberiaDistribucion . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Tuberia distribución agua potable.');" ) ;
return false ;
}
else
{
if ( rblTuberiaDistribucion . SelectedValue = = "true" )
{
if ( rblMaterial . SelectedValue = = "" )
{
rblMaterial . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Material.');" ) ;
return false ;
}
if ( rblDiametro . SelectedValue = = "" )
{
rblDiametro . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Diámetro.');" ) ;
return false ;
}
else
{
if ( txtOtroDiametro . Text = = string . Empty & & rblDiametro . SelectedValue = = "Otro" )
{
txtOtroDiametro . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Otro diámetro.');" ) ;
return false ;
}
}
}
}
if ( rblDisponibilidadAP . SelectedValue = = "" )
{
rblDisponibilidadAP . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Disponibilidad.');" ) ;
return false ;
}
else
{
if ( rblDisponibilidadAP . SelectedValue = = "false" )
{
if ( chkId18 . Checked = = false & &
2021-02-09 04:44:03 +00:00
//chkId19.Checked == false &&
2021-01-22 14:59:35 +00:00
chkId21 . Checked = = false & &
chkId22 . Checked = = false & &
chkId23 . Checked = = false & &
chkId25 . Checked = = false & &
chkId26 . Checked = = false & &
2021-02-09 04:44:03 +00:00
chkId27 . Checked = = false & &
chkId30 . Checked = = false & &
chkId31 . Checked = = false & &
chkId32 . Checked = = false
)
2021-01-22 14:59:35 +00:00
{
rblDisponibilidadAP . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Motivos de la negación.');" ) ;
return false ;
}
}
if ( rblDisponibilidadAP . SelectedValue = = "false" )
{
if ( rblExisteCCH . SelectedValue = = "" )
{
rblExisteCCH . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Existe capacidad hídrica.');" ) ;
return false ;
}
else
{
if ( rblExisteCCH . SelectedValue = = "1" | | rblExisteCCH . SelectedValue = = "true" )
{
if ( txtObservacionesExtensionRamal . Text = = string . Empty )
{
txtObservacionesExtensionRamal . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Observaciones de la mejora.');" ) ;
return false ;
}
}
}
}
}
if ( rblUbicacionMedidor . SelectedValue = = "" )
{
rblUbicacionMedidor . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Ubicación del medidor.');" ) ;
return false ;
}
if ( txtLindero . Text = = string . Empty )
{
txtLindero . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Lindero.');" ) ;
return false ;
}
if ( rblPrevista . SelectedValue = = "" )
{
rblPrevista . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Prevista.');" ) ;
return false ;
}
if ( rblTipoPrevista . SelectedValue = = "" )
{
rblTipoPrevista . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Tipo prevista.');" ) ;
return false ;
}
if ( rblTipoPrevista . SelectedValue = = "4" ) //Otro
{
if ( txtOtrosPrevista . Text = = string . Empty )
{
txtOtrosPrevista . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Otro prevista.');" ) ;
return false ;
}
}
if ( rblTipoMedidor . SelectedValue = = "" )
{
rblTipoMedidor . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Tipo medidor.');" ) ;
return false ;
}
if ( rblDiametroMedidor . SelectedValue = = "" )
{
rblDiametroMedidor . Focus ( ) ;
EjecutarScript ( "inicializaTab('formulario','Mensaje','Diámetro del medidor.');" ) ;
return false ;
}
}
catch ( Exception ex )
{
throw ex ;
}
return true ;
}
public bool validarSesion ( )
{
if (
Session [ "PKSOLICITUD" ] ! = null & &
Session [ "SOLICITUD" ] ! = null & &
Session [ "PKUSUARIOXDEPENDENCIA" ] ! = null & &
Session [ "LOGIN" ] ! = null & &
Session [ "PKPROGRAMACION" ] ! = null & &
Session [ "NACTIVIDAD" ] ! = null & &
Session [ "NOMBREEMPLEADO" ] ! = null & &
Session [ "DESCRIPCIONACTIVIDAD" ] ! = null
)
return true ;
else
return false ;
}
[System.Web.Services.WebMethod]
public static string CrearDocumentoPDF ( string Cuerpo , string strNombre )
{
string strResult = "" ;
/ *
* SE DEBE DAR PERMISOS DE ESCRITURA EN LA CARPETA PDF DEL WCFPDF AL USUARIO DE RED CON EL QUE ESTA LOGGEADA LA APLICACION EN EL APPPOOL
* /
try
{
//string p_strDocHtml = string.Empty;
//p_strDocHtml = txtNisExistente.Text;
//System.IO.StringWriter sw = new System.IO.StringWriter();
//HtmlTextWriter h = new HtmlTextWriter(sw);
//divDatosInferiores.RenderControl(h);
//p_strDocHtml = "";// sw.GetStringBuilder().ToString();
//NOTAS:
//en el web.config service se debe tener el tag <binding name="Binding2" maxReceivedMessageSize="10485760"> para que reciba parametros de gran tamaño como el formulario que se esta enviando
//en routeConfig.cs se debe tener la siguiente configuracion settings.AutoRedirectMode = RedirectMode.Off;
//en el web.config de la aplicacion <binding name="BasicHttpBinding_IService1" sendTimeout="00:10:00"/>
ASPDF . Service1Client clsGenerarDocumento = new ASPDF . Service1Client ( ) ;
strResult = clsGenerarDocumento . Generar_Documento_PDF ( Cuerpo , strNombre + "-AP" ) ;
string sourcePath = strResult ;
string strNombreArchivo = System . IO . Path . GetFileName ( strResult ) ;
string pdfPath = ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + strNombre + @"\" + strNombreArchivo ;
if ( System . IO . File . Exists ( strResult ) )
{
if ( ! System . IO . Directory . Exists ( ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + strNombre ) )
System . IO . Directory . CreateDirectory ( ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + strNombre ) ;
System . IO . File . Copy ( strResult , pdfPath , true ) ;
}
#region formulario agua potable
//limpiarCampos();
string strNombreCarta = strNombre ;
Documento oDoc = new Documento ( ) ;
//string pdfPathCriterioAP = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNombre + @"\" + strNombreArchivo + "-AP.pdf";
//targetURL = "'../../DocumentosPDF/" + strNumSolicitudTMP + "/" + strNombreCarta + "-AP.pdf'";
if ( System . IO . File . Exists ( pdfPath ) )
{
byte [ ] bDoc = System . IO . File . ReadAllBytes ( pdfPath ) ;
//se carga el archivo y el registro a vision 2020
string strResultado = oDoc . Archivar_Documento ( strNombre . ToString ( ) . Trim ( ) + "|" + "Criterio técnico AP" , strNombreCarta . ToString ( ) . Replace ( " " , "_" ) + "-AP.pdf" , bDoc ) ;
if ( strResultado = = string . Empty )
{
//File.Delete(pdfPath);
}
}
#endregion
//strResult = strResult;
}
catch ( Exception ex )
{
strResult = ex . Message ;
throw ex ;
}
var uri = new System . Uri ( strResult , UriKind . Absolute ) ;
//System.Diagnostics.Process proc = new System.Diagnostics.Process();
//proc.StartInfo.FileName = strResult;
//proc.Start();
//proc.Close();
return uri . ToString ( ) ;
}
#endregion
#region Metodos Controles a Datos ( R5 )
/// <summary>
/// guarda y modifica registros en la tabla.
/// </summary>
/// <returns></returns>
private int GuardarDatosVisitaSolicitud ( ) //M0
{
int nValorRetornado = 0 ;
int nPkInspeccion = 0 ;
int nPkInspeccionAP = 0 ;
int nPKOtroTuberiaAP = 0 ;
int nPKTipoprevista = 0 ;
int nPKOtrosprevista = 0 ;
int nPKNegacionDisponibilidad = 0 ;
int nPKDiametro = 0 ;
int nPKExisteDisponibilidad = 0 ;
int nPKCroquis = 0 ;
int nPKInspeccionUbicaMedidor = 0 ;
int nPKObservacionesCritec = 0 ;
TransaccionDAL tdlTransaccion = null ; // new TransaccionDAL("SIGDD");
// tdlTransaccion.BeginTransaction();
try
{
string strModo = ViewState [ "MODO" ] . ToString ( ) ;
if ( ValidarCampos ( ) )
{
if ( strModo = = "Nuevo" )
{
nPkInspeccion = GuardarInspeccionGeneral ( tdlTransaccion ) ;
Session [ "PKINSPECCION" ] = nPkInspeccion ;
if ( nPkInspeccion ! = 0 )
{
nPkInspeccionAP = GuardarInspeccionAP ( nPkInspeccion , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 & & rblDiametro . SelectedValue = = "Otro" )
nPKOtroTuberiaAP = GuardarOtrotuberiaAP ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 )
nPKTipoprevista = GuardarTipoPrevista ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 & & int . Parse ( rblTipoPrevista . SelectedValue ) = = 4 ) //Otro
nPKOtrosprevista = GuardarOtroPrevista ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 & & bool . Parse ( rblDisponibilidadAP . SelectedValue ) = = false )
{
nPKNegacionDisponibilidad = GuardarNegaciondisponibilidad ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 ) //&& bool.Parse(rblExisteCCH.SelectedValue) == true)
{
nPKExisteDisponibilidad = GuardarExistedisponibilidad ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPKExisteDisponibilidad = = 0 )
{
throw new System . ArgumentException ( "No se pudo finalizar el ingreso del formulario vuelva a intentar de nuevo" , "Formulario de Agua Potable - CCH" ) ;
}
}
}
if ( nPkInspeccionAP ! = 0 )
nPKDiametro = GuardarDiametroMedidor ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 )
nPKCroquis = GuardarCroquis ( nPkInspeccion , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 )
nPKInspeccionUbicaMedidor = GuardarInspeccionubicamedidor ( nPkInspeccion , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 )
nPKObservacionesCritec = GuardarObservacionesCritec ( nPkInspeccionAP , tdlTransaccion ) ;
nValorRetornado = nPkInspeccionAP ;
llenarGridVisitaSolicitud ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha ingresado un formulario de criterio técnico de agua potable " + nPkInspeccion . ToString ( ) . Trim ( ) + " para la solicitud " + Session [ "SOLICITUD" ] . ToString ( ) ,
Path . GetFileNameWithoutExtension ( Page . AppRelativeVirtualPath ) ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
}
if ( strModo = = "Modificar" )
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
DataSet dsInspeccion = objInspeccionBL . listarInspecciones ( null ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows . Count ! = 0 )
{
nPkInspeccion = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
nPkInspeccion = ModificarInspeccionGeneral ( tdlTransaccion ) ;
if ( nPkInspeccion ! = 0 )
{
nPkInspeccionAP = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKINSPECCIONAP" ] . ToString ( ) ) ;
nPkInspeccionAP = ModificarInspeccionAP ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 & & rblDiametro . SelectedValue = = "Otro" )
{
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOTROTUBERIAAP" ] . ToString ( ) = = string . Empty )
nPKOtroTuberiaAP = GuardarOtrotuberiaAP ( nPkInspeccionAP , tdlTransaccion ) ;
else
{
nPKOtroTuberiaAP = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOTROTUBERIAAP" ] . ToString ( ) ) ;
nPKOtroTuberiaAP = ModificarOtrotuberiaAP ( nPKOtroTuberiaAP , tdlTransaccion ) ;
}
}
if ( nPkInspeccionAP ! = 0 )
{
nPKTipoprevista = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKTIPOPREVISTA" ] . ToString ( ) ) ;
nPKTipoprevista = ModificarTipoPrevista ( nPKTipoprevista , tdlTransaccion ) ;
}
if ( nPkInspeccionAP ! = 0 & & int . Parse ( rblTipoPrevista . SelectedValue ) = = 4 ) //Otro
{
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOTROPREVISTA" ] . ToString ( ) = = string . Empty )
nPKOtrosprevista = GuardarOtroPrevista ( nPkInspeccionAP , tdlTransaccion ) ;
else
{
nPKOtrosprevista = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOTROPREVISTA" ] . ToString ( ) ) ;
nPKOtrosprevista = ModificarOtroPrevista ( nPKOtrosprevista , tdlTransaccion ) ;
}
}
if ( nPkInspeccionAP ! = 0 & & bool . Parse ( rblDisponibilidadAP . SelectedValue ) = = false )
{
//nPKNegacionDisponibilidad = int.Parse(dsInspeccion.Tables[0].Rows[0]["PKNEGACIONDISPONIBILIDAD"].ToString());
nPKNegacionDisponibilidad = ModificarNegaciondisponibilidad ( nPkInspeccionAP , tdlTransaccion ) ;
if ( nPkInspeccionAP ! = 0 ) // && bool.Parse(rblExisteCCH.SelectedValue) == true)
{
nPKExisteDisponibilidad = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKEXISTEDISPONIBILIDADAP" ] . ToString ( ) ) ;
nPKExisteDisponibilidad = ModificarExistedisponibilidad ( nPKExisteDisponibilidad , tdlTransaccion ) ;
}
}
if ( nPkInspeccionAP ! = 0 )
{
nPKDiametro = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKDIAMETROMEDIDOR" ] . ToString ( ) ) ;
nPKDiametro = ModificarDiametroMedidor ( nPKDiametro , tdlTransaccion ) ;
}
if ( nPkInspeccionAP ! = 0 )
{
nPKCroquis = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKCROQUIS" ] . ToString ( ) ) ;
nPKCroquis = ModificarCroquis ( nPKCroquis , tdlTransaccion ) ;
}
if ( nPkInspeccionAP ! = 0 )
{
nPKInspeccionUbicaMedidor = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKINSPECCIONUBICAMEDIDOR" ] . ToString ( ) ) ;
nPKInspeccionUbicaMedidor = ModificarInspeccionubicamedidor ( nPKInspeccionUbicaMedidor , tdlTransaccion ) ;
}
if ( nPkInspeccionAP ! = 0 & & dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOBSERVACIONESCRITEC" ] . ToString ( ) ! = string . Empty )
{
nPKObservacionesCritec = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKOBSERVACIONESCRITEC" ] . ToString ( ) ) ;
nPKObservacionesCritec = ModificarObservacionesCritec ( nPKObservacionesCritec , tdlTransaccion ) ;
}
nValorRetornado = nPkInspeccionAP ;
llenarGridVisitaSolicitud ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se ha denegado un formulario de criterio técnico de agua potable " + nPkInspeccion . ToString ( ) . Trim ( ) ,
"frwCriterioPA.aspx" ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
}
}
}
else
{
nValorRetornado = 0 ;
}
}
catch ( Exception ex )
{
throw ex ;
}
finally
{
//tdlTransaccion.CommitTransaction();
}
return nValorRetornado ;
}
private int GuardarInspeccionGeneral ( TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . ESTRUCTURAEXISTENTEINSPECCION = bool . Parse ( rblEstructuraExistente . SelectedValue . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . TIPOESTRUCTURA = txtTipoEstructuraExistente . Text ;
objInspeccionBL . objinspeccionapEL . DISPONIBILIDADASOCIADAEXISTENTEINSPECCION = bool . Parse ( rblExisteDisponibilidad . SelectedValue . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONDISPONIBILIDADEXISTENTEINSPECCION = txtDisponibilidadAsociada . Text ;
objInspeccionBL . objinspeccionapEL . CONDOMINIO = txtOficioRecepcion . Text ;
objInspeccionBL . objinspeccionapEL . FECHAINSPECCION = DateTime . Now ;
objInspeccionBL . objinspeccionapEL . FKESTADOINSPECCION = 1 ; //Asignada
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarInspeccionGeneral ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarInspeccionAP ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PRESIONMIN = decimal . Parse ( txtPresionMinima . Text ) ;
objInspeccionBL . objinspeccionapEL . PRESIONMAX = decimal . Parse ( txtPresionMaxima . Text ) ;
objInspeccionBL . objinspeccionapEL . SISTEMAASOCIADO = txtSistemaAsociado . Text ;
objInspeccionBL . objinspeccionapEL . CAUDALRESERVADO = decimal . Parse ( txtCaudalReservado . Text ) ;
objInspeccionBL . objinspeccionapEL . TUBERIA = bool . Parse ( rblTuberiaDistribucion . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . MATERIALTUBERIA = rblMaterial . SelectedValue ;
objInspeccionBL . objinspeccionapEL . DIAMETRO = rblDiametro . SelectedValue ;
objInspeccionBL . objinspeccionapEL . PREVISTA = bool . Parse ( rblPrevista . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCION = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOMEDIDOR = int . Parse ( rblTipoMedidor . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . EXISTEDISPONIBILIDAD = bool . Parse ( rblDisponibilidadAP . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarInspeccionAP ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarOtrotuberiaAP ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONOTROTUBERIAAP = txtOtroDiametro . Text ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarOtrotuberiaap ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarTipoPrevista ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPOPREVISTA = int . Parse ( rblTipoPrevista . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());//AGUA POTABLE
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarTipoprevista ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarOtroPrevista ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONOTROPREVISTA = txtOtrosPrevista . Text ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());//AGUA POTABLE
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarOtroprevista ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarObservacionesCritec ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . OBSERVACION = txtObservacionesCritec . Text ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());//AGUA POTABLE
2021-02-09 04:44:03 +00:00
objInspeccionBL . objinspeccionapEL . DESCRIPCIONOTROMOTIVONEGACIONDISPONIBILIDAD = txtOtraRazon . Text ;
2021-01-22 14:59:35 +00:00
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarObservacionCritec ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarNegaciondisponibilidad ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());//agua potable
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
if ( chkId18 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 18 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-02-09 04:44:03 +00:00
//if (chkId19.Checked)
//{
// objInspeccionBL.objinspeccionapEL.FKTIPONEGACIONDISPONIBILIDAD = 19;
// pkResult = objInspeccionBL.insertarNegaciondisponibilidad(p_tdlTransaccion);
//}
2021-01-22 14:59:35 +00:00
if ( chkId21 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 21 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId22 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 22 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId23 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 23 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId25 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 25 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId26 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 26 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId27 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 27 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-02-09 04:44:03 +00:00
if ( chkId30 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 30 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId31 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 31 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId32 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 32 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-01-22 14:59:35 +00:00
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarDiametroMedidor ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . VALORDIAMETROMEDIDOR = decimal . Parse ( rblDiametroMedidor . SelectedValue . ToString ( ) . Replace ( "," , "." ) ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarDiametromedidor ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarExistedisponibilidad ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . EXISTECAPACIDADHIDRICA = bool . Parse ( rblExisteCCH . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . OBSERVACIONEXTENSIONRAMAL = txtObservacionesExtensionRamal . Text ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarExistedisponibilidad ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarCroquis ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
if ( txtLongitud . Text = = string . Empty )
txtLongitud . Text = "0.00" ;
if ( txtLatitud . Text = = string . Empty )
txtLatitud . Text = "0.00" ;
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . LONGITUD = decimal . Parse ( txtLongitud . Text . Replace ( "," , "." ) ) ;
objInspeccionBL . objinspeccionapEL . LATITUD = decimal . Parse ( txtLatitud . Text . Replace ( "," , "." ) ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCION = p_nPK ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarCroquis ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int GuardarInspeccionubicamedidor ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . LINDEROINSPECCIONUBICAMEDIDOR = txtLindero . Text ;
objInspeccionBL . objinspeccionapEL . FKINSPECCION = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKUBICAMEDIDOR = int . Parse ( rblUbicacionMedidor . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . insertarInspeccionubicamedidor ( p_tdlTransaccion ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarInspeccionGeneral ( TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKINSPECCION = int . Parse ( Session [ "PKINSPECCION" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . ESTRUCTURAEXISTENTEINSPECCION = bool . Parse ( rblEstructuraExistente . SelectedValue . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . TIPOESTRUCTURA = txtTipoEstructuraExistente . Text ;
objInspeccionBL . objinspeccionapEL . DISPONIBILIDADASOCIADAEXISTENTEINSPECCION = bool . Parse ( rblExisteDisponibilidad . SelectedValue . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONDISPONIBILIDADEXISTENTEINSPECCION = txtDisponibilidadAsociada . Text ;
objInspeccionBL . objinspeccionapEL . CONDOMINIO = txtOficioRecepcion . Text ;
objInspeccionBL . objinspeccionapEL . FECHAINSPECCION = DateTime . Now ;
objInspeccionBL . objinspeccionapEL . FKESTADOINSPECCION = 1 ; //Asignada
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarInspecciongeneral ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarInspeccionAP ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . PRESIONMIN = decimal . Parse ( txtPresionMinima . Text ) ;
objInspeccionBL . objinspeccionapEL . PRESIONMAX = decimal . Parse ( txtPresionMaxima . Text ) ;
objInspeccionBL . objinspeccionapEL . SISTEMAASOCIADO = txtSistemaAsociado . Text ;
objInspeccionBL . objinspeccionapEL . CAUDALRESERVADO = decimal . Parse ( txtCaudalReservado . Text ) ;
objInspeccionBL . objinspeccionapEL . TUBERIA = bool . Parse ( rblTuberiaDistribucion . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . MATERIALTUBERIA = rblMaterial . SelectedValue ;
objInspeccionBL . objinspeccionapEL . DIAMETRO = rblDiametro . SelectedValue ;
objInspeccionBL . objinspeccionapEL . PREVISTA = bool . Parse ( rblPrevista . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . FKTIPOMEDIDOR = int . Parse ( rblTipoMedidor . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . EXISTEDISPONIBILIDAD = bool . Parse ( rblDisponibilidadAP . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarInspeccionap ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarOtrotuberiaAP ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKOTROTUBERIAAP = p_nPK ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONOTROTUBERIAAP = txtOtroDiametro . Text ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarOtrotuberiaap ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarTipoPrevista ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKTIPOPREVISTA = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOPREVISTA = int . Parse ( rblTipoPrevista . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarTipoprevista ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarOtroPrevista ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKOTROPREVISTA = p_nPK ;
objInspeccionBL . objinspeccionapEL . DESCRIPCIONOTROPREVISTA = txtOtrosPrevista . Text ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarOtroprevista ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarNegaciondisponibilidad ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = p_nPK ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());AGUA POTABLE
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
//eliminar todos los registros e insertarlos de nuevo
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 18 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 19 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 21 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 22 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 23 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 25 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 26 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 27 ;
pkResult = objInspeccionBL . eliminarNegaciondisponibilidad ( ) ;
if ( chkId18 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 18 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-02-09 04:44:03 +00:00
//if (chkId19.Checked)
//{
// objInspeccionBL.objinspeccionapEL.FKTIPONEGACIONDISPONIBILIDAD = 19;
// pkResult = objInspeccionBL.insertarNegaciondisponibilidad(p_tdlTransaccion);
//}
2021-01-22 14:59:35 +00:00
if ( chkId21 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 21 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId22 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 22 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId23 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 23 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId25 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 25 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId26 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 26 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId27 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 27 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-02-09 04:44:03 +00:00
if ( chkId30 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 30 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId31 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 31 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
if ( chkId32 . Checked )
{
objInspeccionBL . objinspeccionapEL . FKTIPONEGACIONDISPONIBILIDAD = 32 ;
pkResult = objInspeccionBL . insertarNegaciondisponibilidad ( p_tdlTransaccion ) ;
}
2021-01-22 14:59:35 +00:00
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarObservacionesCritec ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKOBSERVACIONESCRITEC = p_nPK ;
objInspeccionBL . objinspeccionapEL . OBSERVACION = txtObservacionesCritec . Text ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarObservacionCritec ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarDiametroMedidor ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKDIAMETROMEDIDOR = p_nPK ;
objInspeccionBL . objinspeccionapEL . VALORDIAMETROMEDIDOR = decimal . Parse ( rblDiametroMedidor . SelectedValue . ToString ( ) . Replace ( "," , "." ) ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarDiametromedidor ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarExistedisponibilidad ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKEXISTEDISPONIBILIDAD = p_nPK ;
objInspeccionBL . objinspeccionapEL . EXISTECAPACIDADHIDRICA = bool . Parse ( rblExisteCCH . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . OBSERVACIONEXTENSIONRAMAL = txtObservacionesExtensionRamal . Text ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarExistedisponibilidad ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarCroquis ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKCROQUIS = p_nPK ;
objInspeccionBL . objinspeccionapEL . LONGITUD = decimal . Parse ( txtLongitud . Text ) ;
objInspeccionBL . objinspeccionapEL . LATITUD = decimal . Parse ( txtLatitud . Text ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarCroquis ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
private int ModificarInspeccionubicamedidor ( int p_nPK , TransaccionDAL p_tdlTransaccion )
{
int pkResult = 0 ;
try
{
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . PKINSPECCIONUBICAMEDIDOR = p_nPK ;
objInspeccionBL . objinspeccionapEL . LINDEROINSPECCIONUBICAMEDIDOR = txtLindero . Text ;
objInspeccionBL . objinspeccionapEL . FKUBICAMEDIDOR = int . Parse ( rblUbicacionMedidor . SelectedValue ) ;
objInspeccionBL . objinspeccionapEL . ASTATE = true ;
pkResult = objInspeccionBL . modificarInspeccionubicamedidor ( ) ;
}
catch ( Exception ex )
{ throw ex ; }
return pkResult ;
}
/// <summary>
/// guarda y modifica registros en la tabla.
/// </summary>
/// <returns></returns>
///
private int GuardarDatosActividad ( string p_accion )
{
int nValorRetornado = 0 ;
try
{
AyABL . TRA . correoBL objcorreoBL = new AyABL . TRA . correoBL ( ) ;
string strModo = ViewState [ "MODO" ] . ToString ( ) ;
int nPkSolicitud = 0 ;
int nResultadoActualizar = 0 ;
string strMensajeContenido = "" ;
string strAsuntoCorreo = "" ;
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”" ;
solicitudBL objSolicitudBL = new solicitudBL ( ) ;
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = int . Parse ( Session [ "NACTIVIDAD" ] . ToString ( ) ) ;
DataSet dsEncargadosActividades = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
if ( dsEncargadosActividades . Tables [ 0 ] . Rows . Count > 0 )
{
string strEncargadoActividad = dsEncargadosActividades . Tables [ 0 ] . Rows [ 0 ] [ "PKRESPONSABLEACTIVIDAD" ] . ToString ( ) ;
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . DESCRIPCION = "\n" + DateTime . Now . ToString ( ) + " - " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " - Se " + p_accion + " el formulario por parte del encargado de la revisión: " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) ;
objObservacionesBL . objobservacionesEL . FKUSUARIOXDEPENDENCIA = int . Parse ( Session [ "PKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . PKRESPONSABLEACTIVIDAD = int . Parse ( strEncargadoActividad ) ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . TIPO = 1 ;
//objObservacionesBL.objobservacionesEL.FKSOLICITUD = nPKSolicitud;
//objObservacionesBL.objobservacionesEL.USUARIO = Session["LOGIN"].ToString();
nValorRetornado = objObservacionesBL . insertarObservacionActividad ( ) ;
if ( nValorRetornado ! = 0 )
{
solicitudBL objSolicitud = new solicitudBL ( ) ;
//objSolicitud.objresponsableActividadEL.PK = int.Parse(Session["PKRESPONSABLEACTIVIDAD"].ToString());
//poner la actividad actual en estado correspondiente
objSolicitud . objresponsableActividadEL . FECHADEVOLUCION = DateTime . Now ;
foreach ( DataRow row in dsEncargadosActividades . Tables [ 0 ] . Rows )
{
objSolicitud . objresponsableActividadEL . PK = int . Parse ( row [ "PKRESPONSABLEACTIVIDAD" ] . ToString ( ) ) ;
if ( p_accion = = "aprueba" )
{
decimal nTiempoActividad = 0 ;
if ( row [ "CLASIFICACIONSOLICITUD" ] . ToString ( ) = = "Crecimiento vegetativo" )
nTiempoActividad = decimal . Parse ( row [ "TIEMPOCVACTIVIDAD" ] . ToString ( ) ) ;
if ( row [ "CLASIFICACIONSOLICITUD" ] . ToString ( ) = = "Desarrollo urbanistico" )
nTiempoActividad = decimal . Parse ( row [ "TIEMPODUACTIVIDAD" ] . ToString ( ) ) ;
char [ ] separadorColumna = { '.' } ;
string [ ] strArrayTiempo = nTiempoActividad . ToString ( ) . Replace ( "," , "." ) . Split ( separadorColumna ) ;
DateTime dtFechaRecibido = DateTime . Parse ( row [ "FECHAASIGNACIONRESPONSABLEACTIVIDAD" ] . ToString ( ) ) . AddDays ( double . Parse ( strArrayTiempo [ 0 ] . ToString ( ) ) ) ;
if ( double . Parse ( strArrayTiempo [ 1 ] . ToString ( ) ) > 0 )
dtFechaRecibido = dtFechaRecibido . AddHours ( 4 ) ;
if ( dtFechaRecibido > DateTime . Now )
objSolicitud . objresponsableActividadEL . FKESTADO = 5 ; //finalizada a tiempo t_sgm_estadoactividad
else
objSolicitud . objresponsableActividadEL . FKESTADO = 8 ; //finalizada fuera de tiempo t_sgm_estadoactividad
strMensajeContenido = "La actividad " + Session [ "DESCRIPCIONACTIVIDAD" ] . ToString ( ) + " de la solicitud N° " + Session [ "SOLICITUD" ] . ToString ( ) + " ha sido concluida para ver los detalles, ingrese al sistema <a href=http://" + HttpContext . Current . Request . Url . Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina ;
strAsuntoCorreo = "Conclusión de actividad - SIGDD" ;
//cancelar notificacion
notificacionBL objNotificacionBL = new notificacionBL ( ) ;
objNotificacionBL . objnotificacionEL . ID_DOCUMENTO = Session [ "SOLICITUD" ] . ToString ( ) + " - Confección del Criterio técnico de agua potable" ;
objNotificacionBL . objnotificacionEL . status = "00" ;
objNotificacionBL . objnotificacionEL . message = "OK" ;
nValorRetornado = objNotificacionBL . cancelarNotificacion ( objNotificacionBL . objnotificacionEL ) ;
}
else
{
objSolicitud . objresponsableActividadEL . FKESTADO = 4 ; //reinspeccion t_sgm_estadoactividad
strMensajeContenido = "La actividad " + Session [ "DESCRIPCIONACTIVIDAD" ] . ToString ( ) + " de la solicitud N° " + Session [ "SOLICITUD" ] . ToString ( ) + " no ha sido aprobada para ver los detalles, ingrese al sistema <a href=http://" + HttpContext . Current . Request . Url . Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina ;
strAsuntoCorreo = "Reinspección de actividad - SIGDD" ;
}
nResultadoActualizar = objSolicitud . actualizarActividadSolicitud ( ) ;
if ( objSolicitud . objresponsableActividadEL . FKESTADO = = 8 | | objSolicitud . objresponsableActividadEL . FKESTADO = = 5 )
{
objcorreoBL = new AyABL . TRA . correoBL ( ) ;
//poner la siguiente actividad en pendiente
objSolicitudBL = new solicitudBL ( ) ;
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = 5 ;
DataSet dsEncargadosActividadesSiguiente = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
foreach ( DataRow row6 in dsEncargadosActividadesSiguiente . Tables [ 0 ] . Rows )
{
objSolicitud . objresponsableActividadEL . PK = int . Parse ( row6 [ "PKRESPONSABLEACTIVIDAD" ] . ToString ( ) ) ; ;
objSolicitud . objresponsableActividadEL . FKESTADO = 3 ; //pendiente t_sgm_estadoactividad
objSolicitud . objresponsableActividadEL . FECHARECIBIDO = DateTime . Now ;
nResultadoActualizar = objSolicitud . actualizarActividadSolicitudSiguiente ( ) ;
objcorreoBL . objcorreoEL . ASUNTO = strAsuntoCorreo ;
objcorreoBL . objcorreoEL . CONTENIDO = strMensajeContenido ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( row6 [ "FKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornado = objcorreoBL . insertarCorreo ( ) ;
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": La actividad " + Session [ "DESCRIPCIONACTIVIDAD" ] . ToString ( ) + " de la solicitud N° " + Session [ "SOLICITUD" ] . ToString ( ) + " ha sido finalizada por parte del encargado de la actividad: " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) . Trim ( ) ,
Path . GetFileNameWithoutExtension ( Page . AppRelativeVirtualPath ) ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
}
if ( objSolicitud . objresponsableActividadEL . FKESTADO = = 4 ) //no aprobo en la revision
{
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . INSERT . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": La actividad " + Session [ "DESCRIPCIONACTIVIDAD" ] . ToString ( ) + " de la solicitud N° " + Session [ "SOLICITUD" ] . ToString ( ) + " no ha sido aprobada en la revisión por parte del encargado de la actividad: " + Session [ "NOMBREEMPLEADO" ] . ToString ( ) . Trim ( ) ,
Path . GetFileNameWithoutExtension ( Page . AppRelativeVirtualPath ) ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
}
if ( p_accion = = "deniega" )
{
//Poner la actividad 2 programacion en pendiente(3)
//objSolicitudBL = new solicitudBL();
//objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
//objSolicitudBL.objSolicitudEL.ORDEN = 2;
//dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
//foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
//{
// objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString()); ;
// objSolicitud.objresponsableActividadEL.FKESTADO = 3;//pendiente t_sgm_estadoactividad
// nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
//}
}
#region Envio de correo
int nActividad = int . Parse ( Session [ "NACTIVIDAD" ] . ToString ( ) ) ;
//if (nActividad > 2)
// nActividad = 2;//SE ENVIA PARA REPROGRAMAR11
//else
// nActividad = 1;
//se envia correo a los encargados de la actividad 3
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = nActividad ;
dsEncargadosActividades = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
objcorreoBL = new AyABL . TRA . correoBL ( ) ;
if ( dsEncargadosActividades . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow row in dsEncargadosActividades . Tables [ 0 ] . Rows )
{
nPkSolicitud = Convert . ToInt32 ( row [ 1 ] . ToString ( ) ) ; //AQUI INSERTAMOS LA PK DE LA SOLICITUD
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = nPkSolicitud ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = strAsuntoCorreo ;
objcorreoBL . objcorreoEL . CONTENIDO = strMensajeContenido ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( row [ "FKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornado = objcorreoBL . insertarCorreo ( ) ;
}
}
//se envia correo a los encargados de la actividad 2 para reprogramar la tarea
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = 2 ;
dsEncargadosActividades = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
if ( dsEncargadosActividades . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow row in dsEncargadosActividades . Tables [ 0 ] . Rows )
{
nPkSolicitud = Convert . ToInt32 ( row [ 1 ] . ToString ( ) ) ; //AQUI INSERTAMOS LA PK DE LA SOLICITUD
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = nPkSolicitud ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = "Conclusión de actividad - SIGDD" ;
objcorreoBL . objcorreoEL . CONTENIDO = strMensajeContenido ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( row [ "FKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornado = objcorreoBL . insertarCorreo ( ) ;
}
}
//se envia correo a los encargados de la actividad 5 para iniciar la tarea de constancia de actividad
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = 5 ;
dsEncargadosActividades = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
if ( dsEncargadosActividades . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow row in dsEncargadosActividades . Tables [ 0 ] . Rows )
{
nPkSolicitud = Convert . ToInt32 ( row [ 1 ] . ToString ( ) ) ; //AQUI INSERTAMOS LA PK DE LA SOLICITUD
objcorreoBL . objcorreoEL . FKNUMSOLICITUD = nPkSolicitud ;
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
objcorreoBL . objcorreoEL . ASUNTO = "Conclusión de actividad - SIGDD" ;
objcorreoBL . objcorreoEL . CONTENIDO = strMensajeContenido ;
objcorreoBL . objcorreoEL . FKUSUARIO = Convert . ToInt32 ( row [ "FKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objcorreoBL . objcorreoEL . Fecha = DateTime . Now ;
nValorRetornado = objcorreoBL . insertarCorreo ( ) ;
}
}
#endregion
}
}
//GuardarEventoBitacora(
// Session["LOGIN"].ToString(),
// AccionBitacora.INSERT.ToString(),
// MensajesBitacora.IngresarRegistro + ": Se ingreso una nueva observacion a la actividad: Se aprueba el formulario por parte del encargado de la revisión: " + Session["NOMBREEMPLEADO"].ToString().Trim(),
// "frwCriterioPA.aspx",
// Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
// );
}
catch ( Exception ex )
{
throw ex ;
}
return nValorRetornado ;
}
#endregion
#region Metodos Datos a Controles ( R6 )
/// <summary>
/// Llena el dropdownlist de grado academico según la aplicación
/// </summary>
private void llenarDDLtipoEstructuraExistente ( ) //M1
{
try
{
//Limpia el control
//ddlTipoEstructuraExistente.Items.Clear();
////Instancia el bjeto
//objInspeccionBL = new inspeccionapBL();
////Asigna datos al atributo
////Carga la información en un dataset
//DataSet dsTipoInspeccion = objInspeccionBL.dsListaTipoEstructuraExistente(null);
//if (dsTipoInspeccion.Tables[0].Rows.Count != 0)
//{
// ddlTipoEstructuraExistente.DataSource = dsTipoInspeccion;
// ddlTipoEstructuraExistente.DataTextField = dsTipoInspeccion.Tables[0].Columns["DESCRIPCIONTIPOESTRUCTURA"].ColumnName;
// ddlTipoEstructuraExistente.DataValueField = dsTipoInspeccion.Tables[0].Columns["PKTIPOESTRUCTURA"].ColumnName;
// ddlTipoEstructuraExistente.DataBind();
// ddlTipoEstructuraExistente.Items.Insert(0, new ListItem("Seleccione", "-1"));
//}
//else
// ddlTipoEstructuraExistente.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
}
catch ( Exception ex )
{
throw ex ;
}
}
/// <summary>
/// Llena el dropdownlist de tipo de consulta
/// Se cargan dos dataset uno con los datos de configuracion de la aplicacion y el otro viene del ADS que contiene el nombre
/// luego se hace un merge manual, se crea una tabla aparte con los valores requeridos
/// Asi mantenemos actualizados los nombre de los usuarios con los datos del ADS
/// </summary>
private void llenarDDLInspector ( ) //M2
{
try
{
//ddlInspector.Items.Clear();
//ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
//DataSet ds;
//objUsuarioBL = new UsuarioBL();
//objUsuarioBL.objUsuarioEL.FKTIPOINSPECCION = int.Parse(ddlTipoInspeccion.SelectedValue);
//ds = objUsuarioBL.dsUsuarioInspector(objUsuarioBL.objUsuarioEL);
//DataSet ds2 = objUsuarioBL.dsListaUsuarios(arlCondicionesFiltroBusqueda);
//DataTable dtInspectores = new DataTable();
//dtInspectores.Columns.Add("PKUSUARIOXDEPENDENCIA");
//dtInspectores.Columns.Add("NOMBRECOMPLETO");
//if (ds.Tables[0].Rows.Count != 0)
//{
// foreach (DataRow row in ds.Tables[0].Rows)
// {
// foreach (DataRow rowUsuario in ds2.Tables[0].Rows)
// {
// if (row[1].ToString() == rowUsuario[1].ToString())
// {
// DataRow rowFinal = dtInspectores.NewRow();
// rowFinal["PKUSUARIOXDEPENDENCIA"] = row[0].ToString();
// rowFinal["NOMBRECOMPLETO"] = rowUsuario[12].ToString();
// dtInspectores.Rows.Add(rowFinal);
// }
// }
// }
//}
//if (dtInspectores.Rows.Count != 0)
//{
// ddlInspector.DataSource = dtInspectores;
// ddlInspector.DataTextField = dtInspectores.Columns["NOMBRECOMPLETO"].ColumnName;
// ddlInspector.DataValueField = dtInspectores.Columns["PKUSUARIOXDEPENDENCIA"].ColumnName;
// ddlInspector.DataBind();
// ddlInspector.Items.Insert(0, new ListItem("Seleccione", "-1"));
//}
//else
// ddlInspector.Items.Insert(0, new ListItem("----- No existen opciones -----", "-1"));
}
catch ( Exception ex )
{
throw ex ;
}
}
/// <summary>
/// LLena el listado
/// </summary>
private void llenarGridVisitaSolicitud ( ) //M3
{
try
{
solicitudBL objSolicitudBL = new solicitudBL ( ) ;
objSolicitudBL . objSolicitudEL . PK = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . FKUSUARIOXDEPENDENCIA = int . Parse ( Session [ "PKUSUARIOXDEPENDENCIA" ] . ToString ( ) ) ;
objSolicitudBL . objSolicitudEL . ORDEN = 3 ;
objSolicitudBL . objSolicitudEL . FKESTADO = 5 ;
objSolicitudBL . objSolicitudEL . FKESTADO2 = 8 ;
DataSet dsEncargadosActividades = objSolicitudBL . dsListaActividadesEncargado ( null ) ;
if ( dsEncargadosActividades . Tables [ 0 ] . Rows . Count > 0 )
{
Session [ "ACTIVIDADFINALIZADA" ] = true ;
}
objInspeccionBL = new inspeccionapBL ( ) ;
objInspeccionBL . objinspeccionapEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objInspeccionBL . objinspeccionapEL . FKREUTILIZA = nPKReutilizaTMP ;
char [ ] separadorColumna = { '-' } ;
string [ ] arrSolicitud = Session [ "SOLICITUD" ] . ToString ( ) . Split ( separadorColumna ) ;
objInspeccionBL . objinspeccionapEL . NUMEROSOLICITUD = arrSolicitud [ 1 ] . ToString ( ) ;
DataSet dsInspeccionBL = objInspeccionBL . listarInspecciones ( null ) ;
General . detalleGridView ( dsInspeccionBL , grvListaVisitaSolicitud , lblTotalDatos ) ;
}
catch ( Exception ex )
{
throw ex ;
}
}
2021-02-09 04:44:03 +00:00
2021-01-22 14:59:35 +00:00
/// <summary>
/// LLena el listado
/// </summary>
private void cargarFormularioCriterioAP ( int p_nPKInspeccion ) //M3
{
try
{
2021-02-09 20:27:11 +00:00
txtOtraRazon . Visible = false ;
2021-01-22 14:59:35 +00:00
objInspeccionBL = new inspeccionapBL ( ) ;
//objInspeccionBL.objinspeccionapEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
objInspeccionBL . objinspeccionapEL . PKINSPECCION = p_nPKInspeccion ;
DataSet dsInspeccion = objInspeccionBL . listarInspecciones ( null ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows . Count ! = 0 )
{
Session [ "PKTIPOINSPECCION" ] = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "FKTIPOINSPECCION" ] . ToString ( ) ;
objInspeccionBL . objinspeccionapEL . FKINSPECCIONAPAS = int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKINSPECCIONAP" ] . ToString ( ) ) ;
rblExisteNis . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "TIENESERVICIOSOLICITUD" ] . ToString ( ) . ToLower ( ) ;
if ( rblExisteNis . SelectedValue = = "true" )
txtNisExistente . Enabled = true ;
else
txtNisExistente . Enabled = false ;
txtNisExistente . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "NUMERONISSOLICITUD" ] . ToString ( ) ;
rblEstructuraExistente . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "ESTRUCTURAEXISTENTEINSPECCION" ] . ToString ( ) . ToLower ( ) ;
if ( rblEstructuraExistente . SelectedValue = = "true" )
txtTipoEstructuraExistente . Enabled = true ;
else
txtTipoEstructuraExistente . Enabled = false ;
txtTipoEstructuraExistente . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "TIPOESTRUCTURAINSPECCION" ] . ToString ( ) ;
rblExisteDisponibilidad . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DISPONIBILIDADASOCIADAEXISTENTEINSPECCION" ] . ToString ( ) . ToLower ( ) ;
if ( rblExisteDisponibilidad . SelectedValue = = "true" )
txtDisponibilidadAsociada . Enabled = true ;
else
txtDisponibilidadAsociada . Enabled = false ;
txtDisponibilidadAsociada . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONDISPONIBILIDADEXISTENTEINSPECCION" ] . ToString ( ) ;
txtOficioRecepcion . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "CONDOMINIOINSPECCION" ] . ToString ( ) ;
txtPresionMinima . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PRESIONMININSPECCIONAP" ] . ToString ( ) ;
txtPresionMaxima . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PRESIONMAXINSPECCIONAP" ] . ToString ( ) ;
txtSistemaAsociado . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "SISTEMAASOCIADOINSPECCIONAP" ] . ToString ( ) ;
decimal dCaudal = decimal . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "CAUDALRESERVADOINSPECCIONAP" ] . ToString ( ) ) ;
txtCaudalReservado . Text = dCaudal . ToString ( "N2" ) ;
lblProposito . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONPROYECTO" ] . ToString ( ) ;
rblTuberiaDistribucion . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "TUBERIAINSPECCIONAP" ] . ToString ( ) . ToLower ( ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "TUBERIAINSPECCIONAP" ] . ToString ( ) . ToLower ( ) = = "true" )
{
rblMaterial . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "MATERIALTUBERIAINSPECCIONAP" ] . ToString ( ) ;
rblDiametro . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DIAMETROINSPECCIONAP" ] . ToString ( ) ;
}
rblPrevista . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PREVISTAINSPECCIONAP" ] . ToString ( ) . ToLower ( ) ;
rblDisponibilidadAP . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "EXISTEDISPONIBILIDADINSPECCIONAP" ] . ToString ( ) . ToLower ( ) ;
rblTipoMedidor . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "FKTIPOMEDIDOR" ] . ToString ( ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOTROTUBERIAAP" ] . ToString ( ) . ToLower ( ) ! = "" )
txtOtroDiametro . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOTROTUBERIAAP" ] . ToString ( ) ;
rblTipoPrevista . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "FKTIPOPREVISTA" ] . ToString ( ) ;
if ( rblTipoPrevista . SelectedValue . ToString ( ) = = "4" )
{
txtOtrosPrevista . Visible = true ;
txtOtrosPrevista . Enabled = true ;
}
else
{
txtOtrosPrevista . Text = string . Empty ;
txtOtrosPrevista . Visible = false ;
txtOtrosPrevista . Enabled = false ;
}
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOTROPREVISTA" ] . ToString ( ) . ToLower ( ) ! = "" )
{
txtOtrosPrevista . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOTROPREVISTA" ] . ToString ( ) ;
txtOtrosPrevista . Visible = true ;
}
rblDiametroMedidor . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "VALORDIAMETROMEDIDOR" ] . ToString ( ) ;
txtObservacionesCritec . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOBSERVACIONESCRITEC" ] . ToString ( ) ;
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "EXISTEDISPONIBILIDADINSPECCIONAP" ] . ToString ( ) . ToLower ( ) = = "false" )
{
rblExisteCCH . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "EXISTECAPACIDADHIDRICAEXISTEDISPONIBILIDADAP" ] . ToString ( ) . ToLower ( ) ;
txtObservacionesExtensionRamal . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "OBSERVACIONEXTENSIONRAMALEXISTEDISPONIBILIDADAP" ] . ToString ( ) ;
}
txtLongitud . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "LONGUITUDCROQUIS" ] . ToString ( ) ;
txtLatitud . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "LATITUDCROQUIS" ] . ToString ( ) ;
txtLindero . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "LINDEROINSPECCIONUBICAMEDIDOR" ] . ToString ( ) ;
rblUbicacionMedidor . SelectedValue = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKUBICAMEDIDOR" ] . ToString ( ) ;
objInspeccionBL . objinspeccionapEL . FKTIPOINSPECCION = 1 ; // int.Parse(Session["PKTIPOINSPECCION"].ToString());//AGUA POTABLE
DataSet dsNegacionDisponibilidad = objInspeccionBL . listarNegacionInspeccion ( null ) ;
if ( dsNegacionDisponibilidad . Tables [ 0 ] . Rows . Count ! = 0 )
{
foreach ( DataRow row in dsNegacionDisponibilidad . Tables [ 0 ] . Rows )
{
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 18 )
chkId18 . Checked = true ;
2021-02-09 04:44:03 +00:00
//if (int.Parse(row["FKTIPONEGACIONDISPONIBILIDAD"].ToString()) == 19)
// chkId19.Checked = true;
2021-01-22 14:59:35 +00:00
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 21 )
chkId21 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 22 )
chkId22 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 23 )
chkId23 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 25 )
chkId25 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 26 )
chkId26 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 27 )
chkId27 . Checked = true ;
2021-02-09 04:44:03 +00:00
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 30 )
chkId30 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 31 )
chkId31 . Checked = true ;
if ( int . Parse ( row [ "FKTIPONEGACIONDISPONIBILIDAD" ] . ToString ( ) ) = = 32 )
chkId32 . Checked = true ;
txtOtraRazon . Text = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "DESCRIPCIONOTROMOTIVONEGACIONDISPONIBILIDAD" ] . ToString ( ) ;
2021-02-09 20:27:11 +00:00
txtOtraRazon . Visible = true ;
2021-01-22 14:59:35 +00:00
}
}
2021-02-09 04:44:03 +00:00
txtOtraRazon . Visible = true ;
2021-01-22 14:59:35 +00:00
}
if ( rblDisponibilidadAP . SelectedValue . ToString ( ) . ToLower ( ) = = "false" )
{
siAP . Visible = true ;
divCCH1 . Visible = true ;
}
else
{
siAP . Visible = false ;
divCCH1 . Visible = false ;
}
if ( rblExisteCCH . SelectedValue . ToString ( ) . ToLower ( ) = = "true" )
{
divCCH2 . Visible = true ;
}
else
{
divCCH2 . Visible = false ;
}
if ( rblTuberiaDistribucion . SelectedValue . ToString ( ) . ToLower ( ) = = "true" )
{
dvTuberiaDistribucion . Visible = true ;
dvTuberiaDistribucion2 . Visible = true ;
}
else
{
dvTuberiaDistribucion . Visible = false ;
dvTuberiaDistribucion2 . Visible = false ;
}
if ( rblDiametro . SelectedValue = = "Otro" )
dvTuberiaDistribucion3 . Visible = true ;
else
dvTuberiaDistribucion3 . Visible = false ;
if ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "FKUSUARIOXDEPENDENCIA" ] . ToString ( ) . ToLower ( ) = = Session [ "PKUSUARIOXDEPENDENCIA" ] . ToString ( ) . ToLower ( ) & &
int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKESTADOINSPECCION" ] . ToString ( ) ) = = 2 )
//// if (dsInspeccion.Tables[0].Rows[0]["FKUSUARIOXDEPENDENCIA"].ToString().ToLower() != Session["PKUSUARIOXDEPENDENCIA"].ToString().ToLower())
{
habilitarCampos ( ) ;
btnAprobar . Visible = true ;
btnDenegar . Visible = true ;
btnNuevo . Visible = false ;
ViewState [ "PKREVISIONFORMULARIO" ] = dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKREVISIONFORMULARIO" ] . ToString ( ) ;
}
else
{
deshabilitarCampos ( ) ;
}
if ( int . Parse ( dsInspeccion . Tables [ 0 ] . Rows [ 0 ] [ "PKESTADOINSPECCION" ] . ToString ( ) ) = = 3 ) //si el estado es de reinspeccion se deshabilitan los campos
deshabilitarCampos ( ) ;
//else
// habilitarCampos();
}
catch ( Exception ex )
{
throw ex ;
}
}
2021-02-09 04:44:03 +00:00
2021-01-22 14:59:35 +00:00
/// <summary>
/// Carga el grid principal
/// </summary>
/// <param name="p_Llenar"></param>
private void llenarDDLEncargado ( bool p_Llenar ) //M0
{
try
{
ddlEncargadoRevision . Items . Clear ( ) ;
ArrayList arlCondicionesFiltroBusqueda = new ArrayList ( ) ;
ActividadesBL objActividadesBL = new ActividadesBL ( ) ;
objActividadesBL . objactividadesEL . Activo = true ;
objActividadesBL . objactividadesEL . ORDEN = 3 ; //Criterio tecnico
objActividadesBL . objactividadesEL . FKDEPENDENCIA = int . Parse ( Session [ "FKDEPENDENCIASIGDD" ] . ToString ( ) ) ;
DataSet dsActividad = objActividadesBL . dsListaActividad ( arlCondicionesFiltroBusqueda ) ;
if ( dsActividad . Tables [ 0 ] . Rows . Count ! = 0 )
{
ddlEncargadoRevision . DataSource = dsActividad ;
ddlEncargadoRevision . DataTextField = dsActividad . Tables [ 0 ] . Columns [ "NOMBRECOMPLETO" ] . ColumnName ;
ddlEncargadoRevision . DataValueField = dsActividad . Tables [ 0 ] . Columns [ "PKUSUARIOXDEPENDENCIA" ] . ColumnName ;
ddlEncargadoRevision . DataBind ( ) ;
ddlEncargadoRevision . Items . Insert ( 0 , new ListItem ( "Seleccione" , "-1" ) ) ;
}
else
ddlEncargadoRevision . Items . Insert ( 0 , new ListItem ( "----- No existen opciones -----" , "-1" ) ) ;
}
catch ( Exception ex )
{
throw ex ;
}
}
#endregion
#region Métodos para generar token de seguridad del firmador web
/// <summary>
/// Identificador único definido por el sistema cliente para el documento incluído en el firmador web
/// </summary>
private string IdCorrelacionFirmadorWeb
{
get
{
return "01" ;
}
}
private FirmadorWeb . Documento _documento ;
protected FirmadorWeb . Documento documento
{
get
{
if ( _documento = = null )
{
using ( FirmadorWeb . FirmadorWebSvcClient cliente = new FirmadorWeb . FirmadorWebSvcClient ( ) )
{
// recuperar el documento usando el identificador de correlación
_documento = cliente . ObtenerDocumentoXIdCorrelacion (
IdCorrelacionFirmadorWeb , CodigoSistema ) ;
}
}
return _documento ;
}
}
private string _UrlFirmadorWeb ;
protected string UrlFirmadorWeb
{
get
{
if ( string . IsNullOrEmpty ( _UrlFirmadorWeb ) )
{
try
{
if ( IsPostBack )
_UrlFirmadorWeb = GenerarUrlFirmadorWeb ( documento . DocumentoID , ( string ) Session [ "Cedula" ] ) ;
}
catch ( Exception ex )
{
MensajeError ( "Se presentó un error con el servicio de firma digital." , ex ) ;
}
}
return _UrlFirmadorWeb ;
}
}
/// <summary>
/// Genera un url para la página del documento en el firmador web
/// Incluye en el url un token de seguridad para el firmador web
/// </summary>
/// <param name="idDocumento">Documento que se va a abrir en el firmador web</param>
/// <param name="cedula">Cédula del usuario actual</param>
/// <returns></returns>
private string GenerarUrlFirmadorWeb ( long idDocumento , string cedula )
{
return string . Format (
ConfigurationManager . AppSettings [ "UrlFirmadorWeb" ] ,
idDocumento ,
cedula ,
Server . UrlEncode (
Cipher (
string . Format ( "{0},{1}" , idDocumento , cedula )
)
)
) ;
}
/// <summary>
/// Encripta un valor usando la llave de encripción especificada en el parámetro LlaveEncripcionFW
/// Debe ser la misma llave que está configurada en el servicio
/// </summary>
/// <param name="value">Valor que se va a encriptar</param>
/// <returns>Valor encriptado</returns>
private static string Cipher ( string value )
{
string llaveEncripcionFW = ConfigurationManager . AppSettings [ "LlaveEncripcionFW" ] ;
Random rnd = new Random ( DateTime . Now . Millisecond ) ;
for ( int i = 0 ; i < 8 ; i + + )
value = "1234567890" [ rnd . Next ( 10 ) ] + value ;
value = "XYZ" + value ;
UTF7Encoding enc = new System . Text . UTF7Encoding ( ) ;
byte [ ] keyBytes = enc . GetBytes ( GetHash ( llaveEncripcionFW ) ) ;
TripleDES tdes = TripleDES . Create ( ) ;
byte [ ] desKey = new byte [ tdes . KeySize / 8 ] ;
for ( int i = 0 ; i < desKey . Length ; i + + )
desKey [ i ] = keyBytes [ i ] ;
tdes . Mode = CipherMode . CBC ;
tdes . Padding = PaddingMode . Zeros ;
byte [ ] plain = enc . GetBytes ( value ) ;
int cipheredSize = plain . Length / tdes . BlockSize ;
if ( plain . Length % tdes . BlockSize > 0 )
cipheredSize + + ;
cipheredSize * = tdes . BlockSize ;
byte [ ] ciphered = new byte [ cipheredSize ] ;
ICryptoTransform cry = tdes . CreateEncryptor ( desKey , desKey ) ;
byte [ ] input = new byte [ tdes . BlockSize ] ;
byte [ ] output = new byte [ tdes . BlockSize ] ;
int iPlain = 0 ;
int iCiphered = 0 ;
while ( iPlain < plain . Length )
{
int iInput = 0 ;
for ( ; iPlain < plain . Length & & iInput < input . Length ; iPlain + + )
input [ iInput + + ] = plain [ iPlain ] ;
for ( ; iInput < input . Length ; iInput + + )
input [ iInput ] = 0 ;
cry . TransformBlock ( input , 0 , input . Length , output , 0 ) ;
foreach ( Byte outputByte in output )
ciphered [ iCiphered + + ] = outputByte ;
}
return Convert . ToBase64String ( ciphered ) ;
}
public static string GetHash ( string value )
{
UTF7Encoding enc = new UTF7Encoding ( ) ;
byte [ ] bytes = enc . GetBytes ( value ) ;
return GetHash ( bytes ) ;
}
public static string GetHash ( byte [ ] value )
{
using ( SHA1Managed sha1 = new SHA1Managed ( ) )
{
sha1 . Initialize ( ) ;
byte [ ] hash = sha1 . ComputeHash ( value ) ;
return BitConverter . ToString ( hash ) . ToLower ( ) . Replace ( "-" , "" ) ;
}
}
#region variable firma digital
int nNumSolicitudTMP = 0 ;
int nPKReutilizaTMP = 0 ;
/// <summary>
/// Código del sistema cliente del servicio de firma digital. Cada sistema cliente debe usar un código diferente.
/// </summary>
private const string CodigoSistema = "SIGPC" ;
/// <summary>
/// Identificador del usuario definido para el sistema cliente
/// </summary>
private long IdUsuarioSistemaCliente
{
get
{
return long . Parse ( ConfigurationManager . AppSettings [ "IdUsuarioSistemaCliente" ] ) ;
}
}
#endregion
private void firmarDocumento ( string strNombre )
{
try
{
string strNombreArchivo = strNombre + "-AP.pdf" ;
//string sourcePath = ConfigurationManager.AppSettings["DocumentosMachote"].ToString() + @"\SIGPC_firma_electronica .odt";
//string targetPath = ConfigurationManager.AppSettings["DocumentosODT"].ToString() + @"\" + pstrDocumento + "_" + Session["SOLICITUD"].ToString() + "_.odt";
//string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\" + pstrDocumento + ".pdf";
string pdfPath = ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + strNombre + @"\" + strNombreArchivo ;
List < string > signatarios = new List < string > ( ) ;
List < string > emails = new List < string > ( ) ;
if ( ! string . IsNullOrEmpty ( ConfigurationManager . AppSettings [ "CedulaFirmaSIGPC" ] . ToString ( ) ) )
{
signatarios . Add ( ConfigurationManager . AppSettings [ "CedulaFirmaSIGPC" ] . ToString ( ) ) ;
//emails.Add("jmonged@aya.go.cr");
}
//obtener la constancia y ponerla en la carpeta compartida para el envio de correo
//se el registro de vision 2020
Documento oDoc = new Documento ( ) ;
string strAlmacenado = oDoc . Visor_Documento ( lblNumSolicitud . Text . Trim ( ) + "|" + "Criterio técnico AP" , lblNumSolicitud . Text . Trim ( ) , pdfPath , strNombreArchivo ) ;
if ( System . IO . File . Exists ( pdfPath ) )
{
byte [ ] bytes = System . IO . File . ReadAllBytes ( pdfPath ) ;
//verificar si el documento ya se habia firmado
using ( FirmadorWeb . FirmadorWebSvcClient cliente = new FirmadorWeb . FirmadorWebSvcClient ( ) )
{
long idDocumentoFirmado = cliente . CrearDocumento (
strNombreArchivo ,
"Firma de documentos" ,
bytes ,
IdUsuarioSistemaCliente ,
signatarios . ToArray ( ) ,
emails . ToArray ( ) ,
CodigoSistema ,
"01" ) ;
// cliente.PonerOpcionesDocumento(idDocumentoFirmado, CodigoSistema, false, false, false);
ObservacionesBL objObservacionesBL = new ObservacionesBL ( ) ;
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
objObservacionesBL . objobservacionesEL . OBSERVACIONES = "El usuario" + Session [ "NOMBREEMPLEADO" ] . ToString ( ) + " firmó la constancia " + strNombreArchivo ;
objObservacionesBL . objobservacionesEL . Fecha = DateTime . Now ;
objObservacionesBL . objobservacionesEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objObservacionesBL . objobservacionesEL . USUARIO = Session [ "LOGIN" ] . ToString ( ) ;
int nValorRetornado = objObservacionesBL . insertarObservaciones ( ) ;
documento . DocumentoID = idDocumentoFirmado ;
ViewState [ "DocumentoID" ] = idDocumentoFirmado ;
Session [ "Cedula" ] = ConfigurationManager . AppSettings [ "CedulaFirmaSIGPC" ] . ToString ( ) ;
EjecutarScript ( "AbrirFirmadorWeb();" ) ;
ViewState [ "MODO" ] = "Firmador" ;
ViewState [ "Documento" ] = strNombre ;
//FirmadorWeb.Documento documentoFirmado = cliente.ObtenerDocumento(
// idDocumentoFirmado,
// CodigoSistema);
//if (documentoFirmado.Firmas.Count() == 0)
//{
// documento.DocumentoID = idDocumentoFirmado;
// ViewState["DocumentoID"] = idDocumentoFirmado;
// Session["Cedula"] = ConfigurationManager.AppSettings["CedulaFirmaSIGPC"].ToString();
// EjecutarScript("AbrirFirmadorWeb();");
//}
//else
//{
// MensajeInformativo("El documento ya fue firmado.");
//}
GuardarEventoBitacora (
Session [ "LOGIN" ] . ToString ( ) ,
AccionBitacora . FIRMAR . ToString ( ) ,
MensajesBitacora . IngresarRegistro + ": Se firmo la constancia " + strNombreArchivo ,
"frwCriterioPA.aspx" ,
Convert . ToInt32 ( ConfigurationManager . AppSettings [ "pkApp" ] )
) ;
}
// System.IO.File.Copy(sourcePath, targetPath, true);
// string targetUrl = "'../../../DocumentosODT/" + pstrDocumento + "_" + Session["SOLICITUD"].ToString() + "_.odt'";
//// string targetUrl = "'../../../../DocumentosODT/" + pstrDocumento + ".odt'";
// if (System.IO.File.Exists(targetPath))
// {
// EjecutarScript("abrirOdt(" + targetUrl + ");");
// }
}
else
{
{ ClientScript . RegisterStartupScript ( this . GetType ( ) , "Error" , "<script>javascript: MensajeInformativo('No se ha generado el documento PDF." + pdfPath + "');</script>" ) ; }
}
}
catch ( Exception ex )
{
throw ex ;
}
}
private void obtenerDocumentoFirmado ( )
{
try
{
//string sourcePath = ConfigurationManager.AppSettings["DocumentosMachote"].ToString() + @"\SIGPC_firma_electronica .odt";
//string targetPath = ConfigurationManager.AppSettings["DocumentosODT"].ToString() + @"\" + pstrDocumento + "_" + Session["SOLICITUD"].ToString() + "_.odt";
//string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\" + ViewState["Documento"] + ".pdf";
string pdfPath = ConfigurationManager . AppSettings [ "DocumentosPDF" ] . ToString ( ) + @"\" + ViewState [ "Documento" ] + @"\" + ViewState [ "Documento" ] + "-AP.pdf" ;
if ( System . IO . File . Exists ( pdfPath ) )
{
byte [ ] bytes = System . IO . File . ReadAllBytes ( pdfPath ) ;
//verificar si el documento ya se habia firmado
using ( FirmadorWeb . FirmadorWebSvcClient cliente = new FirmadorWeb . FirmadorWebSvcClient ( ) )
{
byte [ ] contenido = cliente . ObtenerContenidoDocumento ( long . Parse ( ViewState [ "DocumentoID" ] . ToString ( ) ) , CodigoSistema ) ;
File . WriteAllBytes ( pdfPath , contenido ) ;
Documento oDoc = new Documento ( ) ;
if ( System . IO . File . Exists ( pdfPath ) )
{
byte [ ] bDoc = System . IO . File . ReadAllBytes ( pdfPath ) ;
//se carga el archivo y el registro a vision 2020
string strResultado = oDoc . Archivar_Documento ( ViewState [ "Documento" ] . ToString ( ) . Trim ( ) + "|" + "Criterio técnico AP" , ViewState [ "Documento" ] . ToString ( ) . Replace ( " " , "_" ) + "-AP.pdf" , bDoc ) ;
if ( strResultado = = string . Empty )
{
//File.Delete(pdfPath);
}
}
}
}
else
{
{ ClientScript . RegisterStartupScript ( this . GetType ( ) , "Error" , "<script>javascript: MensajeInformativo('No se pudo descargar el documento firmado por favor intente firmarlo de nuevo." + pdfPath + "');</script>" ) ; }
}
EjecutarScript ( "inicializaTab('grid','');" ) ;
}
catch ( Exception ex )
{
throw ex ;
}
}
/// <summary>
/// Asigna la actividad 1 Ingreso y asignacion de expedientes al usuario que esta realizando la tarea
/// </summary>
/// <returns></returns>
private int AsignaActividadesUsuarios ( ) //M0
{
ActividadesBL objActividadesBL = new ActividadesBL ( ) ;
ArrayList arlCondicionesFiltroBusqueda = new ArrayList ( ) ;
int nValorRetornado = 0 ;
try
{
string strModo = ViewState [ "MODO" ] . ToString ( ) ;
solicitudBL objresponsableActividadBL = new solicitudBL ( ) ;
objresponsableActividadBL . objresponsableActividadEL . FECHAASIGNACION = DateTime . Now ;
objresponsableActividadBL . objresponsableActividadEL . FECHARECIBIDO = DateTime . Now ;
objresponsableActividadBL . objresponsableActividadEL . FECHADEVOLUCION = DateTime . Now . AddDays ( - 1 ) ;
objresponsableActividadBL . objresponsableActividadEL . VALIDACIONFIRMA = false ;
objresponsableActividadBL . objresponsableActividadEL . FKACTIVIDAD = 5 ; //Confección del Criterio técnico de agua potable -- t_adm_actividad
objresponsableActividadBL . objresponsableActividadEL . FKUSUARIOXDEPENDENCIA = int . Parse ( ddlEncargadoRevision . SelectedValue ) ;
objresponsableActividadBL . objresponsableActividadEL . FKESTADO = 1 ; //asignada
objresponsableActividadBL . objresponsableActividadEL . ASTATE = true ;
{
objresponsableActividadBL . objresponsableActividadEL . FKPROGRAMACIONSOLICITUD = int . Parse ( Session [ "PKPROGRAMACION" ] . ToString ( ) ) ;
}
if ( strModo = = "Nuevo" )
{
solicitudBL objsolicitudBL = new solicitudBL ( ) ;
objsolicitudBL . objSolicitudEL . FKSOLICITUD = int . Parse ( Session [ "PKSOLICITUD" ] . ToString ( ) ) ;
objsolicitudBL . objSolicitudEL . FKUSUARIOXDEPENDENCIA = int . Parse ( ddlEncargadoRevision . SelectedValue ) ;
objsolicitudBL . objSolicitudEL . FKACTIVIDAD = 5 ; //Confección del Criterio técnico de agua potable -- t_adm_actividad
DataSet dsActividad = objsolicitudBL . dsListaActividadesEncargado ( arlCondicionesFiltroBusqueda ) ;
if ( dsActividad . Tables [ 0 ] . Rows . Count = = 0 )
{
nValorRetornado = objresponsableActividadBL . insertarAsignacionActividadEncargado ( ) ;
if ( nValorRetornado > 0 )
{
#region Envio de correo
//arlCondicionesFiltroBusqueda = new ArrayList();
//// condicionesBusqueda();
//objsolicitudBL = new solicitudBL();
//objsolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
//{
// DataSet dsEncargadosActividades = objsolicitudBL.dsListaActividadesEncargado(arlCondicionesFiltroBusqueda);
// if (dsEncargadosActividades.Tables.Count > 0)
// {
// nPkSolicitud = Convert.ToInt32(dsEncargadosActividades.Tables[0].Rows[0][1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
// }
//}
//AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
//objcorreoBL.objcorreoEL.FKNUMSOLICITUD = nPkSolicitud;
//// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
//objcorreoBL.objcorreoEL.ASUNTO = "Asignación de actividades - SIGPC";
//objcorreoBL.objcorreoEL.CONTENIDO = "Se ha finalizado la actividad de Ingreso y asignación de expedientes de la solicitud de disponibilidad " + Session["SOLICITUD"].ToString() + ", para ver mas detalles ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin> SIGPC</a>" + strPiePagina;
//objcorreoBL.objcorreoEL.FKUSUARIO = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
//objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
//nValorRetornado = objcorreoBL.insertarCorreo();
#endregion
}
//GuardarEventoBitacora(
//Session["LOGIN"].ToString(),
//AccionBitacora.INSERT.ToString(),
//MensajesBitacora.IngresarRegistro + ": Se ha finalizado la actividad Ingreso y asignación de expedientes",
//"frwNuevaSolicitud.aspx",
//Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
//);
}
else
{
MensajeAlerta ( "El usuario ya tiene asignada la actividad." ) ;
}
}
}
catch ( Exception ex )
{
throw ex ;
}
return nValorRetornado ;
}
private void BloquearIntros ( )
{
foreach ( Control c in divDatosInferiores . Controls )
{
if ( c is TextBox )
{
( ( TextBox ) c ) . Attributes . Add ( "onkeypress" , "javascript:if(event.keyCode==13){return false;}" ) ;
}
if ( c is RadioButtonList )
{
( ( RadioButtonList ) c ) . Attributes . Add ( "onkeypress" , "javascript:if(event.keyCode==13){return false;}" ) ;
}
foreach ( Control childc in c . Controls )
{
if ( childc is TextBox | | c is RadioButtonList )
{
( ( TextBox ) childc ) . Attributes . Add ( "onkeypress" , "javascript:if(event.keyCode==13){return false;}" ) ;
}
if ( childc is RadioButtonList )
{
( ( RadioButtonList ) childc ) . Attributes . Add ( "onkeypress" , "javascript:if(event.keyCode==13){return false;}" ) ;
}
}
}
}
#endregion
protected void grvListaVisitaSolicitud_RowDataBound ( object sender , GridViewRowEventArgs e )
{
try
{
GridViewRow selectedRow = e . Row ;
if ( e . Row . RowType = = DataControlRowType . DataRow )
{
e . Row . Cells [ 6 ] . ToolTip = "Ver formulario" ;
e . Row . Cells [ 7 ] . ToolTip = "Enviar a revisión" ;
e . Row . Cells [ 8 ] . ToolTip = "Firmar formulario" ;
e . Row . Cells [ 9 ] . ToolTip = "Ver documento" ;
//e.Row.Cells[7].Enabled = false;
//e.Row.Cells[7].Style.Add("opacity", "0.5");
//if (e.Row.Cells[5].Text == "Asignada" && Session["ACTIVIDADFINALIZADA"] == null)
//{
// e.Row.Cells[7].Enabled = true;
// e.Row.Cells[7].Style.Add("opacity", "1");
//}
//if (e.Row.Cells[10].Text != " " )
if ( e . Row . Cells [ 1 ] . Text . Trim ( ) = = strNumSolicitudTMP . Trim ( ) & & e . Row . Cells [ 5 ] . Text = = "Asignada" & & Session [ "ACTIVIDADFINALIZADA" ] = = null )
{
e . Row . Cells [ 7 ] . Enabled = true ;
e . Row . Cells [ 7 ] . Style . Add ( "opacity" , "1" ) ;
e . Row . Cells [ 8 ] . Enabled = true ;
e . Row . Cells [ 8 ] . Style . Add ( "opacity" , "1" ) ;
e . Row . Cells [ 9 ] . Enabled = true ;
e . Row . Cells [ 9 ] . Style . Add ( "opacity" , "1" ) ;
}
else
{
e . Row . Cells [ 7 ] . Enabled = false ;
e . Row . Cells [ 7 ] . Style . Add ( "opacity" , "0.5" ) ;
e . Row . Cells [ 8 ] . Enabled = false ;
e . Row . Cells [ 8 ] . Style . Add ( "opacity" , "0.5" ) ;
e . Row . Cells [ 9 ] . Enabled = false ;
e . Row . Cells [ 9 ] . Style . Add ( "opacity" , "0.5" ) ;
}
if ( Session [ "ACTIVIDADFINALIZADA" ] ! = null )
{
if ( e . Row . Cells [ 1 ] . Text . Trim ( ) = = strNumSolicitudTMP . Trim ( ) & & e . Row . Cells [ 5 ] . Text = = "Asignada" & & Session [ "ACTIVIDADFINALIZADA" ] . ToString ( ) = = "True" )
{
e . Row . Cells [ 9 ] . Enabled = true ;
e . Row . Cells [ 9 ] . Style . Add ( "opacity" , "1" ) ;
e . Row . Cells [ 7 ] . Enabled = false ;
e . Row . Cells [ 7 ] . Style . Add ( "opacity" , "0.5" ) ;
}
}
}
}
catch ( Exception ex )
{
throw ex ;
}
}
protected void btnGuardarPDF_Click ( object sender , EventArgs e )
{
ViewState [ "MODO" ] = string . Empty ;
ViewState [ "Documento" ] = string . Empty ;
}
}