1451 lines
66 KiB
C#
1451 lines
66 KiB
C#
|
|
/*===========================================================================================================================
|
|||
|
|
* Instituto Costarricense de Acueductos y Alcantarillados. - 2017
|
|||
|
|
* Administración de la Seguridad
|
|||
|
|
* Nombre de la Pantalla: frwBusquedaSolicitud.aspx
|
|||
|
|
*
|
|||
|
|
* Explicación de los contenidos del archivo
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
* HISTORIAL
|
|||
|
|
*
|
|||
|
|
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
|||
|
|
* Juan Pablo Monge D 14 – 09 - 2017 Se inicia con el diseño de la pagina
|
|||
|
|
* …………………………………………………………
|
|||
|
|
* …………………………………………………………
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
* Derechos Reservados (C) 2017 AyA.
|
|||
|
|
* ESTE CÓDIGO ES PROVEÍDO “TAL CUAL ES” SIN GARANTÍA ALGUNA
|
|||
|
|
* DE NINGÚN TIPO, SEA IMPLICITA O EXPLICITA.
|
|||
|
|
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL, NI SU COMERCIALIZACIÓN
|
|||
|
|
*===========================================================================================================================
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Web.UI.HtmlControls;
|
|||
|
|
|
|||
|
|
using AyABL;
|
|||
|
|
|
|||
|
|
using AyABL.AUT.Autenticacion;
|
|||
|
|
using AyABL.APL;
|
|||
|
|
using AyADAL;
|
|||
|
|
using System.Configuration;
|
|||
|
|
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Security.Cryptography;
|
|||
|
|
using System.IO;
|
|||
|
|
using AyABL.Usuario;
|
|||
|
|
using AyABL.Tran;
|
|||
|
|
using AyABL.TRA;
|
|||
|
|
using AyABL.RCS;
|
|||
|
|
using Ionic.Zip;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public partial class Forms_Trans_frwNotificacionCliente : General
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#region Inicializar Formulario (R0)
|
|||
|
|
|
|||
|
|
override protected void OnInit(EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
base.OnInit(e);
|
|||
|
|
|
|||
|
|
InicializarFormulario();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void InicializarFormulario() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M1", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Variables (R1)
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strNumSolicitudTMP = "0";
|
|||
|
|
string strPKSolicitudTMP = "0";
|
|||
|
|
int nNumeroSolicitudCFIA = 0;
|
|||
|
|
#region variables del estandar
|
|||
|
|
string strPagina = string.Empty;
|
|||
|
|
string strScript = string.Empty;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Formulario (R2)
|
|||
|
|
|
|||
|
|
protected void Page_Load(object sender, EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
//ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnNuevo);
|
|||
|
|
|
|||
|
|
|
|||
|
|
strNumSolicitudTMP = Session["SOLICITUD"].ToString();
|
|||
|
|
strPKSolicitudTMP = Session["PKSOLICITUD"].ToString();
|
|||
|
|
|
|||
|
|
if ((!IsPostBack) && (Session.Count > 0) && validarSesion())
|
|||
|
|
{
|
|||
|
|
lblNumSolicitud.Text = strNumSolicitudTMP;
|
|||
|
|
pksolicitud.Value = Session["PKSOLICITUD"].ToString();
|
|||
|
|
|
|||
|
|
if (Request["d"] != null)
|
|||
|
|
{
|
|||
|
|
if (Request["d"].ToString() == "deshabilitar" || Request["d"].ToString() == "finalizado")
|
|||
|
|
{
|
|||
|
|
btnEnviarRevision.Visible = false;
|
|||
|
|
btnFinalizar.Visible = false;
|
|||
|
|
ddlTipoRevision.Enabled = false;
|
|||
|
|
txtDestinatario.Enabled = false;
|
|||
|
|
txtObservaciones.Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
limpiarCampos();
|
|||
|
|
Session["Pagina"] = "";
|
|||
|
|
|
|||
|
|
obtenerCorreo();
|
|||
|
|
ComandosxMenu();
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
|
|||
|
|
llenarGridNotificacionClientes();
|
|||
|
|
if (chkCFIA.Checked == true)
|
|||
|
|
btnEnviarRevision.Enabled = false;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Session.Count == 0)
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: window.parent.VentanaCerrarActividades();window.parent.VentanaCerrarFormularioAS();window.location.href = '../wfrLogin.aspx?sesion=expiro';</script>"); }
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript: window.parent.VentanaCerrarActividades();window.parent.VentanaCerrarFormularioAP();</script>"); }
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R2M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Controles Web (R3)
|
|||
|
|
|
|||
|
|
protected void btnEnviarRevision_Click(object sender, EventArgs e) //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//if (ddlTipoRevision.SelectedValue != "3" || (ddlTipoRevision.SelectedValue == "3" && File.Exists(ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\" + lblNumSolicitud.Text.Trim() + "_DF" + ".pdf")))
|
|||
|
|
//{
|
|||
|
|
string strRutaArchivosAdjuntos = string.Empty;
|
|||
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
|
|||
|
|
strRutaArchivosAdjuntos = obtenerCartaSolicitud(nNumSolicitudTMP);
|
|||
|
|
//MensajeInformativo("llego7");
|
|||
|
|
if (validarTamañoArchivos(strRutaArchivosAdjuntos))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (txtDestinatario.Text != string.Empty)
|
|||
|
|
{
|
|||
|
|
notificacionClienteBL objNotificacionCliente = new notificacionClienteBL();
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.DESTINATARIO = txtDestinatario.Text;
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.OBSERVACIONES = txtObservaciones.Text;
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.FECHAENVIO = DateTime.Now;
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.FKTIPONOTIFICACION = int.Parse(ddlTipoRevision.SelectedValue.ToString());
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
objNotificacionCliente.objnotificacionClienteEL.ASTATE = true;
|
|||
|
|
|
|||
|
|
int nPKNotificacion = objNotificacionCliente.insertarNotificacionCliente();
|
|||
|
|
|
|||
|
|
if (nPKNotificacion > 0)
|
|||
|
|
{
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ha registrado la notificacion al cliente en la solicitud " + strNumSolicitudTMP,
|
|||
|
|
"frwNotificacionCliente.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
if (ddlTipoRevision.SelectedValue == "1" || ddlTipoRevision.SelectedValue == "3")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#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 = "El Instituto Costarricense de Acueductos y Alcantarillados le comunica que su trámite de Disponibilidad de Servicios ha sido concluido el " + DateTime.Now.ToLongDateString() + ".</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>" + p_strDocHtml + "</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 Artículo 239 y siguientes de la Ley General de la Administración Pública.";
|
|||
|
|
|
|||
|
|
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.”";
|
|||
|
|
string strAsunto = "Resolución de Trámite de Disponibilidad de Servicios";
|
|||
|
|
AyABL.TRA.correoExternoBL objcorreoExternoBL = new AyABL.TRA.correoExternoBL();
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = txtDestinatario.Text;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_copy = "";
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_subject = strAsunto;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_body = strCuerpo + strPiePagina;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.P_PRIORIDAD = "High";
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_format = "html";
|
|||
|
|
|
|||
|
|
#region adjuntar constancias
|
|||
|
|
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = strRutaArchivosAdjuntos;//obtenerCartaSolicitud(nNumSolicitudTMP);
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
int nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = Session["LOGIN"].ToString() + "@aya.go.cr";
|
|||
|
|
nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se envió el correo de notificación a la dirección " + txtDestinatario.Text,
|
|||
|
|
"frwNotificacionCliente.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
llenarGridNotificacionClientes();
|
|||
|
|
limpiarCampos();
|
|||
|
|
MensajeInformativo("Se ha enviado la notificación al cliente.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MensajeAlerta("Debe digitar el teléfono o correo del destinatario.");
|
|||
|
|
}
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// MensajeAlerta("Debe adjuntar el documento fisico de respuesta al cliente.");
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
//Trace.Write(ex.Message.ToString());
|
|||
|
|
MensajeError("Error en R3M0 Error al registrar la notificación al cliente", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public bool validarTamañoArchivos(string strRutaArchivos)
|
|||
|
|
{
|
|||
|
|
bool bResultado = false;
|
|||
|
|
int nMaximoTamañoCorreo = int.Parse(ConfigurationManager.AppSettings["TamañoArchivosBytes"].ToString());
|
|||
|
|
long nSumTamañoAdjuntos = 0;
|
|||
|
|
string strInfoArchivos = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
char[] separadorAdjuntos = { ';' };
|
|||
|
|
string[] strArrayAdjuntos = strRutaArchivos.Split(separadorAdjuntos);
|
|||
|
|
for (int i = 0; i <= (strArrayAdjuntos.Length - 1); i++)
|
|||
|
|
{
|
|||
|
|
if (strArrayAdjuntos[i] != string.Empty)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (File.Exists(strArrayAdjuntos[i].ToString()))
|
|||
|
|
{
|
|||
|
|
FileInfo file = new FileInfo(strArrayAdjuntos[i].ToString());
|
|||
|
|
|
|||
|
|
nSumTamañoAdjuntos += file.Length;
|
|||
|
|
if (nSumTamañoAdjuntos < nMaximoTamañoCorreo)
|
|||
|
|
bResultado = true;
|
|||
|
|
else
|
|||
|
|
bResultado = false;
|
|||
|
|
|
|||
|
|
decimal dResultado = decimal.Divide(decimal.Parse(file.Length.ToString()), decimal.Parse("1048576"));
|
|||
|
|
strInfoArchivos += file.Name + " - " + dResultado.ToString("N2") + " MB</BR>";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (bResultado == false)
|
|||
|
|
{
|
|||
|
|
MensajeAlerta("El tamaño de los archivos excede el limite permitido " + (int.Parse(ConfigurationManager.AppSettings["TamañoArchivosBytes"].ToString()) / 1048576).ToString() + " MB.</BR>" + strInfoArchivos);//conversion a megabytes
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return bResultado;
|
|||
|
|
}
|
|||
|
|
//private bool SubirDocumentos()
|
|||
|
|
//{
|
|||
|
|
// 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" && lblNumSolicitud.Text.Trim() + "_DF" == fi.Name)//_DF es cuando se agrega un documento externo como respuesta a la solicitud que sirva de complemento
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// //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() + "|" + "Constancia", fi.Name.Replace(" ", "_"), bDoc);
|
|||
|
|
// if (strResultado != string.Empty)
|
|||
|
|
// bRespuesta = false;
|
|||
|
|
// else
|
|||
|
|
// bRespuesta = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// catch (Exception ex)
|
|||
|
|
// {
|
|||
|
|
// bRespuesta = false;
|
|||
|
|
// MensajeError("Se dio un error al subir los documentos....", ex);
|
|||
|
|
// }
|
|||
|
|
// return bRespuesta;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
private bool SubirDocumentos(string strAccion)
|
|||
|
|
{
|
|||
|
|
bool bRespuesta = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string rutaAdjuntos = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
String path = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\";
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
DirectoryInfo di = new DirectoryInfo(path);
|
|||
|
|
|
|||
|
|
foreach (var fi in di.GetFiles())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string ext = Path.GetExtension(fi.Name);
|
|||
|
|
if (ext == ".pdf" || ext == ".PDF")
|
|||
|
|
{
|
|||
|
|
//string targetUrl = "'../../../DocumentosPDF/" + lblNumSolicitud.Text.Trim() + @"/";
|
|||
|
|
|
|||
|
|
string fname = Path.GetFileName(fi.Name);
|
|||
|
|
|
|||
|
|
//subir documentos a vision 2020
|
|||
|
|
Documento oDoc = new Documento();
|
|||
|
|
string fileDirectory = path + fi.Name.Replace(" ", "_");
|
|||
|
|
//se transaforma el archivo a un arreglo de bytes
|
|||
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(fileDirectory);
|
|||
|
|
string nombreAdjunto = fi.Name.Replace(".pdf", "");
|
|||
|
|
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
string strResultado = oDoc.Archivar_Documento(lblNumSolicitud.Text.Trim() + "|" + "Otros", fi.Name.Replace(" ", "_"), bDoc);
|
|||
|
|
if (strResultado != string.Empty)
|
|||
|
|
bRespuesta = false;
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
bRespuesta = true;
|
|||
|
|
File.Delete(fileDirectory);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
bRespuesta = false;
|
|||
|
|
MensajeError("Se dio un error al subir los documentos....", ex);
|
|||
|
|
}
|
|||
|
|
return bRespuesta;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Comportamiento del grid
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void grvLista_RowCommand(object sender, GridViewCommandEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|||
|
|
GridViewRow selectedRow = grvLista.Rows[i];
|
|||
|
|
|
|||
|
|
if (e.CommandName == "renotificar")
|
|||
|
|
{
|
|||
|
|
if (selectedRow.Cells[3].Text.Contains("Correo") || selectedRow.Cells[3].Text.Contains("Documento"))
|
|||
|
|
{
|
|||
|
|
#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 = "“El Instituto Costarricense de Acueductos y Alcantarillados le comunica que su trámite de Disponibilidad de Servicios ha sido concluido el " + DateTime.Now.ToLongDateString() + ".</BR>Estamos para servirle, en nuestro horario de atención de 7:00 AM a 3:15 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>" + p_strDocHtml + "</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 Artículo 239 y siguientes de la Ley General de la Administración Pública.”";
|
|||
|
|
|
|||
|
|
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.”";
|
|||
|
|
string strAsunto = "Reenvio: Resolución de Trámite de Disponibilidad de Servicios";
|
|||
|
|
AyABL.TRA.correoExternoBL objcorreoExternoBL = new AyABL.TRA.correoExternoBL();
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = selectedRow.Cells[2].Text;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_copy = "";
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_subject = strAsunto;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_body = strCuerpo + strPiePagina;
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.P_PRIORIDAD = "High";
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_format = "html";
|
|||
|
|
|
|||
|
|
#region adjuntar constancias
|
|||
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_file_attachments = obtenerCartaSolicitud(nNumSolicitudTMP);
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
int nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|||
|
|
objcorreoExternoBL.objcorreoExternoEL.p_recipients = Session["LOGIN"].ToString() + "@aya.go.cr";
|
|||
|
|
nValorRetornado = objcorreoExternoBL.EnviarCorreoExterno();
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se envió el correo de notificación a la dirección " + txtDestinatario.Text,
|
|||
|
|
"frwNotificacionCliente.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
|
|||
|
|
limpiarCampos();
|
|||
|
|
MensajeInformativo("Se ha reenviado la notificación al cliente.");
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M8", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void grvLista_PageIndexChanged(object sender, GridViewPageEventArgs e) //M2
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvLista.PageIndex = e.NewPageIndex;
|
|||
|
|
llenarGridNotificacionClientes();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M2", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void ddlTipoRevision_SelectedIndexChanged(object sender, EventArgs e) //M3
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
limpiarCampos();
|
|||
|
|
if (ddlTipoRevision.SelectedValue == "3")
|
|||
|
|
dvExaminar.Visible = true;
|
|||
|
|
else
|
|||
|
|
dvExaminar.Visible = false;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M3", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void btnFinalizar_Click(object sender, EventArgs e) //M4
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (VerificarNotificacion())
|
|||
|
|
{
|
|||
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
if (File.Exists(ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text))
|
|||
|
|
Directory.Delete(ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text,true);
|
|||
|
|
//GuardarDocumentoVision2020(nNumSolicitudTMP);
|
|||
|
|
programacionsolicitudBL objprogramacionsolicitudBL = new programacionsolicitudBL();
|
|||
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKESTADOPROGRAMACION = 3;
|
|||
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
objprogramacionsolicitudBL.objprogramacionsolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|||
|
|
int nPKProgramacionSolicitud = objprogramacionsolicitudBL.modificarprogramacionsolicitud();
|
|||
|
|
|
|||
|
|
if (nPKProgramacionSolicitud == objprogramacionsolicitudBL.objprogramacionsolicitudEL.FKSOLICITUD)
|
|||
|
|
{
|
|||
|
|
GuardarDatosActividad("finalizó");
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
MensajeInformativo("Finalizó con éxito la actividad 7 Notificación al usuario.");
|
|||
|
|
//cancelar notificacion
|
|||
|
|
notificacionBL objNotificacionBL = new notificacionBL();
|
|||
|
|
|
|||
|
|
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - Notificación al usuario";
|
|||
|
|
objNotificacionBL.objnotificacionEL.status = "00";
|
|||
|
|
objNotificacionBL.objnotificacionEL.message = "OK";
|
|||
|
|
int nValorRetornado = objNotificacionBL.cancelarNotificacion(objNotificacionBL.objnotificacionEL);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MensajeAlerta("Se presento un problema al finalizar la actividad por favor intente de nuevo.");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
MensajeAlerta("Falta finalizar la notificación al usuario.");
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M4: Se presentó un error al finalizar la actividad.", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
protected void grvListaAdjuntos_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvListaAdjuntos.PageIndex = e.NewPageIndex;
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M3", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
protected void grvListaAdjuntos_RowCommand(object sender, GridViewCommandEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|||
|
|
GridViewRow selectedRow = grvListaAdjuntos.Rows[i];
|
|||
|
|
int nPk = int.Parse(selectedRow.Cells[1].Text);
|
|||
|
|
//int nFKAdjunto = int.Parse(selectedRow.Cells[4].Text);
|
|||
|
|
|
|||
|
|
string strNombreAdjunto = selectedRow.Cells[2].Text.Replace(" ", "_");
|
|||
|
|
|
|||
|
|
if (e.CommandName == "ver")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + selectedRow.Cells[5].Text + @"\DocumentosREQ\" + strNombreAdjunto;
|
|||
|
|
string targetURL = "'../../DocumentosPDF/" + selectedRow.Cells[5].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[5].Text.Trim() + "|Otros", selectedRow.Cells[5].Text.Trim(), strNombreAdjunto);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
int nTop = 400;
|
|||
|
|
|
|||
|
|
if (strResultado != "" && strResultado != "No existe")
|
|||
|
|
{
|
|||
|
|
EjecutarScript("window.open('" + strResultado + "','','width=500,height=245,left=350,top=" + (nTop.ToString()) + "');");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
EjecutarScript("MensajeInformativoCompleto('No se encontró el documento." + strNombreAdjunto + "');");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M15", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void grvListaAdjuntos_RowDataBound(object sender, GridViewRowEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
e.Row.Cells[5].Visible = false;//OCULTAR NUMERO DE SOLICITUD
|
|||
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
bool bEnvioCorreo = false;
|
|||
|
|
if (e.Row.Cells[6].Text != " ")
|
|||
|
|
bEnvioCorreo = bool.Parse(e.Row.Cells[6].Text);
|
|||
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)e.Row.Controls[0].Controls[1];
|
|||
|
|
chkTemp.Checked = bEnvioCorreo;
|
|||
|
|
}
|
|||
|
|
e.Row.Cells[6].Visible = false;//OCULTAR ENVIOCORREO
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{ }
|
|||
|
|
}
|
|||
|
|
protected void btnSubirarchivo_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string strRequisito = string.Empty;
|
|||
|
|
//if(txtdescripcion.Text != string.Empty)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
bool bSubirDocs = SubirDocumentos(" ");
|
|||
|
|
if (bSubirDocs)
|
|||
|
|
{
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
|
|||
|
|
|
|||
|
|
EjecutarScript("MensajeInformativo();");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//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 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
|
|||
|
|
{
|
|||
|
|
switch (p_intFila)
|
|||
|
|
{
|
|||
|
|
case 1: divDatosSuperiores.Visible = true; divDatosInferiores.Visible = false; break;
|
|||
|
|
case 2: divDatosInferiores.Visible = true; divDatosSuperiores.Visible = false; break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Oculta las filas que lo requieran
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_intFila"></param>
|
|||
|
|
private void ComandosxMenu() //M1
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//DataSet dsComandos = getComandos();
|
|||
|
|
|
|||
|
|
//if (dsComandos != null)
|
|||
|
|
//{
|
|||
|
|
// foreach (DataRow drTemp in dsComandos.Tables[0].Rows)
|
|||
|
|
// {
|
|||
|
|
// switch (drTemp["NOMBRECOMANDO"].ToString().ToUpper())
|
|||
|
|
// {
|
|||
|
|
//case "NUEVO":
|
|||
|
|
//Div2.Visible = true;
|
|||
|
|
// break;
|
|||
|
|
|
|||
|
|
//case "MODIFICA":
|
|||
|
|
// //Inicio de variable tipo VIEWSTATE
|
|||
|
|
// ViewState["PUEDEMODIFICAR"] = true;
|
|||
|
|
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// LLena el listado de roles de usuario
|
|||
|
|
/// </summary>
|
|||
|
|
private string obtenerCartaSolicitud(int nNumSolicitud) //M2
|
|||
|
|
{
|
|||
|
|
string strResultado = string.Empty;
|
|||
|
|
string pdfPathConstancia = string.Empty;
|
|||
|
|
string pdfPathCriterioAP = string.Empty;
|
|||
|
|
string pdfPathCriterioAS = string.Empty;
|
|||
|
|
string pdfPathAdjuntos = string.Empty;
|
|||
|
|
string strNombreCarta = string.Empty;
|
|||
|
|
string targetURL = string.Empty;
|
|||
|
|
string ruta = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region constancias
|
|||
|
|
//Instancia el objeto
|
|||
|
|
cartaBL objCartaBL = new cartaBL();
|
|||
|
|
//Trace.Write("Paso 0");
|
|||
|
|
//Asigna un valor al atributo de referencia del objeto
|
|||
|
|
objCartaBL.objCartaEL.FKNUMSOLICITUD = nNumSolicitud;
|
|||
|
|
objCartaBL.objCartaEL.NOMBREDOCUMENTO = string.Empty;
|
|||
|
|
//objCartaBL.objCartaEL.FKREUTILIZA = nPKReutiliza;
|
|||
|
|
//Carga en un dataset la información
|
|||
|
|
DataSet ds = objCartaBL.listarCartas();
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string pdfPath = "";
|
|||
|
|
//ViewState["MODO"] = "Modificar";
|
|||
|
|
|
|||
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (row["DESCRIPCIONESTADOCARTA"].ToString() == "Activo")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
char delimitador = '-';
|
|||
|
|
string[] arrayNombre = row["NOMBREDOCUMENTOCARTA"].ToString().Split(delimitador);
|
|||
|
|
pdfPath = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + arrayNombre[1].ToString() + "-" + arrayNombre[2].ToString() + "-" + arrayNombre[3].ToString() + @"\" + row["NOMBREDOCUMENTOCARTA"].ToString() + ".pdf";
|
|||
|
|
ruta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + arrayNombre[1].ToString() + "-" + arrayNombre[2].ToString() + "-" + arrayNombre[3].ToString();
|
|||
|
|
|
|||
|
|
if (!File.Exists(pdfPath))
|
|||
|
|
{
|
|||
|
|
//MensajeInformativo("llego5");no entro
|
|||
|
|
//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(strNumSolicitudTMP.ToString().Trim() + "|" + "Constancia", strNumSolicitudTMP.ToString().Trim(), pdfPath, row["NOMBREDOCUMENTOCARTA"].ToString() + ".pdf");
|
|||
|
|
if (strAlmacenado != string.Empty && strAlmacenado != "No existe")
|
|||
|
|
strResultado += pdfPath + ";";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strResultado += pdfPath + ";";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception exp)
|
|||
|
|
{
|
|||
|
|
MensajeError(exp.ToString(), exp);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
strResultado += ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\logoAyA.png;";
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
//Trace.Write("Paso 1");
|
|||
|
|
#region formulario agua potable
|
|||
|
|
//limpiarCampos();
|
|||
|
|
|
|||
|
|
strNombreCarta = strNumSolicitudTMP;
|
|||
|
|
|
|||
|
|
|
|||
|
|
pdfPathCriterioAP = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreCarta + "-AP.pdf";
|
|||
|
|
ruta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNumSolicitudTMP;
|
|||
|
|
if (!File.Exists(pdfPathCriterioAP))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
Documento oDoc = new Documento();
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strAlmacenado = oDoc.Visor_Documento(strNumSolicitudTMP.ToString().Trim() + "|" + "Criterio técnico AP", strNumSolicitudTMP.ToString().Trim(), pdfPathCriterioAP, strNombreCarta + "-AP.pdf");
|
|||
|
|
if (strAlmacenado != string.Empty && strAlmacenado != "No existe")
|
|||
|
|
strResultado += pdfPathCriterioAP + ";"; ;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//EjecutarScript("alert('" + pdfPathCriterioAP + "-" + ruta + @"\" + strNombreCarta + "-AP.pdf" + "');");
|
|||
|
|
// File.Copy(pdfPathCriterioAP, ruta + @"\" + strNombreCarta + "-AP.pdf", true);
|
|||
|
|
strResultado += (ruta + @"\" + strNombreCarta + "-AP.pdf" + ";");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
//Trace.Write("Paso 2");
|
|||
|
|
#region formulario alcantarillado sanitario
|
|||
|
|
//limpiarCampos();
|
|||
|
|
|
|||
|
|
strNombreCarta = strNumSolicitudTMP;
|
|||
|
|
|
|||
|
|
|
|||
|
|
pdfPathCriterioAS = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreCarta + "-AS.pdf";
|
|||
|
|
ruta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + strNumSolicitudTMP;
|
|||
|
|
targetURL = "'../../DocumentosPDF/" + strNumSolicitudTMP + "/" + strNombreCarta + "-AS.pdf'";
|
|||
|
|
if (!File.Exists(pdfPathCriterioAS))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
Documento oDoc = new Documento();
|
|||
|
|
|
|||
|
|
string strAlmacenado = oDoc.Visor_Documento(strNumSolicitudTMP.ToString().Trim() + "|" + "Criterio técnico AS", strNumSolicitudTMP.ToString().Trim(), pdfPathCriterioAS, strNombreCarta + "-AS.pdf");
|
|||
|
|
if (strAlmacenado != string.Empty && strAlmacenado != "No existe")
|
|||
|
|
strResultado += pdfPathCriterioAS + ";"; ;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//File.Copy(pdfPathCriterioAS, ruta + @"\" + strNombreCarta + "-AS.pdf", true);
|
|||
|
|
strResultado += (ruta + @"\" + strNombreCarta + "-AS.pdf" + ";");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
//Trace.Write("Paso 3");
|
|||
|
|
#region adjuntos
|
|||
|
|
// recorro el grid
|
|||
|
|
foreach (GridViewRow row in grvListaAdjuntos.Rows)
|
|||
|
|
{
|
|||
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|||
|
|
if (chkTemp != null)
|
|||
|
|
{
|
|||
|
|
// si el registro esta marcado
|
|||
|
|
if (chkTemp.Checked)
|
|||
|
|
{
|
|||
|
|
string strNombreDocumento = row.Cells[2].Text;
|
|||
|
|
ruta = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\";
|
|||
|
|
pdfPathAdjuntos = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text.Trim() + @"\DocumentosREQ\" + strNombreDocumento;
|
|||
|
|
if (!File.Exists(pdfPathAdjuntos))
|
|||
|
|
{
|
|||
|
|
//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(strNumSolicitudTMP.ToString().Trim() + "|" + "Otros", strNumSolicitudTMP.ToString().Trim(), pdfPathAdjuntos, strNombreDocumento);
|
|||
|
|
if (strAlmacenado != string.Empty && strAlmacenado != "No existe")//si el documento es adjuntado al correo desde vision 2020
|
|||
|
|
{
|
|||
|
|
strResultado += pdfPathAdjuntos + ";"; ;
|
|||
|
|
AyABL.Tran.adjuntoBL objdocumentoBL = new AyABL.Tran.adjuntoBL();
|
|||
|
|
objdocumentoBL.objadjuntoEL.PK = int.Parse(row.Cells[1].Text);
|
|||
|
|
int nPKDocumento = objdocumentoBL.modificarEnvioCorreoAdjunto();//pone el adjunto como enviado en el correo
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (File.Exists(pdfPathAdjuntos))//si el documento es adjuntado al correo desde la ruta fisica
|
|||
|
|
{
|
|||
|
|
strResultado += pdfPathAdjuntos + ";"; ;
|
|||
|
|
AyABL.Tran.adjuntoBL objdocumentoBL = new AyABL.Tran.adjuntoBL();
|
|||
|
|
objdocumentoBL.objadjuntoEL.PK = int.Parse(row.Cells[1].Text);
|
|||
|
|
int nPKDocumento = objdocumentoBL.modificarEnvioCorreoAdjunto();//pone el adjunto como enviado en el correo
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//Trace.Write("Paso 4");
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
//EjecutarScript("alert('" + ex.Message.ToString() + "');");
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return strResultado;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void limpiarCampos() //M2
|
|||
|
|
{
|
|||
|
|
txtDestinatario.Text = string.Empty;
|
|||
|
|
txtObservaciones.Text = string.Empty;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public bool validarSesion() //M3
|
|||
|
|
{
|
|||
|
|
if (
|
|||
|
|
Session["PKSOLICITUD"] != null &&
|
|||
|
|
Session["SOLICITUD"] != null &&
|
|||
|
|
Session["PKUSUARIOXDEPENDENCIA"] != null &&
|
|||
|
|
Session["LOGIN"] != null &&
|
|||
|
|
Session["PKPROGRAMACION"] != null &&
|
|||
|
|
Session["TELEFONODEPENDENCIA"] != null
|
|||
|
|
|
|||
|
|
|
|||
|
|
)
|
|||
|
|
return true;
|
|||
|
|
else
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool GuardarDocumentoVision2020(int nNumSolicitud)
|
|||
|
|
{
|
|||
|
|
bool bResultado = false;
|
|||
|
|
string pdfPathConstancia = string.Empty;
|
|||
|
|
string pdfPathCriterioAP = string.Empty;
|
|||
|
|
string pdfPathCriterioAS = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Instancia el objeto
|
|||
|
|
cartaBL objCartaBL = new cartaBL();
|
|||
|
|
|
|||
|
|
//subir documentos a vision 2020
|
|||
|
|
Documento oDoc = new Documento();
|
|||
|
|
char delimitador = '-';
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strNombreCarta = string.Empty;
|
|||
|
|
//string targetURL = string.Empty;
|
|||
|
|
if (nNumSolicitud != 0)
|
|||
|
|
{
|
|||
|
|
#region constancias
|
|||
|
|
//Asigna un valor al atributo de referencia del objeto
|
|||
|
|
objCartaBL.objCartaEL.FKNUMSOLICITUD = nNumSolicitud;
|
|||
|
|
objCartaBL.objCartaEL.NOMBREDOCUMENTO = string.Empty;
|
|||
|
|
//objCartaBL.objCartaEL.FKREUTILIZA = nPKReutiliza;
|
|||
|
|
//Carga en un dataset la información
|
|||
|
|
DataSet ds = objCartaBL.listarCartas();
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//ViewState["MODO"] = "Modificar";
|
|||
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
if (row["DESCRIPCIONESTADOCARTA"].ToString() == "Activo")
|
|||
|
|
{
|
|||
|
|
string[] arrayNombre = row["NOMBREDOCUMENTOCARTA"].ToString().Split(delimitador);
|
|||
|
|
pdfPathConstancia = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + arrayNombre[1].ToString() + "-" + arrayNombre[2].ToString() + "-" + arrayNombre[3].ToString() + @"\" + row["NOMBREDOCUMENTOCARTA"].ToString() + ".pdf";
|
|||
|
|
|
|||
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(pdfPathConstancia);
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
string strResultado = oDoc.Archivar_Documento(strNumSolicitudTMP.ToString().Trim() + "|" + "Constancia", row["NOMBREDOCUMENTOCARTA"].ToString().Replace(" ", "_") + ".pdf", bDoc);
|
|||
|
|
if (strResultado == string.Empty)
|
|||
|
|
{
|
|||
|
|
bResultado = true;
|
|||
|
|
File.Delete(pdfPathConstancia);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
bResultado = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region formulario agua potable
|
|||
|
|
//limpiarCampos();
|
|||
|
|
|
|||
|
|
strNombreCarta = strNumSolicitudTMP;
|
|||
|
|
|
|||
|
|
|
|||
|
|
pdfPathCriterioAP = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreCarta + "-AP.pdf";
|
|||
|
|
//targetURL = "'../../DocumentosPDF/" + strNumSolicitudTMP + "/" + strNombreCarta + "-AP.pdf'";
|
|||
|
|
if (System.IO.File.Exists(pdfPathCriterioAP))
|
|||
|
|
{
|
|||
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(pdfPathCriterioAP);
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
string strResultado = oDoc.Archivar_Documento(strNumSolicitudTMP.ToString().Trim() + "|" + "Criterio técnico AP", strNombreCarta.ToString().Replace(" ", "_") + "-AP.pdf", bDoc);
|
|||
|
|
if (strResultado == string.Empty)
|
|||
|
|
{
|
|||
|
|
bResultado = true;
|
|||
|
|
File.Delete(pdfPathCriterioAP);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else
|
|||
|
|
bResultado = false;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region formulario alcantarillado sanitario
|
|||
|
|
//limpiarCampos();
|
|||
|
|
|
|||
|
|
strNombreCarta = strNumSolicitudTMP;
|
|||
|
|
|
|||
|
|
|
|||
|
|
pdfPathCriterioAS = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + strNumSolicitudTMP + @"\" + strNombreCarta + "-AS.pdf";
|
|||
|
|
//targetURL = "'../../DocumentosPDF/" + strNumSolicitudTMP + "/" + strNombreCarta + "-AS.pdf'";
|
|||
|
|
if (System.IO.File.Exists(pdfPathCriterioAS))
|
|||
|
|
{
|
|||
|
|
byte[] bDoc = System.IO.File.ReadAllBytes(pdfPathCriterioAS);
|
|||
|
|
//se carga el archivo y el registro a vision 2020
|
|||
|
|
string strResultado = oDoc.Archivar_Documento(strNumSolicitudTMP.ToString().Trim() + "|" + "Criterio técnico AS", strNombreCarta.ToString().Replace(" ", "_") + "-AS.pdf", bDoc);
|
|||
|
|
if (strResultado == string.Empty)
|
|||
|
|
{
|
|||
|
|
bResultado = true;
|
|||
|
|
File.Delete(pdfPathCriterioAS);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
bResultado = false;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
return bResultado;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Controles a Datos (R5)
|
|||
|
|
private DataSet obtenerAdjuntos()
|
|||
|
|
{
|
|||
|
|
DataSet dsResult = new DataSet();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
adjuntoBL objAdjuntoBL = new adjuntoBL();
|
|||
|
|
objAdjuntoBL.objadjuntoEL.FKSOLICITUD = int.Parse(strPKSolicitudTMP);
|
|||
|
|
//objAdjuntoBL.objadjuntoEL.FKREUTILIZA = int.Parse(strPKReutiliza);
|
|||
|
|
char[] separadorColumna = { '-' };
|
|||
|
|
string[] arrSolicitud = Session["SOLICITUD"].ToString().Split(separadorColumna);
|
|||
|
|
objAdjuntoBL.objadjuntoEL.NUMEROSOLICITUD = arrSolicitud[1].ToString();
|
|||
|
|
dsResult = objAdjuntoBL.listarAdjuntos(null, false);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return dsResult;
|
|||
|
|
}
|
|||
|
|
private void llenarAdjuntos()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataSet ds = obtenerAdjuntos();
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
//if (ds.Tables[0].Rows[0]["DESCRIPCIONDOCUMENTO"].ToString() != string.Empty)
|
|||
|
|
{
|
|||
|
|
grvListaAdjuntos.DataSource = ds;
|
|||
|
|
grvListaAdjuntos.DataBind();
|
|||
|
|
General.detalleGridView(ds, grvListaAdjuntos, null);
|
|||
|
|
//mostrarFilaTabla(1);
|
|||
|
|
|
|||
|
|
|
|||
|
|
// llenarRequisitos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// guarda y modifica registros en la tabla.
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
|
|||
|
|
private int GuardarDatosActividad(string p_accion) //M0
|
|||
|
|
{
|
|||
|
|
int nValorRetornado = 0;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
AyABL.TRA.correoBL objcorreoBL = new AyABL.TRA.correoBL();
|
|||
|
|
//string strModo = ViewState["MODO"].ToString();
|
|||
|
|
int nPkSolicitud = 0;
|
|||
|
|
int nResultadoActualizar = 0;
|
|||
|
|
string strMensajeContenido = "";
|
|||
|
|
string strAsuntoCorreo = "";
|
|||
|
|
string strPiePagina = "</BR> </BR></BR>AVISO DE CONFIDENCIALIDAD: este mensaje y la información incluida en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional o que no debe ser revelada. Si usted ha recibido este correo por error, por favor comunicarlo inmediatamente vía correo y tener la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje, ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. La transmisión de correos no garantiza que el correo electrónico sea seguro o libre de error. Por consiguiente, se advierte que esta información pueda estar incompleta o ser poco precisa ya que toda información está sujeta a alterarse sin previo aviso.”";
|
|||
|
|
|
|||
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|||
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|||
|
|
objSolicitudBL.objSolicitudEL.ORDEN = int.Parse(Session["NACTIVIDAD"].ToString());
|
|||
|
|
|
|||
|
|
DataSet dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
|||
|
|
|
|||
|
|
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string strEncargadoActividad = dsEncargadosActividades.Tables[0].Rows[0]["PKRESPONSABLEACTIVIDAD"].ToString();
|
|||
|
|
|
|||
|
|
ObservacionesActividadesBL objObservacionesBL = new ObservacionesActividadesBL();
|
|||
|
|
//objObservacionesBL.objobservacionesEL.FKNUMSOLICITUD = strNumSolicitudTMP;
|
|||
|
|
objObservacionesBL.objobservacionesEL.DESCRIPCION = "\n" + DateTime.Now.ToString()+ " - " + Session["NOMBREEMPLEADO"].ToString() + " - Se " + p_accion + " la notificación al usuario por parte del encargado : " + Session["NOMBREEMPLEADO"].ToString();
|
|||
|
|
objObservacionesBL.objobservacionesEL.FKUSUARIOXDEPENDENCIA = int.Parse(Session["PKUSUARIOXDEPENDENCIA"].ToString());
|
|||
|
|
objObservacionesBL.objobservacionesEL.PKRESPONSABLEACTIVIDAD = int.Parse(strEncargadoActividad);
|
|||
|
|
objObservacionesBL.objobservacionesEL.Fecha = DateTime.Now;
|
|||
|
|
objObservacionesBL.objobservacionesEL.TIPO = 1;
|
|||
|
|
//objObservacionesBL.objobservacionesEL.FKSOLICITUD = nPKSolicitud;
|
|||
|
|
//objObservacionesBL.objobservacionesEL.USUARIO = Session["LOGIN"].ToString();
|
|||
|
|
|
|||
|
|
nValorRetornado = objObservacionesBL.insertarObservacionActividad();
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (nValorRetornado != 0)
|
|||
|
|
{
|
|||
|
|
solicitudBL objSolicitud = new solicitudBL();
|
|||
|
|
//objSolicitud.objresponsableActividadEL.PK = int.Parse(Session["PKRESPONSABLEACTIVIDAD"].ToString());
|
|||
|
|
//poner la actividad actual en estado correspondiente
|
|||
|
|
objSolicitud.objresponsableActividadEL.FECHADEVOLUCION = DateTime.Now;
|
|||
|
|
|
|||
|
|
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
objSolicitud.objresponsableActividadEL.PK = int.Parse(row["PKRESPONSABLEACTIVIDAD"].ToString());
|
|||
|
|
if (p_accion == "finalizó")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
decimal nTiempoActividad = 0;
|
|||
|
|
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Crecimiento vegetativo")
|
|||
|
|
nTiempoActividad = decimal.Parse(row["TIEMPOCVACTIVIDAD"].ToString());
|
|||
|
|
if (row["CLASIFICACIONSOLICITUD"].ToString() == "Desarrollo urbanistico")
|
|||
|
|
nTiempoActividad = decimal.Parse(row["TIEMPODUACTIVIDAD"].ToString());
|
|||
|
|
|
|||
|
|
char[] separadorColumna = { '.' };
|
|||
|
|
string[] strArrayTiempo = nTiempoActividad.ToString().Replace(",", ".").Split(separadorColumna);
|
|||
|
|
|
|||
|
|
DateTime dtFechaRecibido = DateTime.Parse(row["FECHAASIGNACIONRESPONSABLEACTIVIDAD"].ToString()).AddDays(double.Parse(strArrayTiempo[0].ToString()));
|
|||
|
|
if (double.Parse(strArrayTiempo[1].ToString()) > 0)
|
|||
|
|
dtFechaRecibido = dtFechaRecibido.AddHours(4);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (dtFechaRecibido > DateTime.Now)
|
|||
|
|
objSolicitud.objresponsableActividadEL.FKESTADO = 5;//finalizada a tiempo t_sgm_estadoactividad
|
|||
|
|
else
|
|||
|
|
objSolicitud.objresponsableActividadEL.FKESTADO = 8;//finalizada fuera de tiempo t_sgm_estadoactividad
|
|||
|
|
|
|||
|
|
strMensajeContenido = "La actividad " + Session["DESCRIPCIONACTIVIDAD"].ToString() + " de la solicitud N° " + Session["SOLICITUD"].ToString() + " ha sido concluida para ver los detalles, ingrese al sistema <a href=http://" + HttpContext.Current.Request.Url.Authority + "/Forms/wfrLogin.> SIGDD</a>" + strPiePagina;
|
|||
|
|
strAsuntoCorreo = "Conclusión de actividad - SIGDD";
|
|||
|
|
|
|||
|
|
//cancelar notificacion
|
|||
|
|
notificacionBL objNotificacionBL = new notificacionBL();
|
|||
|
|
|
|||
|
|
objNotificacionBL.objnotificacionEL.ID_DOCUMENTO = Session["SOLICITUD"].ToString() + " - Notificación al usuario";
|
|||
|
|
objNotificacionBL.objnotificacionEL.status = "00";
|
|||
|
|
objNotificacionBL.objnotificacionEL.message = "OK";
|
|||
|
|
nValorRetornado = objNotificacionBL.cancelarNotificacion(objNotificacionBL.objnotificacionEL);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
nResultadoActualizar = objSolicitud.actualizarActividadSolicitud();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Envio de correo
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
int nActividad = int.Parse(Session["NACTIVIDAD"].ToString());
|
|||
|
|
//if (nActividad > 2)
|
|||
|
|
// nActividad = 2;//SE ENVIA PARA REPROGRAMAR11
|
|||
|
|
//else
|
|||
|
|
// nActividad = 1;
|
|||
|
|
|
|||
|
|
|
|||
|
|
//se envia correo a los encargados de la actividad 3
|
|||
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(Session["PKPROGRAMACION"].ToString());
|
|||
|
|
objSolicitudBL.objSolicitudEL.ORDEN = nActividad;
|
|||
|
|
dsEncargadosActividades = objSolicitudBL.dsListaActividadesEncargado(null);
|
|||
|
|
|
|||
|
|
if (dsEncargadosActividades.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow row in dsEncargadosActividades.Tables[0].Rows)
|
|||
|
|
{
|
|||
|
|
nPkSolicitud = Convert.ToInt32(row[1].ToString());//AQUI INSERTAMOS LA PK DE LA SOLICITUD
|
|||
|
|
|
|||
|
|
objcorreoBL.objcorreoEL.FKNUMSOLICITUD = nPkSolicitud;
|
|||
|
|
// objcorreoBL.objcorreoEL.CORREO = dsActividad.Tables[0].Rows[0]["LOGINUSUARIO"].ToString() + "@aya.go.cr";
|
|||
|
|
objcorreoBL.objcorreoEL.ASUNTO = strAsuntoCorreo;
|
|||
|
|
objcorreoBL.objcorreoEL.CONTENIDO = strMensajeContenido;
|
|||
|
|
objcorreoBL.objcorreoEL.FKUSUARIO = Convert.ToInt32(row["FKUSUARIOXDEPENDENCIA"].ToString());
|
|||
|
|
objcorreoBL.objcorreoEL.Fecha = DateTime.Now;
|
|||
|
|
|
|||
|
|
nValorRetornado = objcorreoBL.insertarCorreo();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + "Se finaliza la notificación al usuario por parte del encargado: " + Session["NOMBREEMPLEADO"].ToString().Trim() + " para la solicitud N° " + Session["SOLICITUD"].ToString(),
|
|||
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.IngresarRegistro + ": Se ingreso una nueva observacion: Se finaliza la notificación al usuario por parte del encargado: " + Session["NOMBREEMPLEADO"].ToString().Trim(),
|
|||
|
|
Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath),
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return nValorRetornado;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Datos a Controles (R6)
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Carga el grid principal
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="p_Llenar"></param>
|
|||
|
|
private void llenarGridNotificacionClientes() //M0
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
notificacionClienteBL objNotificacionClienteBL = new notificacionClienteBL();
|
|||
|
|
objNotificacionClienteBL.objnotificacionClienteEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
DataSet ds = objNotificacionClienteBL.listarNotificacionCliente();
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
grvLista.DataSource = ds;
|
|||
|
|
grvLista.DataBind();
|
|||
|
|
General.detalleGridView(ds, grvLista, null);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Verifica que se haya dado al menos una notificacion al usuario
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private bool VerificarNotificacion()
|
|||
|
|
{
|
|||
|
|
bool bValor = false;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (chkCFIA.Checked == false)
|
|||
|
|
{
|
|||
|
|
notificacionClienteBL objNotificacionClienteBL = new notificacionClienteBL();
|
|||
|
|
objNotificacionClienteBL.objnotificacionClienteEL.FKSOLICITUD = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
DataSet ds = objNotificacionClienteBL.listarNotificacionCliente();
|
|||
|
|
|
|||
|
|
if (ds.Tables[0].Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
bValor = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
string strRutaArchivosAdjuntos = string.Empty;
|
|||
|
|
int nNumSolicitudTMP = int.Parse(Session["PKSOLICITUD"].ToString());
|
|||
|
|
strRutaArchivosAdjuntos = obtenerCartaSolicitud(nNumSolicitudTMP);
|
|||
|
|
|
|||
|
|
//crear documento zip con los archivos adjuntos
|
|||
|
|
string strRutaDocumentos = ConfigurationManager.AppSettings["RutaPdfAdjuntosSql"].ToString() + @"\" + lblNumSolicitud.Text;
|
|||
|
|
DirectoryInfo diCarpeta = new DirectoryInfo(strRutaDocumentos);
|
|||
|
|
ZipFile zip = new ZipFile();
|
|||
|
|
foreach(FileInfo fi in diCarpeta.GetFiles())
|
|||
|
|
{
|
|||
|
|
if(fi.Extension == ".pdf")
|
|||
|
|
zip.AddFile(strRutaDocumentos + @"\" + fi.Name, "");
|
|||
|
|
}
|
|||
|
|
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(strPKSolicitudTMP);
|
|||
|
|
|
|||
|
|
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());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//enviar notificacion a CFIA con el servicio de respuesta
|
|||
|
|
if (File.Exists(strRutaDocZip) && nNumeroSolicitudCFIA != 0)
|
|||
|
|
{
|
|||
|
|
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, txtObservaciones.Text, 3, Session["LOGIN"].ToString(), bRespuestaZip, 3, ConfigurationManager.AppSettings["LLAVEAPCR"].ToString());
|
|||
|
|
if (respuestaAPCR.Respuesta == true)
|
|||
|
|
{
|
|||
|
|
bValor = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
bValor = false;
|
|||
|
|
MensajeAlerta("Se presento el siguiente problema a la hora de notificar al CFIA: " + respuestaAPCR.DescripcionError);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return bValor;
|
|||
|
|
}
|
|||
|
|
public void obtenerCorreo()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|||
|
|
objSolicitudBL.objSolicitudEL.PK = int.Parse(strPKSolicitudTMP);
|
|||
|
|
|
|||
|
|
DataSet dsSolicitud = objSolicitudBL.dsExisteSolicitud(null);
|
|||
|
|
|
|||
|
|
if (dsSolicitud.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
txtDestinatario.Text = dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICOSOLICITUD"].ToString() + ";" + dsSolicitud.Tables[0].Rows[0]["CORREOELECTRONICO2SOLICITUD"].ToString();
|
|||
|
|
chkCFIA.Checked = bool.Parse(dsSolicitud.Tables[0].Rows[0]["SOLICITACFIASOLICITUD"].ToString());
|
|||
|
|
if (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());
|
|||
|
|
else
|
|||
|
|
nNumeroSolicitudCFIA = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch(Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|