2866 lines
No EOL
132 KiB
C#
2866 lines
No EOL
132 KiB
C#
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.Usuario;
|
|
using AyABL.APL;
|
|
using AyABL.Tran;
|
|
using AyABL.TRA;
|
|
using BASEBL;
|
|
|
|
using System.IO;
|
|
using FirmaDigitalAv;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
using AyABL.AUT.Encripta;
|
|
using System.Security.Cryptography;
|
|
using Ionic.Zip;
|
|
|
|
|
|
|
|
public partial class Forms_TRA_frwRequisitos : General
|
|
{
|
|
#region Inicializar Formulario (R0)
|
|
|
|
override protected void OnInit(EventArgs e) //M0
|
|
{
|
|
try
|
|
{
|
|
//Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
|
|
|
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);
|
|
|
|
cuwBusquedaList.Buscar += new _controlesusuario_Estandar_cuwBusquedaList.SearchEvent(Buscar);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R0M1", ex);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Variables (R1)
|
|
|
|
GridView grvListaDatosCantonalesTemp;
|
|
requisitoBL objRequisitoBL;
|
|
RequisitostmpBL objRequisitostmpBL;
|
|
documentoBL objdocumentoBL;
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|
int nTipoPropietario = 0;
|
|
int nTipoDisponibilidad = 0;
|
|
bool bPoseedor = false;
|
|
bool bSegregacion = false;
|
|
bool bDerechos = false;
|
|
bool bAPCR = false;
|
|
bool bAutorizadoLegal = false;
|
|
bool bPropietarioRegistral = false;
|
|
bool bConcesionario = false;
|
|
string strNaturalezaInmueble = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string strPKReutiliza = "0";
|
|
|
|
int intPKREQUISITO = 0;
|
|
string strNumSolicitudTMP = "0";
|
|
|
|
#region variables del estandar
|
|
string strPagina = string.Empty;
|
|
string strScript = string.Empty;
|
|
string strNombreCliente = string.Empty;
|
|
string strRutaDocAdjuntosRespuesta = string.Empty;
|
|
#endregion
|
|
/// <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"]);
|
|
}
|
|
}
|
|
|
|
|
|
ArrayList arlCondicionesFiltroBusqueda = new ArrayList();
|
|
|
|
#endregion
|
|
|
|
#region Eventos Formulario (R2)
|
|
|
|
protected void Page_Load(object sender, EventArgs e) //M0
|
|
{
|
|
try
|
|
{
|
|
//GlobalBL.InstanciaGlobalBL().strValorLlave = String.Empty;
|
|
//GlobalBL.InstanciaGlobalBL().sCantidadRegistros = String.Empty;
|
|
ScriptManager.GetCurrent(Page).RegisterPostBackControl(grvLista);
|
|
|
|
Page.Form.Attributes.Add("enctype", "multipart/form-data");
|
|
|
|
|
|
if (Session["SOLICITUD"] != null)
|
|
{
|
|
|
|
|
|
|
|
strNumSolicitudTMP = Session["PKSOLICITUD"].ToString();
|
|
pksolicitud.Value = Session["PKSOLICITUD"].ToString();
|
|
ViewState["FKSOLICITUD"] = strNumSolicitudTMP;
|
|
lblNumSolicitud.Text = Session["SOLICITUD"].ToString();
|
|
if(Session["FKREUTILIZA"].ToString() != string.Empty)
|
|
strPKReutiliza = Session["FKREUTILIZA"].ToString();
|
|
|
|
if (Request["d"] != null)
|
|
{
|
|
if (Request["d"].ToString() == "prorroga" || Request["d"].ToString() == "revision")
|
|
{
|
|
btnImcompleto.Enabled = true;
|
|
btnGuardar.Enabled = true;
|
|
btnSubirarchivo.Enabled = true;
|
|
}
|
|
}
|
|
if (Session["ESTADO"] != null)
|
|
{
|
|
if ( Session["ESTADO"].ToString() == "Finalizada")
|
|
{
|
|
btnImcompleto.Enabled = false;
|
|
btnGuardar.Enabled = false;
|
|
btnSubirarchivo.Enabled = false;
|
|
//grvLista.Enabled = false;
|
|
grvListaDatosRequisitos.Enabled = false;
|
|
}
|
|
}
|
|
identificaClientePropietarioSolicitud();
|
|
if ((!IsPostBack) && (Session.Count > 0))
|
|
{
|
|
Session["Pagina"] = "";
|
|
|
|
mostrarFilaTabla(1);
|
|
llenarRequisitos();
|
|
ComandosxMenu();
|
|
|
|
//verifica si estan todos los documentos y si se genero el documento completo
|
|
//bool bDocumentosCheckeados = true;
|
|
//foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
//{
|
|
|
|
// HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
// if (chkTemp.Checked == false)
|
|
// bDocumentosCheckeados = false;
|
|
|
|
|
|
//}
|
|
//if (bDocumentosCheckeados == true)
|
|
//{
|
|
// bool bDocumentoCompletoGenerado = false;
|
|
// foreach (GridViewRow row in grvLista.Rows)
|
|
// {
|
|
// if (row.Cells[1].Text.Contains("RequisitosCompleto"))
|
|
// {
|
|
// bDocumentoCompletoGenerado = true;
|
|
// btnImcompleto.Visible = false;
|
|
// }
|
|
// }
|
|
// if (bDocumentoCompletoGenerado == false)
|
|
// EjecutarScript("MensajeInformativoPersonalizado('Esta pendiente la generación del documento de requisitos completo por favor proceda a presionar el boton completo, para poder generar el documento y poder utilizar las opciones de firma y notificaón al usuario.');EscoderBoton();");
|
|
// else
|
|
// EjecutarScript("EscoderBoton();");//PERMITE QUE SOLO SE MUESTRE UN BOTON EN LA PÁGINA
|
|
|
|
//}
|
|
|
|
|
|
//{
|
|
|
|
// foreach (GridViewRow row in grvLista.Rows)
|
|
// {
|
|
// if (row.Cells[1].Text.Contains("RequisitosCompleto"))
|
|
// {
|
|
|
|
// btnImcompleto.Visible = false;
|
|
// }
|
|
// }
|
|
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
if (Session["Pagina"] == null)
|
|
{
|
|
//Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript:parent.closeIFrameRequisitos();</script>"); }
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
if (Session["Pagina"] == null)
|
|
{
|
|
//Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript:parent.closeIFrameRequisitos();</script>"); }
|
|
}
|
|
}
|
|
if (ViewState["MODO"] != null)
|
|
{
|
|
if (ViewState["MODO"].ToString() == "Firmador")
|
|
{
|
|
obtenerDocumentoFirmado();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R2M0", ex);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Eventos Controles Web (R3)
|
|
|
|
/// <summary>
|
|
/// Metodo que se utiliza para extraer información del registro de la base de datos y ser mostrado en el acordeon de Controles
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
|
|
protected void grvListaDatosRequisitos_RowCommand(object sender, GridViewCommandEventArgs e) //M0
|
|
{
|
|
try
|
|
{
|
|
if (e.CommandName == "editar")
|
|
{
|
|
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|
GridViewRow selectedRow = grvListaDatosRequisitos.Rows[i];
|
|
int intPkRequisito = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|
ViewState["intPkRequisito"] = intPkRequisito;
|
|
ViewState["MODO"] = "Modifica";
|
|
|
|
mostrarFilaTabla(2);
|
|
|
|
|
|
mostrarDatos(intPkRequisito);
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M0", ex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <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 grvListaDatosRequisitos_PageIndexChanging(object sender, GridViewPageEventArgs e) //M3
|
|
{
|
|
try
|
|
{
|
|
grvListaDatosRequisitos.PageIndex = e.NewPageIndex;
|
|
llenarGridView(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M3", ex);
|
|
}
|
|
}
|
|
|
|
///<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) //M4
|
|
{
|
|
try
|
|
{
|
|
llenarGridView(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M4" + MensajesAplicacion.RefrescarFallido.ToString(), ex);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Activa el evento del botón Buscar (binoculares)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
/// <summary>
|
|
|
|
protected void btnBuscar_Click(object sender, EventArgs e) //M5
|
|
{
|
|
try
|
|
{
|
|
//RequisitostmpBL objRequisitostmpBL = new RequisitostmpBL();
|
|
//objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
buscarGridView(null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M5" + MensajesAplicacion.BusquedaFallido.ToString(), ex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Activa el evento del boton guardar.1
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
|
|
protected void btnGuardar_Click(object sender, EventArgs e) //M14
|
|
{
|
|
try
|
|
{
|
|
string strRequisito = string.Empty;
|
|
bool blIncompleto = false;
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
|
|
|
|
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
if (chkTemp != null)
|
|
{
|
|
//Si el registro esta marcado guarde
|
|
if (chkTemp.Checked)
|
|
{
|
|
int intPKREQUISITO = Convert.ToInt32(row.Cells[2].Text);
|
|
|
|
//GuardarRequisitosIncompleto(intPKREQUISITO);
|
|
int nResultado = GuardarDatos(intPKREQUISITO, strRequisito);
|
|
if (nResultado == 0 && intPKREQUISITO != 20)
|
|
{
|
|
blIncompleto = true;
|
|
strRequisito += row.Cells[3].Text + "</br>";
|
|
}
|
|
|
|
|
|
}
|
|
//if (chkTemp.Checked == false)
|
|
// blIncompleto = true;
|
|
|
|
}
|
|
}
|
|
|
|
//if (blIncompleto)
|
|
//{
|
|
// //accion incompleto
|
|
|
|
// //MensajeAlerta("Falta agregar documento adjunto:" + strRequisito);
|
|
// EjecutarScript("MensajeInformativoCompleto('Falta agregar el (los) archivo (s) adjunto (s):</br>" + strRequisito + "');EscoderBoton();");
|
|
// llenarGridView(true);
|
|
//}
|
|
//else
|
|
//{
|
|
EnvioCorreo("cumplido");
|
|
GuardarDatosActividad("aprueba");
|
|
EjecutarScript("MensajeInformativoPersonalizado('Se completó el ingreso de requisitos por lo que se puede continuar con la programación de las actividades.');EscoderBoton();");
|
|
// EjecutarScript("window.parent.location.href = '../tra/frwProgramacionTrabajo.aspx?l=H/TvTKzD0EejKTW94E5Rjg==&u=J/U7O2rxqMtOqD6/hFMtDw==';");
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se completó el ingreso de requisitos por lo que se puede continuar con la programación de las actividades para la solicitud " + lblNumSolicitud.Text +".",
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
//EncriptaBL objEncripta = new EncriptaBL();
|
|
|
|
//Response.Redirect("~/forms/tra/frwProgramacionTrabajo.aspx?" + "l=" + objEncripta.Encryptar(Session["LOGIN"].ToString()) + "&u=" + objEncripta.Encryptar(Session["PKUSUARIO"].ToString()) );
|
|
//EncriptaBL objEncripta = new EncriptaBL();
|
|
|
|
//Response.Redirect("~/forms/tra/frwBusquedaSolicitud.aspx?" + "l=" + objEncripta.Encryptar(Session["LOGIN"].ToString()) + "&u=" + objEncripta.Encryptar(Session["PKUSUARIO"].ToString()) );
|
|
|
|
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M15", ex);
|
|
}
|
|
finally
|
|
{
|
|
EjecutarScript("EscoderBoton();");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Activa el evento del boton guardar Incompleto
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
|
|
protected void btnImcompleto_Click(object sender, EventArgs e) //M15
|
|
{
|
|
try
|
|
{
|
|
|
|
bool blIncompleto = false;
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
|
|
// recorre el grip
|
|
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREQUISITO = 0;
|
|
objRequisitostmpBL.eliminarRequisitos();
|
|
|
|
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
if (chkTemp != null)
|
|
{
|
|
//Si el registro esta marcado guarde
|
|
if (chkTemp.Checked)
|
|
{
|
|
int intPKREQUISITO = Convert.ToInt32(row.Cells[2].Text);
|
|
|
|
GuardarRequisitosIncompleto(intPKREQUISITO);
|
|
EjecutarScript("EscoderBoton();MensajeInformativo();"); //PERMITE QUE SOLO SE MUESTRE UN BOTON EN LA PÁGINA
|
|
// MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + MensajesAplicacion.GuardadoExitoso.ToString());
|
|
|
|
|
|
}
|
|
if (chkTemp.Checked == false)
|
|
blIncompleto = true;
|
|
}
|
|
|
|
}
|
|
|
|
if (blIncompleto)
|
|
{
|
|
//accion incompleto
|
|
EnvioCorreo("incumplido");
|
|
#region Envio de correo
|
|
|
|
//int nValorRetornado = 0;
|
|
|
|
//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 = "Requisitos incompletos - SIGPC";
|
|
//objcorreoBL.objcorreoEL.CONTENIDO = " Sr(a)(ita) : " + Session["SOLICITUD"].ToString() + " </BR></BR> Fecha: " + DateTime.Now.ToString() + " </BR> </BR> Según lo establecido en el artículo 18-19 del Reglamento para la Prestación de los Servicios de AyA para solicitar una disponibilidad de servicios de agua potable y alcantarillado sanitario, donde se estipula que el propietario del inmueble deberá cumplir con presentar los siguientes requisitos." + Session["SOLICITUD"].ToString() +
|
|
//"</BR></BR> Se deben dejar en blanco los requisitos para que sean marcados luego de impresos. Debido a lo expuesto anteriormente y en apego de la normativa, se le conceden diez días hábiles para completar los requisitos. Luego de transcurrido este plazo se procederá a archivar el trámite, según el artículo 264 de la Ley General para la Administración Pública." + strPiePagina;
|
|
//objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|
//objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
|
|
|
//nValorRetornado = objcorreoBL.insertarCorreo();
|
|
|
|
#endregion
|
|
|
|
EjecutarScript("EscoderBoton();");
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M15", ex);
|
|
}
|
|
}
|
|
|
|
protected void btnSubirarchivo_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool blIncompleto = false;
|
|
string strRequisito = string.Empty;
|
|
//if(txtdescripcion.Text != string.Empty)
|
|
//{
|
|
|
|
bool bSubirDocs = SubirDocumentos(" ");
|
|
if (bSubirDocs)
|
|
{
|
|
llenarRequisitos();
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
|
|
|
|
int intPKREQUISITO = Convert.ToInt32(row.Cells[2].Text);
|
|
|
|
//GuardarRequisitosIncompleto(intPKREQUISITO);
|
|
int nResultado = GuardarDatos(intPKREQUISITO, strRequisito);
|
|
if (nResultado == 0)
|
|
{
|
|
blIncompleto = true;
|
|
strRequisito += row.Cells[3].Text + "</br>";
|
|
//eliminar t_dis_documento para que no aparezca en el grid
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
chkTemp.Checked = true;
|
|
//EnvioCorreo("cumplido");
|
|
EjecutarScript("EscoderBoton();MensajeInformativo();");//PERMITE QUE SOLO SE MUESTRE UN BOTON EN LA PÁGINA
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se ha registrado el requisito " + nResultado.ToString() + " de la solicitud " + Session["SOLICITUD"].ToString(),
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
}
|
|
|
|
}
|
|
llenarGridView(true);
|
|
EjecutarScript("EscoderBoton();MensajeInformativo();");
|
|
}
|
|
else
|
|
{
|
|
MensajeAlerta("Se produjo un error al subir los documentos a Vision 2020. Presione el boton Adjuntar hasta que se finalice el proceso correctamente.");
|
|
}
|
|
//}
|
|
//else
|
|
//{
|
|
// MensajeAlerta("Debe agregar la descripción del requisito...");
|
|
//}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Se produjo un error en la operación", ex);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Metodos Personalizados (R4)
|
|
public void EnvioCorreo(string p_strAccion)
|
|
{
|
|
try
|
|
{
|
|
//se carga un dataset con los datos que se pondran en el machote
|
|
|
|
|
|
objSolicitudBL = new solicitudBL();
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(strNumSolicitudTMP);
|
|
DataSet ds = objSolicitudBL.dsListaSolicitud(null);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
if ((DateTime.Parse(DateTime.Now.ToShortDateString()) < DateTime.Parse(ds.Tables[0].Rows[0]["FECHAINSERTASOLICITUD"].ToString()).AddDays(14) && int.Parse(ds.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString()) != 2)
|
|
|| (DateTime.Parse(DateTime.Now.ToShortDateString()) < DateTime.Parse(ds.Tables[0].Rows[0]["FECHAMODIFICASOLICITUD"].ToString()).AddDays(14) && int.Parse(ds.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString()) == 2)
|
|
)
|
|
{
|
|
|
|
#region generar documento cumplio pdf
|
|
if (p_strAccion == "incumplido")
|
|
{
|
|
CrearDocumentoPDFIncompleto(ds);
|
|
}
|
|
if (p_strAccion == "cumplido")
|
|
{
|
|
CrearDocumentoPDFCompleto(ds);
|
|
|
|
}
|
|
|
|
#endregion
|
|
llenarRequisitos();
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
if (DateTime.Now > DateTime.Parse(ds.Tables[0].Rows[0]["FECHAINSERTASOLICITUD"].ToString()).AddDays(10))
|
|
{
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONESTADOPROGRAMACION"].ToString() == "Bloqueada")
|
|
{
|
|
CrearDocumentoPDFIncompleto(ds);
|
|
|
|
{
|
|
string strNombreAdjunto = "RequisitosIncompleto_" + DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + Session["SOLICITUD"].ToString();
|
|
string strPdf = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text + @"\DocumentosREQ\" + strNombreAdjunto;
|
|
strRutaDocAdjuntosRespuesta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text + @"\" + strNombreAdjunto;
|
|
string strRutaCopiarPdf = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text + @"\DocumentosREQ\";
|
|
|
|
//System.IO.File.Copy(strPdf, strRutaDocAdjuntosRespuesta, true);
|
|
if (System.IO.File.Exists(strPdf))
|
|
{
|
|
|
|
System.IO.File.Copy(strPdf, strRutaDocAdjuntosRespuesta, true);
|
|
}
|
|
else
|
|
{
|
|
|
|
Documento oDoc = new Documento();
|
|
|
|
//consulta la ruta en la que se encuentra ubicado la copia del archivo a consultar
|
|
strRutaCopiarPdf = oDoc.Visor_Documento(lblNumSolicitud.Text.Trim() + "|Requisito", lblNumSolicitud.Text.Trim(), strRutaDocAdjuntosRespuesta, strNombreAdjunto + ".pdf");
|
|
}
|
|
|
|
|
|
if (strRutaCopiarPdf != string.Empty && strRutaCopiarPdf != "No existe")
|
|
{
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
string strRutaDocumentos = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text;
|
|
int nNumeroSolicitudCFIA = 0;
|
|
//crear documento zip con los archivos adjuntos
|
|
|
|
ZipFile zip = new ZipFile();
|
|
zip.AddFile(strRutaDocAdjuntosRespuesta, "");
|
|
|
|
string strRutaDocZip = strRutaDocumentos + @"\" + lblNumSolicitud.Text + ".zip";
|
|
if (!Directory.Exists(strRutaDocumentos))
|
|
Directory.CreateDirectory(strRutaDocumentos);
|
|
zip.Save(strRutaDocZip);
|
|
|
|
|
|
|
|
|
|
|
|
//enviar notificacion a CFIA con el servicio de respuesta
|
|
if (File.Exists(strRutaDocZip) && ds.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString() != "N/A" && ds.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString() != string.Empty)
|
|
{
|
|
nNumeroSolicitudCFIA = int.Parse(ds.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString());
|
|
|
|
APCR_WCF_Respuesta.ServicioClient wcfCfia = new APCR_WCF_Respuesta.ServicioClient();
|
|
APCR_WCF_Respuesta.Respuestas respuestaAPCR;
|
|
byte[] bRespuestaZip = System.IO.File.ReadAllBytes(strRutaDocZip);
|
|
respuestaAPCR = wcfCfia.RespuestaSolicitud(nNumeroSolicitudCFIA, "Presentación de requisitos incompleta", 2, Session["LOGIN"].ToString(), bRespuestaZip, 3, ConfigurationManager.AppSettings["LLAVEAPCR"].ToString());
|
|
if (respuestaAPCR.Respuesta == true)
|
|
{
|
|
EjecutarScript("MensajeInformativoPersonalizado('Se ha enviado la notificación a APCR para que ellos notifiquen al cliente registrado.');");
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se ha enviado la notificación a APCR para que ellos notifiquen al cliente registrado, referente a la solcitud " + lblNumSolicitud.Text,
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
}
|
|
else
|
|
{
|
|
|
|
MensajeAlerta("Se presento el siguiente problema a la hora de notificar al CFIA: " + respuestaAPCR.DescripcionError);
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se presento el siguiente problema a la hora de notificar al CFIA: " + respuestaAPCR.DescripcionError + ", de la solicitud " + lblNumSolicitud.Text,
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (strRutaCopiarPdf != string.Empty)
|
|
{
|
|
string strAsunto = "Presentación de requisitos incompleta";
|
|
string strAccion = "incumplido";
|
|
|
|
|
|
string strCorreo = obtenerCorreo();
|
|
if (strCorreo != string.Empty)
|
|
{
|
|
#region Envio de correo externo
|
|
System.Drawing.Image img = System.Drawing.Image.FromFile(ConfigurationManager.AppSettings["Imagenes"].ToString());
|
|
string imgStr = imageToByteArray(img);
|
|
|
|
string p_strDocHtml = "<img alt='' src='cid:logoAyA.png' style='width: 100px; height: 82px;' />";
|
|
|
|
string strImage64Bits = "data:image/jpg;base64," + imgStr;
|
|
|
|
p_strDocHtml = p_strDocHtml.Replace("/logoAyA.png", strImage64Bits);
|
|
|
|
string strCuerpo = p_strDocHtml + "<div style='text-align:justify'></BR>Estimado " + strNombreCliente + "</BR></BR>El Instituto Costarricense de Acueductos y Alcantarillados le comunica que su trámite de Disponibilidad de Servicios ha " + strAccion + " con los requisitos solicitados en los Art 18-19 del Reglamento de Prestación de Servicios de AyA.</BR>Estamos para servirle, en nuestro horario de atención de 7:00 AM a 3:00 PM en las oficinas de AyA, si tiene alguna duda por favor contáctenos al teléfono " + Session["TELEFONODEPENDENCIA"].ToString() + " o al 800-737-6783.</BR></BR>" + "</BR></BR>Este es un mensaje generado de forma automática a la dirección de correo electrónico que usted ha suministrado por la cual NO DEBE SER RESPONDIDO. Base legal para esta alerta: Artículo 239 y siguientes de la Ley General de la Administración Pública.</div>";
|
|
|
|
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.correoExternoBL objcorreoExternoBL = new AyABL.TRA.correoExternoBL();
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = strCorreo;
|
|
objcorreoExternoBL.objcorreoExternoEL.p_copy = Session["LOGIN"].ToString() + "@aya.go.cr";
|
|
objcorreoExternoBL.objcorreoExternoEL.p_subject = strAsunto;
|
|
objcorreoExternoBL.objcorreoExternoEL.p_body = strCuerpo + strPiePagina;
|
|
objcorreoExternoBL.objcorreoExternoEL.P_PRIORIDAD = "High";
|
|
objcorreoExternoBL.objcorreoExternoEL.p_format = "html";
|
|
|
|
//#region adjuntar constancias
|
|
if (strRutaDocAdjuntosRespuesta != string.Empty)
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = strRutaDocAdjuntosRespuesta + ";" + ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\logoAyA.png;";
|
|
else
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = string.Empty;
|
|
|
|
int nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se envió el correo de notificación de requisitos incompletos al correo " + strCorreo + ", referente a la solcitud " + lblNumSolicitud.Text,
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
|
|
|
|
//MensajeInformativo("Se ha enviado la notificación al cliente.");
|
|
#endregion
|
|
}
|
|
|
|
EjecutarScript("MensajeInformativoPersonalizado('Se ha enviado la notificación al cliente registrado.');EscoderBoton();");
|
|
}
|
|
else
|
|
{
|
|
MensajeAlerta("No se pudo encontrar el archivo solicitado en Vision 2020");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//MensajeAlerta("El plazo para adjuntar requisitos se venció. Debe generar una nueva solicitud.");
|
|
|
|
|
|
deBajaBL objDeBajaSolicitudBL = new deBajaBL();
|
|
objDeBajaSolicitudBL.objdeBajaEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
objDeBajaSolicitudBL.objdeBajaEL.FECHA = DateTime.Now;
|
|
objDeBajaSolicitudBL.objdeBajaEL.USUARIO = Session["LOGIN"].ToString();
|
|
objDeBajaSolicitudBL.objdeBajaEL.MOTIVO = "El plazo para adjuntar requisitos se venció. Debe generar una nueva solicitud.";
|
|
|
|
int nValorRetornadoDebaja = objDeBajaSolicitudBL.insertarDeBajaSolicitud();
|
|
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se ha cancelado la solicitud " + lblNumSolicitud.Text + ". El plazo para adjuntar requisitos se venció. Debe generar una nueva solicitud.",
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
|
|
//modifica el estado de la solicitud
|
|
programacionsolicitudBL objprogramacionsolicitudBL = new programacionsolicitudBL();
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKESTADOPROGRAMACION = 5;//cancelada
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|
int nPKProgramacionSolicitud = objprogramacionsolicitudBL.modificarprogramacionsolicitud();
|
|
}
|
|
else
|
|
{
|
|
EjecutarScript("EscoderBoton();MensajeVencio();"); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private int CrearDocumentoPDFCompleto(DataSet ds)
|
|
{
|
|
int nResult = 0;
|
|
/*
|
|
* 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
|
|
{
|
|
int nFkTipoDisponibilidad = int.Parse(ds.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString());
|
|
//string strListaRequisitos = verificarRequisitos();
|
|
//if (strListaRequisitos == string.Empty)
|
|
{
|
|
int counter = 0;
|
|
string line;
|
|
string p_strDocHtml = "";
|
|
// Read the file and display it line by line.
|
|
string ruta = Server.MapPath(@"~/ASPPDF/notificacionrequisito/notificacionRequisitoCompleta.asp");
|
|
System.IO.StreamReader file =
|
|
new System.IO.StreamReader(ruta);
|
|
while ((line = file.ReadLine()) != null)
|
|
{
|
|
p_strDocHtml += line;
|
|
counter++;
|
|
}
|
|
|
|
file.Close();
|
|
|
|
|
|
|
|
string strRegion = ds.Tables[0].Rows[0]["DESCRIPCIONREGION"].ToString();
|
|
string strApartado = ds.Tables[0].Rows[0]["APARTADODEPENDENCIASIGDD"].ToString();
|
|
string strTelefonoOficina = "800-REPORTE(800-7376783)";// ds.Tables[0].Rows[0]["TELEFONODEPENDENCIASIGDD"].ToString();
|
|
//string strFaxOficina = ds.Tables[0].Rows[0]["FAXDEPENDENCIASIGDD"].ToString();
|
|
string strFecha = DateTime.Now.ToShortDateString();
|
|
|
|
//Requerimiento 3
|
|
string strSolicitante = "";
|
|
//string strSolicitante = ds.Tables[0].Rows[0]["NOMBRECOMPLETOSOLICITANTE"].ToString().ToLower();
|
|
//strSolicitante = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strSolicitante);
|
|
string[] subs = ds.Tables[0].Rows[0]["NOMBRECLIENTESOLICITUD"].ToString().Split(',');
|
|
foreach (var item in subs)
|
|
{
|
|
strSolicitante += item + "<br>";
|
|
}
|
|
//Requerimiento 3
|
|
|
|
//Session["NOMBREEMPLEADO"]
|
|
string strResponsable = Session["NOMBREEMPLEADO"].ToString().ToLower();
|
|
strResponsable = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strResponsable);
|
|
string strFechaIngreso = ds.Tables[0].Rows[0]["FECHAINSERTASOLICITUD"].ToString();
|
|
|
|
string strTipoSolicitud = string.Empty;
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Agua potable")
|
|
strTipoSolicitud = "agua potable";
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Alcantarillado sanitario")
|
|
strTipoSolicitud = "alcantarillado sanitario";
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Ambos")
|
|
strTipoSolicitud = "agua potable y alcantarillado sanitario";
|
|
string strNumeroFolio = ds.Tables[0].Rows[0]["NUMEROFOLIO"].ToString();
|
|
string strNumeroPlanoCatastro = ds.Tables[0].Rows[0]["NUMEROTERRENO"].ToString();
|
|
|
|
string strDependencia = ds.Tables[0].Rows[0]["DESCRIPCIONDEPENDENCIASIGDD"].ToString();
|
|
string strHora = DateTime.Now.TimeOfDay.ToString();
|
|
|
|
//se remplazan los datos del machote
|
|
p_strDocHtml = p_strDocHtml.Replace("strDependencia", strDependencia);
|
|
|
|
//se remplazan los datos del machote
|
|
p_strDocHtml = p_strDocHtml.Replace("strRegion", strRegion);
|
|
p_strDocHtml = p_strDocHtml.Replace("strApartado", strApartado);
|
|
p_strDocHtml = p_strDocHtml.Replace("strTelefonoOficina", strTelefonoOficina);
|
|
//p_strDocHtml = p_strDocHtml.Replace("strFaxOficina", strFaxOficina);
|
|
p_strDocHtml = p_strDocHtml.Replace("strFecha", strFecha);
|
|
p_strDocHtml = p_strDocHtml.Replace("strHora", strHora);
|
|
p_strDocHtml = p_strDocHtml.Replace("strCliente", strSolicitante);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumSolicitud", Session["SOLICITUD"].ToString());
|
|
p_strDocHtml = p_strDocHtml.Replace("strNombreResponsable", strResponsable);
|
|
p_strDocHtml = p_strDocHtml.Replace("strFecRecibido", strFechaIngreso);
|
|
p_strDocHtml = p_strDocHtml.Replace("strTipoSolicitud", strTipoSolicitud);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumeroFolio", strNumeroFolio);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumeroPlanoCatastro", strNumeroPlanoCatastro);
|
|
|
|
|
|
|
|
ASPDF.Service1Client clsGenerarDocumento = new ASPDF.Service1Client();
|
|
string strResult = clsGenerarDocumento.Generar_Documento_PDF(p_strDocHtml, "RequisitosCompleto_" + DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + Session["SOLICITUD"].ToString());
|
|
|
|
string sourcePath = strResult;
|
|
string strNombreArchivo = System.IO.Path.GetFileName(strResult);
|
|
|
|
|
|
// string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreArchivo;
|
|
String pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\";
|
|
if (System.IO.File.Exists(strResult))
|
|
{
|
|
if (!System.IO.Directory.Exists(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ"))
|
|
System.IO.Directory.CreateDirectory(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ");
|
|
|
|
System.IO.File.Copy(strResult, pdfPath + @"\" + strNombreArchivo, true);
|
|
System.IO.File.Copy(strResult, ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNombreArchivo, true);
|
|
|
|
//Documento oDoc = new Documento();
|
|
////se transaforma el archivo a un arreglo de bytes
|
|
//byte[] bDoc = System.IO.File.ReadAllBytes(pdfPath + @"\" + strNombreArchivo.Replace(" ", "_"));
|
|
//string nombreAdjunto = pdfPath + @"\" + strNombreArchivo.Replace(".pdf", "");
|
|
|
|
////se carga el archivo y el registro a vision 2020
|
|
//string strResultado = oDoc.Archivar_Documento(lblNumSolicitud.Text.Trim() + "|" + "Requisito", strNombreArchivo.Replace(" ", "_"), bDoc);
|
|
|
|
//if (strResultado == string.Empty)
|
|
//{
|
|
|
|
// File.Delete(nombreAdjunto + ".pdf");
|
|
|
|
//}
|
|
|
|
AyABL.TRA.documentoBL objdocumentoBL = new AyABL.TRA.documentoBL();
|
|
objdocumentoBL.objdocumentoEL.Descripcion = "Respuesta al cliente de documentos incompletos";
|
|
objdocumentoBL.objdocumentoEL.NOMBRE = strNombreArchivo;
|
|
objdocumentoBL.objdocumentoEL.FKREQUISITO = 20;//e) Completar y acatar los requerimientos indicados en la fórmula vigente.
|
|
objdocumentoBL.objdocumentoEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
|
|
int nPKDocumento = objdocumentoBL.insertarDocumento();
|
|
|
|
//modifica el estado de la solicitud
|
|
programacionsolicitudBL objprogramacionsolicitudBL = new programacionsolicitudBL();
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKESTADOPROGRAMACION = 1;//asignada
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|
int nPKProgramacionSolicitud = objprogramacionsolicitudBL.modificarprogramacionsolicitud();
|
|
|
|
strRutaDocAdjuntosRespuesta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNombreArchivo;
|
|
}
|
|
nResult = 1;
|
|
}
|
|
//else
|
|
//{
|
|
// MensajeAlerta("Falta adjuntar los siguientes requisitos: " + strListaRequisitos);
|
|
//}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
nResult = 0;
|
|
throw ex;
|
|
|
|
}
|
|
return nResult;
|
|
}
|
|
|
|
private int CrearDocumentoPDFIncompleto(DataSet ds)
|
|
{
|
|
int nResult = 0;
|
|
/*
|
|
* 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
|
|
{
|
|
int counter = 0;
|
|
string line;
|
|
string p_strDocHtml = "";
|
|
// Read the file and display it line by line.
|
|
string ruta = Server.MapPath(@"~/ASPPDF/notificacionrequisito/notificacionRequisitoIncompleta.asp");
|
|
System.IO.StreamReader file =
|
|
new System.IO.StreamReader(ruta);
|
|
while ((line = file.ReadLine()) != null)
|
|
{
|
|
p_strDocHtml += line;
|
|
counter++;
|
|
}
|
|
|
|
file.Close();
|
|
|
|
//se carga un dataset con los datos que se pondran en el machote
|
|
|
|
|
|
|
|
string strRegion = ds.Tables[0].Rows[0]["DESCRIPCIONREGION"].ToString();
|
|
string strApartado = ds.Tables[0].Rows[0]["APARTADODEPENDENCIASIGDD"].ToString();
|
|
string strTelefonoOficina = "800-REPORTE(800-7376783)";// ds.Tables[0].Rows[0]["TELEFONODEPENDENCIASIGDD"].ToString();
|
|
//string strFaxOficina = ds.Tables[0].Rows[0]["FAXDEPENDENCIASIGDD"].ToString();
|
|
string strFecha = DateTime.Now.ToShortDateString();
|
|
|
|
//Requerimiento 3
|
|
string strSolicitante = "";
|
|
//string strSolicitante = ds.Tables[0].Rows[0]["NOMBRECOMPLETOSOLICITANTE"].ToString().ToLower();
|
|
//strSolicitante = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strSolicitante);
|
|
string[] subs = ds.Tables[0].Rows[0]["NOMBRECLIENTESOLICITUD"].ToString().Split(',');
|
|
foreach (var item in subs)
|
|
{
|
|
strSolicitante += item + "<br>";
|
|
}
|
|
//Requerimiento 3
|
|
|
|
|
|
|
|
//Session["NOMBREEMPLEADO"]
|
|
string strResponsable = Session["NOMBREEMPLEADO"].ToString().ToLower();
|
|
strResponsable = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strResponsable);
|
|
string strFechaIngreso = ds.Tables[0].Rows[0]["FECHAINSERTASOLICITUD"].ToString();
|
|
|
|
string strTipoSolicitud = string.Empty;
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Agua potable")
|
|
strTipoSolicitud = "agua potable";
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Alcantarillado sanitario")
|
|
strTipoSolicitud = "alcantarillado sanitario";
|
|
if (ds.Tables[0].Rows[0]["DESCRIPCIONTIPOINSPECCION"].ToString() == "Ambos")
|
|
strTipoSolicitud = "agua potable y alcantarillado sanitario";
|
|
string strNumeroFolio = ds.Tables[0].Rows[0]["NUMEROFOLIO"].ToString();
|
|
string strNumeroPlanoCatastro = ds.Tables[0].Rows[0]["NUMEROTERRENO"].ToString();
|
|
string strHora = DateTime.Now.TimeOfDay.ToString();
|
|
string strDependencia = ds.Tables[0].Rows[0]["DESCRIPCIONDEPENDENCIASIGDD"].ToString();
|
|
|
|
|
|
//se remplazan los datos del machote
|
|
p_strDocHtml = p_strDocHtml.Replace("strDependencia", strDependencia);
|
|
p_strDocHtml = p_strDocHtml.Replace("strRegion", strRegion);
|
|
p_strDocHtml = p_strDocHtml.Replace("strApartado", strApartado);
|
|
p_strDocHtml = p_strDocHtml.Replace("strTelefonoOficina", strTelefonoOficina);
|
|
//p_strDocHtml = p_strDocHtml.Replace("strFaxOficina", strFaxOficina);
|
|
p_strDocHtml = p_strDocHtml.Replace("strFecha", strFecha);
|
|
p_strDocHtml = p_strDocHtml.Replace("strHora", strHora);
|
|
p_strDocHtml = p_strDocHtml.Replace("strCliente", strSolicitante);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumSolicitud", Session["SOLICITUD"].ToString());
|
|
p_strDocHtml = p_strDocHtml.Replace("strNombreResponsable", strResponsable);
|
|
p_strDocHtml = p_strDocHtml.Replace("strFechaRecibido", strFechaIngreso);
|
|
p_strDocHtml = p_strDocHtml.Replace("strTipoSolicitud", strTipoSolicitud);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumeroFolio", strNumeroFolio);
|
|
p_strDocHtml = p_strDocHtml.Replace("strNumeroPlanoCatastro", strNumeroPlanoCatastro);
|
|
|
|
string strListaRequisitos = verificarRequisitos();
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
if (chkTemp != null)
|
|
{
|
|
if (chkTemp.Checked == false)
|
|
strListaRequisitos += "<tr><td> " + row.Cells[3].Text + "<tr><td> ";
|
|
}
|
|
|
|
}
|
|
|
|
p_strDocHtml = p_strDocHtml.Replace("strListaRequisitos", strListaRequisitos);
|
|
ASPDF.Service1Client clsGenerarDocumento = new ASPDF.Service1Client();
|
|
string strResult = clsGenerarDocumento.Generar_Documento_PDF(p_strDocHtml, "RequisitosIncompleto_" + DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + Session["SOLICITUD"].ToString());
|
|
|
|
string sourcePath = strResult;
|
|
string strNombreArchivo = System.IO.Path.GetFileName(strResult);
|
|
|
|
|
|
//string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreArchivo;
|
|
String pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\";
|
|
if (System.IO.File.Exists(strResult))
|
|
{
|
|
if (!System.IO.Directory.Exists(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ"))
|
|
System.IO.Directory.CreateDirectory(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ");
|
|
|
|
System.IO.File.Copy(strResult, pdfPath + @"\" + strNombreArchivo, true);
|
|
System.IO.File.Copy(strResult, ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNombreArchivo, true);
|
|
|
|
Documento oDoc = new Documento();
|
|
//se transaforma el archivo a un arreglo de bytes
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(pdfPath + @"\" + strNombreArchivo.Replace(" ", "_"));
|
|
string nombreAdjunto = pdfPath + @"\" + strNombreArchivo.Replace(".pdf", "");
|
|
|
|
//se carga el archivo y el registro a vision 2020
|
|
string strResultado = oDoc.Archivar_Documento(lblNumSolicitud.Text.Trim() + "|" + "Requisito", strNombreArchivo.Replace(" ", "_"), bDoc);
|
|
|
|
if (strResultado == string.Empty)
|
|
{
|
|
|
|
File.Delete(nombreAdjunto + ".pdf");
|
|
|
|
}
|
|
|
|
AyABL.TRA.documentoBL objdocumentoBL = new AyABL.TRA.documentoBL();
|
|
objdocumentoBL.objdocumentoEL.Descripcion = "Respuesta al cliente de documentos incompletos";
|
|
objdocumentoBL.objdocumentoEL.NOMBRE = strNombreArchivo;
|
|
objdocumentoBL.objdocumentoEL.FKREQUISITO = 20;//e) Completar y acatar los requerimientos indicados en la fórmula vigente.
|
|
objdocumentoBL.objdocumentoEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
|
|
int nPKDocumento = objdocumentoBL.insertarDocumento();
|
|
|
|
//programacionsolicitudBL objprogramacionsolicitudBL = new programacionsolicitudBL();
|
|
//objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKESTADOPROGRAMACION = 6;//bloqueada
|
|
//objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
//objprogramacionsolicitudBL.objprogramacionsolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|
//int nPKProgramacionSolicitud = objprogramacionsolicitudBL.modificarprogramacionsolicitud();
|
|
|
|
|
|
strRutaDocAdjuntosRespuesta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNombreArchivo;
|
|
}
|
|
nResult = 1;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
nResult = 0;
|
|
throw ex;
|
|
|
|
}
|
|
return nResult;
|
|
}
|
|
public string verificarRequisitos()
|
|
{
|
|
string strListaRequisitos = string.Empty;
|
|
try
|
|
{
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
//if (int.Parse(row.Cells[2].Text) != 20)
|
|
{
|
|
//objRequisitostmpBL = new RequisitostmpBL();
|
|
//objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
//objRequisitostmpBL.objRequisitostmpEL.FKREQUISITO = int.Parse(row.Cells[2].Text);
|
|
//DataSet ds = objRequisitostmpBL.dsListaAdjuntos();
|
|
|
|
//if (ds.Tables[0].Rows.Count == 0)
|
|
if (chkTemp.Checked == true)
|
|
{
|
|
strListaRequisitos += "<tr><td> " + row.Cells[3].Text + "<tr><td> ";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return strListaRequisitos;
|
|
}
|
|
public string obtenerCorreo()
|
|
{
|
|
string strCorreo = string.Empty;
|
|
try
|
|
{
|
|
|
|
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(strNumSolicitudTMP);
|
|
|
|
DataSet dsSolicitud = objSolicitudBL.dsExisteSolicitud(null);
|
|
|
|
if (dsSolicitud.Tables[0].Rows.Count > 0)
|
|
{
|
|
|
|
//nConsecutivoTmp = objSolicitudBL.objSolicitudEL.NUMSOLICITUD;
|
|
|
|
strCorreo = dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICOSOLICITUD"].ToString() + ";" + dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICO2SOLICITUD"].ToString();
|
|
strNombreCliente = dsSolicitud.Tables[0].Rows[0]["NOMBRECOMPLETOSOLICITANTE"].ToString();
|
|
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return strCorreo;
|
|
}
|
|
public string imageToByteArray(System.Drawing.Image imageIn)
|
|
{
|
|
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
|
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
|
|
byte[] imgByte = ms.ToArray();
|
|
// Convert the binary input into Base64 UUEncoded output.
|
|
string base64String;
|
|
|
|
base64String = System.Convert.ToBase64String(imgByte, 0, imgByte.Length);
|
|
|
|
|
|
return base64String;
|
|
|
|
}
|
|
/// <summary>
|
|
/// Oculta las filas que lo requieran
|
|
/// </summary>
|
|
/// <param name="p_intFila"></param>
|
|
private void mostrarFilaTabla(int p_intFila) //M0
|
|
{
|
|
try
|
|
{
|
|
divDatosSuperiores.Visible = false;
|
|
divDatosMedios.Visible = false;
|
|
|
|
|
|
switch (p_intFila)
|
|
{
|
|
case 1:
|
|
llenarGridView(true);
|
|
divDatosSuperiores.Visible = true;
|
|
break;
|
|
case 2:
|
|
llenarGridView(true);
|
|
divDatosMedios.Visible = true;
|
|
break;
|
|
case 3:
|
|
llenarGridView(true);
|
|
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo que se utiliza para contruir el Grid al inicio de la pantalla
|
|
/// </summary>
|
|
private void construirGridView() //M1
|
|
{
|
|
try
|
|
{
|
|
grvListaDatosCantonalesTemp = (GridView)tdLista.FindControl("grvListaDatosRequisitos");
|
|
|
|
GridViewBoundField bdfPkRequisito = new GridViewBoundField("PKREQUISITO", "PK", false, false, true);
|
|
GridViewBoundField bdfDescripcion = new GridViewBoundField("DESCRIPCIONREQUISITO", "Requisito", false, false, true);
|
|
GridViewBoundField bdfDocSoporte = new GridViewBoundField("DOCSOPORTEREQUISITO", "Doc Soporte", false, false, false);
|
|
GridViewBoundField bdfFecha = new GridViewBoundField("FECHACREAREQUISITO", "Fecha", false, false, false);
|
|
GridViewBoundField bdfUsuario = new GridViewBoundField("USUARIOCREAREQUISITO", "Usuario", false, false, false);
|
|
|
|
|
|
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfPkRequisito);
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfDescripcion);
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfDocSoporte);
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfFecha);
|
|
grvListaDatosCantonalesTemp.Columns.Add(bdfUsuario);
|
|
//grvListaDatosCantonalesTemp.Columns.Add(bdfActivo);
|
|
|
|
grvListaDatosCantonalesTemp.Columns[0].ItemStyle.Width = 10;
|
|
grvListaDatosCantonalesTemp.Columns[1].ItemStyle.Width = 30;
|
|
grvListaDatosCantonalesTemp.Columns[2].ItemStyle.Width = 30;
|
|
grvListaDatosCantonalesTemp.Columns[3].ItemStyle.Width = 500;
|
|
grvListaDatosCantonalesTemp.Columns[4].ItemStyle.Width = 425;
|
|
|
|
|
|
|
|
cuwBusquedaList.LlenarCHKLBusqueda(grvListaDatosCantonalesTemp);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Metodo que se encarga de agregar el filtro de busqueda seleccionado por el usuario
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private void condicionesBusqueda() //M2
|
|
{
|
|
AyABL.AyABL objBL = new AyABL.AyABL();
|
|
CondicionDAL condicion;
|
|
DateTime dteFechaInicio = new DateTime();
|
|
DateTime dteFechaFin = new DateTime();
|
|
ListItem li = new ListItem();
|
|
string p_parametros;
|
|
p_parametros = this.cuwBusquedaList.getValorBusqueda();
|
|
try
|
|
{
|
|
if (p_parametros != "")
|
|
{
|
|
//aqui se construye el listItem con los datos que vienen del control en formato {valor : texto , valor : texto}
|
|
char[] separadorTuplas = { ',' };
|
|
char[] separadorValores = { ':' };
|
|
string[] arrayTupla = p_parametros.Split(separadorTuplas);
|
|
|
|
for (int i = 0; i <= (arrayTupla.Length - 1); i++)
|
|
{
|
|
if (arrayTupla[i].ToString() != "")
|
|
{
|
|
string[] arrayValores = arrayTupla[i].ToString().Split(separadorValores);
|
|
li = new ListItem(arrayValores[1], arrayValores[0]);
|
|
|
|
if (li.Value.Contains("FECHA") && li.Text != string.Empty)
|
|
{
|
|
|
|
if (li.Value.Contains("INICIO"))
|
|
{
|
|
dteFechaInicio = Convert.ToDateTime(li.Text.ToString());
|
|
dteFechaFin = DateTime.Now;
|
|
}
|
|
if (li.Value.Contains("FIN"))
|
|
{
|
|
dteFechaFin = Convert.ToDateTime(li.Text.ToString());
|
|
|
|
if (dteFechaFin != null || dteFechaInicio != null)
|
|
if (dteFechaInicio < dteFechaFin || dteFechaFin == dteFechaInicio)
|
|
{
|
|
objBL = new AyABL.AyABL();
|
|
arlCondicionesFiltroBusqueda = objBL.buscarPorFechas(Tablas.BITACORA, dteFechaInicio, dteFechaFin, operadorLogico.AND, arlCondicionesFiltroBusqueda);
|
|
}
|
|
else
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que la Fecha de Inicio sea menor que la Fecha Final" + "M2");
|
|
else
|
|
MensajeInformativo(AyABL.BASESDEDATOS.ADS + "Interfaz: " + "Verifique que los campos de las fechas no estén vacíos" + "M2");
|
|
}
|
|
else
|
|
{
|
|
objBL = new AyABL.AyABL();
|
|
arlCondicionesFiltroBusqueda = objBL.buscarPorFechas(Tablas.BITACORA, dteFechaInicio, dteFechaFin, operadorLogico.AND, arlCondicionesFiltroBusqueda);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (li.Value.Contains("booleano") && li.Text != "2")
|
|
{
|
|
condicion = new CondicionDAL();
|
|
char[] separadorColumna = { '|' };
|
|
string[] strColumna = li.Value.Split(separadorColumna);
|
|
condicion.valorIzquierdo = strColumna[1].ToString();
|
|
condicion.operadorGeneral = operadorGeneral.EQUAL;
|
|
condicion.operadorLogico = operadorLogico.AND;
|
|
condicion.valorDerecho = li.Text.Trim();
|
|
arlCondicionesFiltroBusqueda.Add(condicion);
|
|
}
|
|
else
|
|
{
|
|
if (li.Text != string.Empty && !li.Value.Contains("booleano"))
|
|
{
|
|
condicion = new CondicionDAL();
|
|
condicion.valorIzquierdo = li.Value;
|
|
condicion.operadorGeneral = operadorGeneral.LIKEALL;
|
|
condicion.operadorLogico = operadorLogico.AND;
|
|
condicion.valorDerecho = "%" + li.Text.Trim() + "%";
|
|
arlCondicionesFiltroBusqueda.Add(condicion);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo que se utiliza con el buscador de la parte superior de la pantalla, y hace que se despliegue la información de acuerdo
|
|
/// a lo solicitado
|
|
/// </summary>|
|
|
private void Buscar() //M4
|
|
{
|
|
try
|
|
{
|
|
llenarGridView(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Metodo que se utiliza para el despliegue de los botones
|
|
/// </summary>
|
|
private void ComandosxMenu() //M6
|
|
{
|
|
try
|
|
{
|
|
DataSet dsComandos = getComandos();
|
|
|
|
if (dsComandos != null)
|
|
{
|
|
foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
|
{
|
|
switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
|
{
|
|
case "NUEVO":
|
|
//btnNuevo.Visible = true;
|
|
btnGuardar.Visible = true;
|
|
btnImcompleto.Visible = true;
|
|
break;
|
|
|
|
//case "MODIFICA":
|
|
// ////Inicio de variable tipo VIEWSTATE
|
|
// //ViewState["PUEDEMODIFICAR"] = true;
|
|
// //btnGuardar.Visible = true;
|
|
// //break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Metodos Controles a Datos (R5)
|
|
|
|
/// <summary>
|
|
/// guarda y modifica registros en la tabla.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private int GuardarDatos(int p_intPKREQUISITO,string strRequisito) //M0
|
|
{
|
|
|
|
int nValorRetornado = 0;
|
|
|
|
try
|
|
{
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
if (nTipoDisponibilidad == 2)
|
|
objRequisitostmpBL.objRequisitostmpEL.PRORROGA = true;
|
|
if (nTipoDisponibilidad == 3)
|
|
objRequisitostmpBL.objRequisitostmpEL.REVISION = true;
|
|
|
|
|
|
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREQUISITO = p_intPKREQUISITO;
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREQUISITODOCUMENTO = p_intPKREQUISITO; //lo usa como fkrequisitosolicitud en eliminar
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBL.objRequisitostmpEL.Fecha = DateTime.Now;
|
|
objRequisitostmpBL.objRequisitostmpEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|
char[] separadorColumna = { ',' };
|
|
string[] strColumna = strNaturalezaInmueble.Split(separadorColumna);
|
|
objRequisitostmpBL.objRequisitostmpEL.FKNATURALEZAINMUEBLE = int.Parse(strColumna[strColumna.Length - 1]);
|
|
|
|
DataSet dsRequisitos = objRequisitostmpBL.Requisitos();
|
|
|
|
RequisitostmpBL objRequisitostmpBLVerifica = new RequisitostmpBL();
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKREQUISITO = p_intPKREQUISITO;
|
|
DataSet dsResult = objRequisitostmpBLVerifica.dsListaAdjuntos();
|
|
|
|
if (dsResult.Tables[0].Rows.Count > 0)
|
|
{
|
|
|
|
if (dsRequisitos.Tables[0].Rows.Count != 0)
|
|
{
|
|
objRequisitostmpBL.objRequisitostmpEL.PK = int.Parse(dsRequisitos.Tables[0].Rows[0][0].ToString());
|
|
objRequisitostmpBL.eliminarRequisitos();
|
|
|
|
}
|
|
|
|
nValorRetornado = objRequisitostmpBL.insertarRequisitostmp();
|
|
|
|
|
|
|
|
|
|
}
|
|
//else
|
|
//{
|
|
// MensajeAlerta("Falta agregar el documento adjunto:" + strRequisito);
|
|
//}
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return nValorRetornado;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// guarda y modifica registros en la tabla.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
///
|
|
|
|
private int GuardarRequisitosIncompleto(int p_intPKREQUISITO)
|
|
{
|
|
int nValorRetornado = 0;
|
|
|
|
try
|
|
{
|
|
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
if (nTipoDisponibilidad == 2)
|
|
objRequisitostmpBL.objRequisitostmpEL.PRORROGA = true;
|
|
if (nTipoDisponibilidad == 3)
|
|
objRequisitostmpBL.objRequisitostmpEL.REVISION = true;
|
|
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREQUISITO = p_intPKREQUISITO;
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBL.objRequisitostmpEL.Fecha = DateTime.Now;
|
|
objRequisitostmpBL.objRequisitostmpEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|
|
|
|
|
//objRequisitostmpBL.objRequisitostmpEL.POSEEDOR = bPoseedor;
|
|
|
|
//objRequisitostmpBL.objRequisitostmpEL.SEGREGACION = bSegregacion;
|
|
|
|
//objRequisitostmpBL.objRequisitostmpEL.DERECHOS = bDerechos;
|
|
|
|
//objRequisitostmpBL.objRequisitostmpEL.AUTORIZADOLEGAL = bAutorizadoLegal;
|
|
|
|
//objRequisitostmpBL.objRequisitostmpEL.FKNATURALEZAINMUEBLE = int.Parse(strNaturalezaInmueble);
|
|
|
|
DataSet dsRequisitos = objRequisitostmpBL.Requisitos();
|
|
|
|
if (dsRequisitos.Tables[0].Rows.Count != 0)
|
|
{
|
|
objRequisitostmpBL.eliminarRequisitos();
|
|
|
|
}
|
|
|
|
nValorRetornado = objRequisitostmpBL.insertarRequisitostmp();
|
|
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se ha ingresado la informacion","frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return nValorRetornado;
|
|
}
|
|
|
|
private bool SubirDocumentos(string strAccion)
|
|
{
|
|
bool bRespuesta = true;
|
|
//FileUpload lista;
|
|
|
|
|
|
string rutaAdjuntos = string.Empty;
|
|
try
|
|
{
|
|
//Boolean fileOK = false;
|
|
String path = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\";
|
|
//if (!Directory.Exists(path))
|
|
// Directory.CreateDirectory(path);
|
|
|
|
|
|
DirectoryInfo di = new DirectoryInfo(path);
|
|
|
|
foreach (var fi in di.GetFiles())
|
|
{
|
|
|
|
string ext = Path.GetExtension(fi.Name);
|
|
if (ext == ".pdf" || ext == ".PDF")
|
|
{
|
|
|
|
//string strDocumento = file.FileName;
|
|
//saving code here
|
|
|
|
//string targetPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + objFormularioEL.CEDULASOLICITANTEFORMULARIO + @"\";
|
|
|
|
// string targetUrl = "'../../../DocumentosPDF/" + lblNumSolicitud.Text.Trim() + @"/";
|
|
|
|
|
|
|
|
|
|
string fname = Path.GetFileName(fi.Name);
|
|
//file.SaveAs(Server.MapPath(Path.Combine(targetUrl, fname)));
|
|
//{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: abrirOdt('" + targetUrl + "');</script>"); }
|
|
|
|
//subir documentos a vision 2020
|
|
Documento oDoc = new Documento();
|
|
//se transaforma el archivo a un arreglo de bytes
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(path + fi.Name.Replace(" ", "_"));
|
|
string nombreAdjunto = fi.Name.Replace(".pdf", "");
|
|
|
|
//se carga el archivo y el registro a vision 2020
|
|
string strResultado = oDoc.Archivar_Documento(lblNumSolicitud.Text.Trim() + "|" + "Requisito", fi.Name.Replace(" ", "_"), bDoc);
|
|
if (strResultado != string.Empty)
|
|
{
|
|
bRespuesta = false;
|
|
|
|
}
|
|
else
|
|
{
|
|
bRespuesta = true;
|
|
File.Delete(path + fi.Name.Replace(" ", "_"));
|
|
EjecutarScript("EscoderBoton();MensajeInformativo();");//PERMITE QUE SOLO SE MUESTRE UN BOTON EN LA PÁGINA
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se ha subido el documento de requisito " + fi.Name.Replace(" ", "_") + " de la solicitud " + Session["SOLICITUD"].ToString(),
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
llenarGridView(true);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
bRespuesta = false;
|
|
MensajeError("Se dio un error al subir los documentos....", ex);
|
|
}
|
|
return bRespuesta;
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Metodos Datos a Controles (R6)
|
|
/// <summary>
|
|
/// Carga el grid principal
|
|
/// </summary>
|
|
/// <param name="p_Llenar"></param>
|
|
private void llenarGridView(bool p_Llenar) //M0
|
|
{
|
|
try
|
|
{
|
|
if (!IsPostBack || p_Llenar)
|
|
{
|
|
|
|
condicionesBusqueda();
|
|
objRequisitoBL = new requisitoBL();
|
|
objRequisitoBL.objrequisitoEL.Activo = true;
|
|
objRequisitoBL.objrequisitoEL.PKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
if(nTipoPropietario == 1 || nTipoPropietario == 3 || nTipoPropietario == 4 )//cliente fisico si hace distincion
|
|
objRequisitoBL.objrequisitoEL.FKTIPOPROPIETARIO = 1;
|
|
if(nTipoDisponibilidad == 2)
|
|
objRequisitoBL.objrequisitoEL.PRORROGA = true;
|
|
if (nTipoDisponibilidad == 3)
|
|
objRequisitoBL.objrequisitoEL.REVISION = true;
|
|
|
|
objRequisitoBL.objrequisitoEL.APCR = bAPCR;
|
|
|
|
objRequisitoBL.objrequisitoEL.POSEEDOR = bPoseedor;
|
|
|
|
objRequisitoBL.objrequisitoEL.SEGREGACION = bSegregacion;
|
|
|
|
objRequisitoBL.objrequisitoEL.DERECHOS = bDerechos;
|
|
|
|
objRequisitoBL.objrequisitoEL.AUTORIZADOLEGAL = bAutorizadoLegal;
|
|
|
|
objRequisitoBL.objrequisitoEL.PROPIETARIOREGISTRAL = bPropietarioRegistral;
|
|
|
|
objRequisitoBL.objrequisitoEL.CONCESIONARIO = bConcesionario;
|
|
|
|
objRequisitoBL.objrequisitoEL.NATURALEZAINMUEBLE = strNaturalezaInmueble;
|
|
|
|
DataSet dsRequisitos = objRequisitoBL.dsListaRequisitoxTipoProyecto(arlCondicionesFiltroBusqueda);
|
|
|
|
General.detalleGridView(dsRequisitos, grvListaDatosCantonalesTemp, lblTotalDatos);
|
|
if (Session["SOLICITUD"].ToString() != null)
|
|
{
|
|
RequisitostmpBL objRequisitostmpBL = new RequisitostmpBL();
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
if (nTipoDisponibilidad == 2)
|
|
objRequisitostmpBL.objRequisitostmpEL.PRORROGA = true;
|
|
if (nTipoDisponibilidad == 3)//revision
|
|
objRequisitostmpBL.objRequisitostmpEL.REVISION = true;
|
|
|
|
//char[] separadorColumna = { '-' };
|
|
//string[] arrSolicitud = Session["SOLICITUD"].ToString().Split(separadorColumna);
|
|
//objRequisitostmpBL.objRequisitostmpEL.NUMEROSOLICITUD = arrSolicitud[1].ToString();
|
|
|
|
buscarGridView(objRequisitostmpBL);
|
|
}
|
|
ddlRequisito.Items.Clear();
|
|
ddlRequisito.DataSource = dsRequisitos;
|
|
ddlRequisito.DataTextField = dsRequisitos.Tables[0].Columns["DESCRIPCIONREQUISITO"].ColumnName;
|
|
ddlRequisito.DataValueField = dsRequisitos.Tables[0].Columns["PKREQUISITO"].ColumnName;
|
|
ddlRequisito.DataBind();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
private void llenarRequisitos()
|
|
{
|
|
try
|
|
{
|
|
grvLista.DataSource = null;
|
|
grvLista.DataBind();
|
|
|
|
DataSet ds = obtenerAdjuntos();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
//if (ds.Tables[0].Rows[0]["DESCRIPCIONDOCUMENTO"].ToString() != string.Empty)
|
|
{
|
|
grvLista.DataSource = ds;
|
|
grvLista.DataBind();
|
|
General.detalleGridView(ds, grvLista, null);
|
|
mostrarFilaTabla(1);
|
|
divDatosSuperiores.Visible = true;
|
|
tdBotoneraSuperior.Visible = true;
|
|
dvAdjuntos.Visible = true;
|
|
|
|
// llenarRequisitos();
|
|
}
|
|
}
|
|
|
|
if (Session["ESTADO"].ToString() != "Bloqueada" && Session["ESTADO"].ToString() != "Asignada")
|
|
{
|
|
divDatosSuperiores.Visible = false;
|
|
tdBotoneraSuperior.Visible = false;
|
|
dvAdjuntos.Visible = false;
|
|
//carga el gridview con los requisitos que se solicitaron al ingresar la solicitud
|
|
DataSet dsRequisitos = null;
|
|
grvListaDatosCantonalesTemp.DataSource = dsRequisitos;
|
|
grvListaDatosCantonalesTemp.DataBind();
|
|
|
|
ddlRequisito.Items.Clear();
|
|
ddlRequisito.DataSource = dsRequisitos;
|
|
ddlRequisito.DataTextField = dsRequisitos.Tables[0].Columns["DESCRIPCIONREQUISITO"].ColumnName;
|
|
ddlRequisito.DataValueField = dsRequisitos.Tables[0].Columns["PKREQUISITO"].ColumnName;
|
|
ddlRequisito.DataBind();
|
|
|
|
|
|
}
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|
{
|
|
|
|
foreach (DataRow drfila in ds.Tables[0].Rows)
|
|
{
|
|
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
if (drfila["FKREQUISITO"].ToString() == row.Cells[2].Text)// || row.Cells[2].Text == "20")
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
chkTemp.Checked = true;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Muestra los datos del registro
|
|
/// </summary>
|
|
/// <param name="p_intPkConsultar"></param>
|
|
private void mostrarDatos(int p_intPkConsultar) //M1
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
objRequisitoBL = new requisitoBL();
|
|
objRequisitoBL.objrequisitoEL.PK = p_intPkConsultar;
|
|
DataSet dsRequisito = objRequisitoBL.dsListaRequisito(null);
|
|
|
|
|
|
if (dsRequisito.Tables[0].Rows.Count > 0)
|
|
{
|
|
//Información de la cantonal
|
|
|
|
//txtDescripcion.Text = dsRequisito.Tables[0].Rows[0]["DESCRIPCIONREQUISITO"].ToString();
|
|
//txtDocSoporte.Text = dsRequisito.Tables[0].Rows[0]["DOCSOPORTEREQUISITO"].ToString();
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Carga el grid principal
|
|
/// </summary>
|
|
/// <param name="p_Llenar"></param>
|
|
///
|
|
|
|
private void buscarGridView(RequisitostmpBL objRequisitostmpBL) //M2
|
|
{
|
|
try
|
|
{
|
|
|
|
{
|
|
|
|
|
|
DataSet dsSolicitud = objRequisitostmpBL.dsListaRequisitos();
|
|
|
|
if(dsSolicitud.Tables[0].Rows.Count != 0)
|
|
{
|
|
|
|
foreach (DataRow drfila in dsSolicitud.Tables[0].Rows)
|
|
{
|
|
|
|
foreach (GridViewRow row in grvListaDatosRequisitos.Rows)
|
|
{
|
|
if (drfila["FKREQUISITO"].ToString() == row.Cells[2].Text)// || row.Cells[2].Text == "20")
|
|
{
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
chkTemp.Checked = true;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// guarda y modifica registros en la tabla.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
///
|
|
|
|
|
|
private int GuardarDatosActividad(string p_accion)
|
|
{
|
|
int nValorRetornado = 0;
|
|
|
|
try
|
|
{
|
|
|
|
// 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.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|
objSolicitudBL.objSolicitudEL.ORDEN = 1;
|
|
|
|
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
|
|
|
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
|
{
|
|
//if (int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["PKUSUARIOXDEPENDENCIA"].ToString()) == int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString()) && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString())!= 5
|
|
// && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString())!= 8)
|
|
if (int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString()) != 5 && int.Parse(dsEncargadosActividades.Tables[0].Rows[0]["FKESTADO"].ToString()) != 8)
|
|
{
|
|
string strEncargadoActividad = dsEncargadosActividades.Tables[0].Rows[0]["PKRESPONSABLEACTIVIDAD"].ToString();
|
|
|
|
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
|
|
|
objObservacionesBL.objobservacionesEL.DESCRIPCION = "\n" + DateTime.Now.ToString() + " - " + Session["NOMBREEMPLEADO"].ToString() + " - Se actualiza el formulario " + Session["SOLICITUD"].ToString() + " por parte del usuario " + 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;
|
|
|
|
nValorRetornado = objObservacionesBL.insertarObservacionActividad();
|
|
|
|
|
|
if (nValorRetornado != 0)
|
|
{
|
|
solicitudBL objSolicitud = new solicitudBL();
|
|
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 ingreso y asignación de expedientes 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";
|
|
|
|
|
|
|
|
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
|
if (nResultadoActualizar > 0)
|
|
{
|
|
#region Envio de correo
|
|
|
|
AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
|
|
|
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();
|
|
|
|
//poner la siguiente actividad en pendiente
|
|
|
|
objSolicitudBL = new solicitudBL();
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|
objSolicitudBL.objSolicitudEL.ORDEN = 2;
|
|
|
|
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();
|
|
}
|
|
//cancelar notificacion
|
|
notificacionBL objNotificacionBL = new notificacionBL();
|
|
|
|
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - Ingreso y asignación de expedientes";
|
|
objNotificacionBL.objnotificacionEL.status = "00";
|
|
objNotificacionBL.objnotificacionEL.message = "OK";
|
|
nValorRetornado = objNotificacionBL.cancelarNotificacion(objNotificacionBL.objnotificacionEL);
|
|
#endregion
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": La actividad ingreso y asignación de expedientes 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 (p_accion == "pendiente")
|
|
{
|
|
//Poner la actividad 2 programacion en pendiente(3)
|
|
objSolicitudBL = new solicitudBL();
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|
objSolicitudBL.objSolicitudEL.ORDEN = 1;
|
|
|
|
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();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
return nValorRetornado;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
protected void grvLista_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|
GridViewRow selectedRow = grvLista.Rows[i];
|
|
int nPk = int.Parse(selectedRow.Cells[0].Text);
|
|
int nFKRequisito = int.Parse(selectedRow.Cells[4].Text);
|
|
|
|
string strNombreAdjunto = HttpUtility.HtmlDecode(selectedRow.Cells[1].Text).Replace(" ", "_");
|
|
if (e.CommandName == "eliminar")
|
|
{
|
|
if (eliminarAdjunto(nPk))
|
|
{
|
|
string Serverpath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + selectedRow.Cells[10].Text + @"\DocumentosREQ\";
|
|
//Serverpath += "\\" + lblNumSolicitud.Text.Trim() + "\\DocumentosREQ";
|
|
string file = selectedRow.Cells[1].Text;
|
|
string fileDirectory = Serverpath + "\\" + file.Replace(" ", "_"); ;
|
|
File.Delete(fileDirectory);
|
|
|
|
llenarRequisitos();
|
|
|
|
RequisitostmpBL objRequisitostmpBLVerifica = new RequisitostmpBL();
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKREQUISITO = nFKRequisito;
|
|
DataSet dsResult = objRequisitostmpBLVerifica.dsListaAdjuntos();
|
|
|
|
if (dsResult.Tables[0].Rows.Count == 0)
|
|
{
|
|
|
|
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREQUISITODOCUMENTO = nFKRequisito;
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
|
|
objRequisitostmpBL.eliminarRequisitos();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
llenarGridView(true);
|
|
llenarRequisitos();
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.EliminarRegistro + ": Se ha eliminado el adjunto " + strNombreAdjunto + " de la solicitud " + lblNumSolicitud.Text,
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
if (e.CommandName == "ver")
|
|
{
|
|
|
|
|
|
|
|
string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + selectedRow.Cells[10].Text + @"\DocumentosREQ\" + strNombreAdjunto;
|
|
string targetURL = "'../../DocumentosPDF/" + selectedRow.Cells[10].Text.Trim() + "/DocumentosREQ/" + strNombreAdjunto + "'";
|
|
//if (System.IO.File.Exists(pdfPath))
|
|
//{
|
|
// EjecutarScript("abrirPDF(" + targetURL + ");");
|
|
|
|
//}
|
|
//else
|
|
{
|
|
string strResultado = "";
|
|
Documento oDoc = new Documento();
|
|
|
|
//consulta la ruta en la que se encuentra ubicado la copia del archivo a consultar
|
|
strResultado = oDoc.Consultar_Documento(selectedRow.Cells[10].Text.Trim() + "|Requisito", selectedRow.Cells[10].Text.Trim(), strNombreAdjunto);
|
|
//string[] listaAdjuntos = strResultado.Split(new char[] { '|' });
|
|
|
|
|
|
//if (Directory.Exists(targetURL))
|
|
// System.IO.Directory.Delete(targetURL, true);
|
|
|
|
//strResultado = string.Empty;
|
|
int nTop = 400;
|
|
//foreach (string val in listaAdjuntos)
|
|
//{
|
|
// nTop += +50;
|
|
// if (val != "" && val != "No existe")
|
|
// strResultado += "JavaScript: window.open('" + strResultado + "','','width=500,height=245,left=350,top=" + (nTop.ToString()) + "');";
|
|
// //Response.Redirect(val,false);
|
|
//}
|
|
if (strResultado != "" && strResultado != "No existe")
|
|
{
|
|
EjecutarScript("window.open('" + strResultado + "','','width=500,height=245,left=350,top=" + (nTop.ToString()) + "');");
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.CONSULTA.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": El usuario " + Session["NOMBREEMPLEADO"].ToString() + " descargó el documento " + strNombreAdjunto + " para lectura. Requisito de la solicitud " + lblNumSolicitud.Text,
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
}
|
|
else
|
|
{
|
|
EjecutarScript("MensajeInformativoCompleto('No se encontró el documento." + strNombreAdjunto + "');");
|
|
}
|
|
//ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativoCompleto('No se ha generado el documento PDF." + pdfPath + "');</script>");
|
|
}
|
|
}
|
|
if (e.CommandName == "firmar")
|
|
{
|
|
//limpiarCampos();
|
|
firmarDocumento(strNombreAdjunto);
|
|
|
|
|
|
}
|
|
if (e.CommandName == "notificar")
|
|
{
|
|
string strPdf = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + selectedRow.Cells[10].Text + @"\DocumentosREQ\" + strNombreAdjunto;
|
|
strRutaDocAdjuntosRespuesta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + selectedRow.Cells[10].Text + @"\" + strNombreAdjunto;
|
|
string strRutaCopiarPdf = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + selectedRow.Cells[10].Text + @"\DocumentosREQ\";
|
|
|
|
//System.IO.File.Copy(strPdf, strRutaDocAdjuntosRespuesta, true);
|
|
if (System.IO.File.Exists(strPdf))
|
|
{
|
|
|
|
System.IO.File.Copy(strPdf, strRutaDocAdjuntosRespuesta, true);
|
|
}
|
|
else
|
|
{
|
|
|
|
Documento oDoc = new Documento();
|
|
|
|
//consulta la ruta en la que se encuentra ubicado la copia del archivo a consultar
|
|
strRutaCopiarPdf = oDoc.Visor_Documento(selectedRow.Cells[10].Text.Trim() + "|Requisito", selectedRow.Cells[10].Text.Trim(), strRutaDocAdjuntosRespuesta, strNombreAdjunto);
|
|
}
|
|
|
|
|
|
if (strRutaCopiarPdf != string.Empty && strRutaCopiarPdf != "No existe")
|
|
{
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
string strRutaDocumentos = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text;
|
|
int nNumeroSolicitudCFIA = -1;
|
|
//crear documento zip con los archivos adjuntos
|
|
|
|
ZipFile zip = new ZipFile();
|
|
zip.AddFile(strRutaDocAdjuntosRespuesta, "");
|
|
|
|
string strRutaDocZip = strRutaDocumentos + @"\" + lblNumSolicitud.Text + ".zip";
|
|
zip.Save(strRutaDocZip);
|
|
|
|
//ser verifica el resultado de la solicitud
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(strNumSolicitudTMP);
|
|
|
|
DataSet dsSolicitud = objSolicitudBL.dsExisteSolicitud(null);
|
|
|
|
if (dsSolicitud.Tables[0].Rows.Count > 0 && dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString() != "N/A" && dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString() != string.Empty)
|
|
{
|
|
nNumeroSolicitudCFIA = int.Parse(dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString() == "N/A" ? "-1" : dsSolicitud.Tables[0].Rows[0]["DESCRIPCIONDESCRIPCIONCFIA"].ToString());
|
|
}
|
|
|
|
//enviar notificacion a CFIA con el servicio de respuesta
|
|
if (File.Exists(strRutaDocZip) && nNumeroSolicitudCFIA != -1 )
|
|
{
|
|
if (strNombreAdjunto.Contains("RequisitosIncompleto"))
|
|
{
|
|
APCR_WCF_Respuesta.ServicioClient wcfCfia = new APCR_WCF_Respuesta.ServicioClient();
|
|
APCR_WCF_Respuesta.Respuestas respuestaAPCR;
|
|
byte[] bRespuestaZip = System.IO.File.ReadAllBytes(strRutaDocZip);
|
|
respuestaAPCR = wcfCfia.RespuestaSolicitud(nNumeroSolicitudCFIA, "Presentación de requisitos incompleta", 2, Session["LOGIN"].ToString(), bRespuestaZip, 3, ConfigurationManager.AppSettings["LLAVEAPCR"].ToString());
|
|
if (respuestaAPCR.Respuesta == true)
|
|
{
|
|
EjecutarScript("MensajeInformativoPersonalizado('Se ha enviado la notificación a APCR para que ellos notifiquen al cliente registrado.');");
|
|
GuardarEventoBitacora(
|
|
|
|
Session["LOGIN"].ToString(),
|
|
|
|
AccionBitacora.INSERT.ToString(),
|
|
|
|
MensajesBitacora.IngresarRegistro + ": Se envió el correo de notificación de requisitos incompletos a APCR, referente a la solcitud " + lblNumSolicitud.Text,
|
|
|
|
"frwRequisitosSolicitud.aspx",
|
|
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
|
|
);
|
|
}
|
|
else
|
|
{
|
|
EjecutarScript("MensajeError('Se presento el siguiente problema a la hora de notificar al CFIA: " + respuestaAPCR.DescripcionError + "');");
|
|
GuardarEventoBitacora(
|
|
|
|
Session["LOGIN"].ToString(),
|
|
|
|
AccionBitacora.INSERT.ToString(),
|
|
|
|
MensajesBitacora.IngresarRegistro + ": Se presentó el siguiente problema a la hora de notificar al CFIA" + respuestaAPCR.DescripcionError ,
|
|
|
|
"frwRequisitosSolicitud.aspx",
|
|
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
|
|
);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (strRutaCopiarPdf != string.Empty)
|
|
{
|
|
string strAsunto = "Presentación de requisitos incompleta";
|
|
string strAccion = "incumplido";
|
|
|
|
if (strNombreAdjunto.Contains("RequisitosCompleto"))
|
|
{
|
|
strAsunto = "Presentación de requisitos completa";
|
|
strAccion = "cumplido";
|
|
}
|
|
|
|
|
|
|
|
|
|
string strCorreo = obtenerCorreo();
|
|
if (strCorreo != string.Empty)
|
|
{
|
|
#region Envio de correo externo
|
|
System.Drawing.Image img = System.Drawing.Image.FromFile(ConfigurationManager.AppSettings["Imagenes"].ToString());
|
|
string imgStr = imageToByteArray(img);
|
|
|
|
string p_strDocHtml = "<img alt='' src='cid:logoAyA.png' style='width: 100px; height: 82px;' />";
|
|
|
|
string strImage64Bits = "data:image/jpg;base64," + imgStr;
|
|
|
|
p_strDocHtml = p_strDocHtml.Replace("/logoAyA.png", strImage64Bits);
|
|
|
|
string strCuerpo = p_strDocHtml + "<div style='text-align:justify'></BR>Estimado " + strNombreCliente + "</BR></BR>El Instituto Costarricense de Acueductos y Alcantarillados le comunica que su trámite de Disponibilidad de Servicios ha " + strAccion + " con los requisitos solicitados en los Art 18-19 del Reglamento de Prestación de Servicios de AyA.</BR>Estamos para servirle, en nuestro horario de atención de 7:00 AM a 3:00 PM en las oficinas de AyA, si tiene alguna duda por favor contáctenos al teléfono " + Session["TELEFONODEPENDENCIA"].ToString() + " o al 800-737-6783.</BR></BR>" + "</BR></BR>Este es un mensaje generado de forma automática a la dirección de correo electrónico que usted ha suministrado por la cual NO DEBE SER RESPONDIDO. Base legal para esta alerta: Artículo 239 y siguientes de la Ley General de la Administración Pública.</div>";
|
|
|
|
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.correoExternoBL objcorreoExternoBL = new AyABL.TRA.correoExternoBL();
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = strCorreo;
|
|
objcorreoExternoBL.objcorreoExternoEL.p_copy = Session["LOGIN"].ToString() + "@aya.go.cr";
|
|
objcorreoExternoBL.objcorreoExternoEL.p_subject = strAsunto;
|
|
objcorreoExternoBL.objcorreoExternoEL.p_body = strCuerpo + strPiePagina;
|
|
objcorreoExternoBL.objcorreoExternoEL.P_PRIORIDAD = "High";
|
|
objcorreoExternoBL.objcorreoExternoEL.p_format = "html";
|
|
|
|
//#region adjuntar constancias
|
|
if (strRutaDocAdjuntosRespuesta != string.Empty)
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = strRutaDocAdjuntosRespuesta + ";" + ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\logoAyA.png;";
|
|
else
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = string.Empty;
|
|
|
|
int nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.INSERT.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": Se envió el correo de notificación de requisitos incompletos al correo " + strCorreo + ", referente a la solcitud " + lblNumSolicitud.Text,
|
|
"frwRequisitosSolicitud.aspx",
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
);
|
|
|
|
|
|
//MensajeInformativo("Se ha enviado la notificación al cliente.");
|
|
#endregion
|
|
}
|
|
|
|
EjecutarScript("MensajeInformativoPersonalizado('Se ha enviado la notificación al cliente registrado.');window.parent.location.href = '../tra/" + Session["PaginaBack"].ToString() + "?l=H/TvTKzD0EejKTW94E5Rjg==&u=J/U7O2rxqMtOqD6/hFMtDw==';");
|
|
EncriptaBL objEncripta = new EncriptaBL();
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
MensajeAlerta("No se pudo encontrar el archivo solicitado en Vision 2020");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M15", ex);
|
|
}
|
|
}
|
|
protected void grvLista_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
grvLista.PageIndex = e.NewPageIndex;
|
|
llenarRequisitos();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Error en R3M3", ex);
|
|
}
|
|
}
|
|
|
|
private bool eliminarAdjunto(int nPkDocumento)
|
|
{
|
|
bool bResult = false;
|
|
try
|
|
{
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
objRequisitostmpBL.objRequisitostmpEL.PKDOCUMENTO = nPkDocumento;
|
|
objRequisitostmpBL.eliminarAdjuntos();
|
|
|
|
|
|
|
|
bResult = true;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return bResult;
|
|
|
|
}
|
|
private DataSet obtenerAdjuntos()
|
|
{
|
|
DataSet dsResult = new DataSet();
|
|
try
|
|
{
|
|
objRequisitostmpBL = new RequisitostmpBL();
|
|
objRequisitostmpBL.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|
objRequisitostmpBL.objRequisitostmpEL.FKREUTILIZA = int.Parse(strPKReutiliza);
|
|
char[] separadorColumna = { '-' };
|
|
string[] arrSolicitud = Session["SOLICITUD"].ToString().Split(separadorColumna);
|
|
objRequisitostmpBL.objRequisitostmpEL.NUMEROSOLICITUD = arrSolicitud[1].ToString();
|
|
dsResult = objRequisitostmpBL.dsListaAdjuntos();
|
|
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return dsResult;
|
|
}
|
|
/// <summary>
|
|
/// LLena el listado de clientes
|
|
/// </summary>
|
|
private void identificaClientePropietarioSolicitud() //M4
|
|
{
|
|
try
|
|
{
|
|
//Instancia el objeto
|
|
clienteSolicitudBL objClienteSolicitudBL = new clienteSolicitudBL();
|
|
//Asigna un valor al atributo de referencia del objeto
|
|
objClienteSolicitudBL.objclientesolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
//objClienteSolicitudBL.objclientesolicitudEL.FKTIPOPROPIETARIO = 2;//pregunta si es de tipo cedula juridica primero para verificar que no hay ninguno entre los mismos
|
|
//PKTITULARINMUEBLE DESCRIPCIONTITULARINMUEBLE
|
|
//1 Propietario registral
|
|
//2 Representante legal
|
|
//3 Albacea
|
|
//4 Curador
|
|
//5 Tutor
|
|
//6 Autorizado legal
|
|
//7 Concesionario
|
|
//8 Poseedor
|
|
//Carga en un dataset la información
|
|
DataSet ds = objClienteSolicitudBL.dsListaClienteSolicitud();
|
|
nTipoPropietario = 1;
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
if (int.Parse(row["FKTIPOPROPIETARIO"].ToString()) == 2)
|
|
{
|
|
nTipoPropietario = 2;
|
|
|
|
}
|
|
//definir autorizado legal como un tercero
|
|
//titlar de inmueble concesionario y folio por concesion son lo mismo?
|
|
//definir filtros inclusivos y exclusivos
|
|
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 1)
|
|
{
|
|
bPropietarioRegistral = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 2)
|
|
{
|
|
bAutorizadoLegal = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 3)
|
|
{
|
|
bAutorizadoLegal = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 4)
|
|
{
|
|
bAutorizadoLegal = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 5)
|
|
{
|
|
bAutorizadoLegal = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 6)
|
|
{
|
|
bAutorizadoLegal = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 7)
|
|
{
|
|
bConcesionario = true;
|
|
}
|
|
if (int.Parse(row["FKTITULARINMUEBLE"].ToString()) == 8)
|
|
{
|
|
bPoseedor = true;
|
|
}
|
|
if (bool.Parse(row["SOLICITACFIASOLICITUD"].ToString()) == true)
|
|
{
|
|
bAPCR = true;
|
|
}
|
|
if (row["SEGREGACION"].ToString() == "1")
|
|
{
|
|
bSegregacion = true;
|
|
}
|
|
nTipoDisponibilidad = int.Parse(ds.Tables[0].Rows[0]["FKTIPODISPONIBILIDAD"].ToString());
|
|
|
|
strNaturalezaInmueble = ds.Tables[0].Rows[0]["NATURALEZAINMUEBLE"].ToString();
|
|
|
|
|
|
|
|
char[] separadorValores = { ',' };
|
|
char[] separadorDetalleFolio = { '-' };
|
|
string[] strFolios = ds.Tables[0].Rows[0]["FOLIOS"].ToString().Split(separadorValores);
|
|
for (int i = 0; i <= (strFolios.Length - 1); i++)
|
|
{
|
|
string[] strDetalleFolio = strFolios[i].Split(separadorDetalleFolio);
|
|
if (int.Parse(strDetalleFolio[strDetalleFolio.Length - 1]) > 0)
|
|
bDerechos = true;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
protected void grvLista_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
e.Row.Cells[3].Visible = false;
|
|
e.Row.Cells[4].Visible = false;
|
|
e.Row.Cells[5].Visible = false;
|
|
GridViewRow selectedRow = e.Row;
|
|
string strNombreAdjunto = selectedRow.Cells[1].Text.Replace(" ", "_");
|
|
if ( e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
// e.Row.Cells[6].Visible = false;//eliminar
|
|
e.Row.Cells[6].Enabled = false;
|
|
e.Row.Cells[6].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");
|
|
e.Row.Cells[10].Visible = false;//num solicitud
|
|
e.Row.Cells[7].ToolTip = "Ver adjunto";
|
|
e.Row.Cells[8].ToolTip = "Firmar adjunto";
|
|
e.Row.Cells[9].ToolTip = "Notificar al cliente";
|
|
if (int.Parse(strNumSolicitudTMP) == int.Parse(e.Row.Cells[4].Text))
|
|
{
|
|
e.Row.Cells[6].ToolTip = "Eliminar adjunto";
|
|
|
|
|
|
if (Session["ESTADO"].ToString() == "Bloqueada")
|
|
{ //e.Row.Cells[6].Visible = true;
|
|
e.Row.Cells[6].Enabled = true;
|
|
e.Row.Cells[6].Style.Add("opacity", "1");
|
|
e.Row.Cells[8].Enabled = true;
|
|
e.Row.Cells[8].Style.Add("opacity", "1");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
selectedRow.BackColor = System.Drawing.Color.LightGray;
|
|
e.Row.Cells[9].Enabled = false;
|
|
e.Row.Cells[9].Style.Add("opacity", "0.5");
|
|
}
|
|
if (strNombreAdjunto.Contains("RequisitosCompleto") && Session["ESTADO"].ToString() != "Finalizada" && int.Parse(strNumSolicitudTMP) == int.Parse(e.Row.Cells[4].Text))
|
|
{
|
|
e.Row.Cells[9].Enabled = true;
|
|
e.Row.Cells[9].Style.Add("opacity", "1");
|
|
e.Row.Cells[2].Text= "Documento de entrega al cliente cuando se completan los requisitos.";
|
|
}
|
|
if (strNombreAdjunto.Contains("RequisitosIncompleto") && Session["ESTADO"].ToString() != "Finalizada" && int.Parse(strNumSolicitudTMP) == int.Parse(e.Row.Cells[4].Text))
|
|
{
|
|
e.Row.Cells[9].Enabled = true;
|
|
e.Row.Cells[9].Style.Add("opacity", "1");
|
|
e.Row.Cells[2].Text = "Documento de entrega al cliente cuando no se completan los requisitos.";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception)
|
|
{ }
|
|
}
|
|
|
|
protected void btnGuardarPDF_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
FirmadorWeb.FirmadorWebSvcClient cliente = new FirmadorWeb.FirmadorWebSvcClient();
|
|
bool bSubirDocs = SubirDocumentos(" ");
|
|
//if (documento != null && documento.Firmas.Count() > 0)
|
|
//{
|
|
// byte[] contenido = cliente.ObtenerContenidoDocumento(
|
|
// long.Parse(ViewState["DocumentoID"].ToString()),
|
|
// CodigoSistema);
|
|
// System.IO.File.WriteAllBytes(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\DocumentosREQ\" + @"\" + ViewState["Documento"].ToString(), contenido);
|
|
// ViewState.Remove("DocumentoID");
|
|
|
|
// //var uri = new System.Uri(ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\DocumentosREQ\" + @"\" + ViewState["Documento"].ToString(), UriKind.Absolute);
|
|
// string targetURL = "'../../DocumentosPDF/" + Session["SOLICITUD"].ToString() + "/DocumentosREQ/" + ViewState["Documento"].ToString() + "'";
|
|
// EjecutarScript("abrirPDF(" + targetURL + ");");
|
|
// //System.Diagnostics.Process proc = new System.Diagnostics.Process();
|
|
// //proc.StartInfo.FileName = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\DocumentosREQ\" + @"\" + ViewState["Documento"].ToString();
|
|
// //proc.Start();
|
|
// //proc.Close();
|
|
//}
|
|
//else
|
|
//{
|
|
// MensajeAlerta("El documento no se firmó correctamente por favor vuelava a intentarlo.");
|
|
//}
|
|
ViewState["MODO"] = string.Empty;
|
|
ViewState["Documento"] = string.Empty;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MensajeError("Se produjo un error al firmar el documento pdf.", ex);
|
|
}
|
|
ViewState["MODO"] = string.Empty;
|
|
ViewState["Documento"] = string.Empty;
|
|
}
|
|
private void firmarDocumento(string pstrDocumento)
|
|
{
|
|
try
|
|
{
|
|
string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\DocumentosREQ\" + pstrDocumento;
|
|
string targetPath = "'../../DocumentosPDF/" + Session["SOLICITUD"].ToString() + "/DocumentosREQ/" + pstrDocumento + "'";
|
|
|
|
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");
|
|
}
|
|
|
|
|
|
if (!File.Exists(pdfPath))
|
|
{
|
|
string ruta = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + Session["SOLICITUD"].ToString() + @"\DocumentosREQ";
|
|
//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() + "|" + "Requisito", lblNumSolicitud.Text.Trim(), pdfPath, pstrDocumento);
|
|
|
|
|
|
}
|
|
|
|
|
|
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(
|
|
pstrDocumento ,
|
|
"Firma de documentos",
|
|
bytes,
|
|
IdUsuarioSistemaCliente,
|
|
signatarios.ToArray(),
|
|
emails.ToArray(),
|
|
CodigoSistema,
|
|
"01");
|
|
|
|
// cliente.PonerOpcionesDocumento(idDocumentoFirmado, CodigoSistema, false, false, false);
|
|
|
|
documento.DocumentoID = idDocumentoFirmado;
|
|
//documento.Nombre = pstrDocumento;
|
|
ViewState["DocumentoID"] = idDocumentoFirmado;
|
|
Session["Cedula"] = ConfigurationManager.AppSettings["CedulaFirmaSIGPC"].ToString();
|
|
_UrlFirmadorWeb = null;
|
|
EjecutarScript("AbrirFirmadorWeb();");
|
|
ViewState["MODO"] = "Firmador";
|
|
ViewState["Documento"] = pstrDocumento;
|
|
|
|
ObservacionesBL objObservacionesBL = new ObservacionesBL();
|
|
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
|
|
objObservacionesBL.objobservacionesEL.OBSERVACIONES = "El usuario " + Session["NOMBREEMPLEADO"].ToString() + " firmó el requisito " + pstrDocumento;
|
|
objObservacionesBL.objobservacionesEL.Fecha = DateTime.Now;
|
|
objObservacionesBL.objobservacionesEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|
objObservacionesBL.objobservacionesEL.USUARIO = Session["LOGIN"].ToString();
|
|
|
|
int nValorRetornado = objObservacionesBL.insertarObservaciones();
|
|
|
|
|
|
|
|
GuardarEventoBitacora(
|
|
Session["LOGIN"].ToString(),
|
|
AccionBitacora.FIRMAR.ToString(),
|
|
MensajesBitacora.IngresarRegistro + ": El usuario " + Session["NOMBREEMPLEADO"].ToString() + " descargó el documento de requisito " + pstrDocumento + ".pdf de la solicitud " + lblNumSolicitud.Text + " para realizar la firma." ,// Se firmó el requisito " + pstrDocumento + " de la solicitud " + lblNumSolicitud.Text,
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|
|
|
);
|
|
cliente.Close();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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() + @"\DocumentosREQ" + @"\" + ViewState["Documento"];
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
#region constancias
|
|
Documento oDoc = new Documento();
|
|
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(pdfPath);
|
|
//se carga el archivo y el registro a vision 2020
|
|
string strResultado = oDoc.Archivar_Documento(lblNumSolicitud.Text.ToString().Trim() + "|" + "Requisito", ViewState["Documento"].ToString() , bDoc);
|
|
if (strResultado == string.Empty)
|
|
{
|
|
|
|
File.Delete(pdfPath);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
{
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: MensajeInformativo('No se pudo descargar el documento firmado por favor intente firmarlo de nuevo." + pdfPath + "');</script>"); }
|
|
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#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("-", "");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
} |