698 lines
23 KiB
C#
698 lines
23 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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Javascript.CheckAllGridViewItems(Page);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R0M1", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Variables (R1)
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
adjuntoBL objAdjuntoBL;
|
|||
|
|
|
|||
|
|
solicitudBL objSolicitudBL = new solicitudBL();
|
|||
|
|
|
|||
|
|
|
|||
|
|
public string strPKReutiliza = "0";
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strNumSolicitudTMP = "0";
|
|||
|
|
|
|||
|
|
#region variables del estandar
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
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")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
btnSubirarchivo.Enabled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (Session["ESTADO"] != null)
|
|||
|
|
{
|
|||
|
|
if (Session["ESTADO"].ToString() == "Finalizada" || Session["ESTADO"].ToString() == "Cancelada")
|
|||
|
|
{
|
|||
|
|
btnSubirarchivo.Enabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((!IsPostBack) && (Session.Count > 0))
|
|||
|
|
{
|
|||
|
|
Session["Pagina"] = "";
|
|||
|
|
EjecutarScript("");//PERMITE QUE SOLO SE MUESTRE UN BOTON EN LA PÁGINA
|
|||
|
|
mostrarFilaTabla(1);
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
ComandosxMenu();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Session["Pagina"] == null)
|
|||
|
|
{
|
|||
|
|
//Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript:parent.closeIFrameAdjunto();</script>"); }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Session["Pagina"] == null)
|
|||
|
|
{
|
|||
|
|
//Response.Redirect("../wfrLogin.aspx?sesion=expiro", false);
|
|||
|
|
{ ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>javascript:parent.closeIFrameAdjunto();</script>"); }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R2M0", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Eventos Controles Web (R3)
|
|||
|
|
|
|||
|
|
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)
|
|||
|
|
|
|||
|
|
/// <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:
|
|||
|
|
|
|||
|
|
divDatosSuperiores.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 2:
|
|||
|
|
|
|||
|
|
divDatosMedios.Visible = true;
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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 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;
|
|||
|
|
|
|||
|
|
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)
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Metodos Datos a Controles (R6)
|
|||
|
|
|
|||
|
|
private void llenarAdjuntos()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
|
|||
|
|
// llenarRequisitos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
objAdjuntoBL = new adjuntoBL();
|
|||
|
|
objAdjuntoBL.objadjuntoEL.PK = p_intPkConsultar;
|
|||
|
|
DataSet dsRequisito = objAdjuntoBL.listarAdjuntos(null,false);
|
|||
|
|
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#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 nFKAdjunto = 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[8].Text + @"\DocumentosREQ\";
|
|||
|
|
//Serverpath += "\\" + lblNumSolicitud.Text.Trim() + "\\DocumentosREQ";
|
|||
|
|
string file = selectedRow.Cells[1].Text;
|
|||
|
|
string fileDirectory = Serverpath + "\\" + file.Replace(" ", "_"); ;
|
|||
|
|
File.Delete(fileDirectory);
|
|||
|
|
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
|
|||
|
|
RequisitostmpBL objRequisitostmpBLVerifica = new RequisitostmpBL();
|
|||
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|||
|
|
objRequisitostmpBLVerifica.objRequisitostmpEL.FKREQUISITO = nFKAdjunto;
|
|||
|
|
DataSet dsResult = objRequisitostmpBLVerifica.dsListaAdjuntos();
|
|||
|
|
|
|||
|
|
if (dsResult.Tables[0].Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
objAdjuntoBL = new adjuntoBL();
|
|||
|
|
objAdjuntoBL.objadjuntoEL.FK = nFKAdjunto;
|
|||
|
|
objAdjuntoBL.objadjuntoEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|||
|
|
|
|||
|
|
objAdjuntoBL.eliminarAdjunto();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
GuardarEventoBitacora(
|
|||
|
|
Session["LOGIN"].ToString(),
|
|||
|
|
AccionBitacora.INSERT.ToString(),
|
|||
|
|
MensajesBitacora.EliminarRegistro + ": Se ha eliminado el adjunto " + strNombreAdjunto + " de la solicitud " + lblNumSolicitud.Text,
|
|||
|
|
"frwAdjuntosSolicitud.aspx",
|
|||
|
|
Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"])
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (e.CommandName == "ver")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string pdfPath = ConfigurationManager.AppSettings["DocumentosPDF"].ToString() + @"\" + selectedRow.Cells[7].Text + @"\DocumentosREQ\" + strNombreAdjunto;
|
|||
|
|
string targetURL = "'../../DocumentosPDF/" + selectedRow.Cells[7].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[7].Text.Trim() + "|Otros", selectedRow.Cells[7].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 grvLista_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
grvLista.PageIndex = e.NewPageIndex;
|
|||
|
|
llenarAdjuntos();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MensajeError("Error en R3M3", ex);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool eliminarAdjunto(int nPk)
|
|||
|
|
{
|
|||
|
|
bool bResult = false;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
objAdjuntoBL = new adjuntoBL();
|
|||
|
|
objAdjuntoBL.objadjuntoEL.PK = nPk;
|
|||
|
|
objAdjuntoBL.eliminarAdjunto();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
bResult = true;
|
|||
|
|
}
|
|||
|
|
catch(Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
return bResult;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private DataSet obtenerAdjuntos()
|
|||
|
|
{
|
|||
|
|
DataSet dsResult = new DataSet();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
objAdjuntoBL = new adjuntoBL();
|
|||
|
|
objAdjuntoBL.objadjuntoEL.FKSOLICITUD = int.Parse(strNumSolicitudTMP);
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
protected void grvLista_RowDataBound(object sender, GridViewRowEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
e.Row.Cells[4].Visible = false;
|
|||
|
|
e.Row.Cells[5].Visible = false;
|
|||
|
|
e.Row.Cells[7].Visible = false;
|
|||
|
|
GridViewRow selectedRow = e.Row;
|
|||
|
|
if ( e.Row.RowType == DataControlRowType.DataRow)
|
|||
|
|
{
|
|||
|
|
e.Row.Cells[5].Visible = false;
|
|||
|
|
e.Row.Cells[8].Visible = false;
|
|||
|
|
e.Row.Cells[6].ToolTip = "Ver adjunto";
|
|||
|
|
if (int.Parse(strNumSolicitudTMP) == int.Parse(e.Row.Cells[4].Text) )
|
|||
|
|
{
|
|||
|
|
e.Row.Cells[5].ToolTip = "Eliminar adjunto";
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (Session["ESTADO"].ToString() == "Bloqueada")
|
|||
|
|
e.Row.Cells[5].Visible = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{ }
|
|||
|
|
}
|
|||
|
|
}
|