TFS_ANTIGUO/SIGPC/wcfSigdd/AyABL/TRA/adjuntosBL.cs

108 lines
3.9 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Configuration;
using AyAEL.Tran;
using AyADAL;
using System.Collections.Specialized;
using Helper;
namespace AyABL.Tran
{
public class adjuntosBL : AyABL
{
#region Constructores
public adjuntosBL()
{
objAdjuntosEL = new adjuntosEL();
this.NombreConeccionBD = BASESDEDATOS.SIGPC.ToString();
}
#endregion
#region Atributos
public AyAEL.Tran.adjuntosEL objAdjuntosEL
{
get;
set;
}
private static NameValueCollection appSettings = ConfigurationManager.AppSettings;
#endregion
#region Metodos
/// <summary>
/// Inserta un nuevo registro en la base de datos
/// </summary>
/// <returns></returns>
public AdjuntoList InsertarRequisitoSolicitud(adjuntosEL objAdjunto)
{
AdjuntoList adjuntoList = new AdjuntoList();
adjuntosEL adjuntosEl = new adjuntosEL();
DbParameter[] p_dbpParametros = new DbParameter[6];
try
{
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
CryptographyManager cryptographyManager = new CryptographyManager();
for (int index = 0; index < p_dbpParametros.Length; ++index)
p_dbpParametros[index] = factory.CreateParameter();
p_dbpParametros[0].ParameterName = "@P_STATUS";
p_dbpParametros[0].DbType = DbType.String;
p_dbpParametros[0].Size = 2;
p_dbpParametros[0].Direction = ParameterDirection.InputOutput;
p_dbpParametros[1].ParameterName = "@P_MENSAJE";
p_dbpParametros[1].DbType = DbType.String;
p_dbpParametros[1].Size = 500;
p_dbpParametros[1].Direction = ParameterDirection.InputOutput;
p_dbpParametros[2].ParameterName = "@NOMBREDOCUMENTO";
p_dbpParametros[2].Value = (object)cryptographyManager.Desencriptar(objAdjunto.NOMBREDOCUMENTO);
p_dbpParametros[2].DbType = DbType.String;
p_dbpParametros[2].Size = 100;
p_dbpParametros[3].ParameterName = "@DESCRIPCIONDOCUMENTO";
p_dbpParametros[3].Value = (object)cryptographyManager.Desencriptar(objAdjunto.DESCRIPCIONEDOCUMENTO);
p_dbpParametros[3].DbType = DbType.String;
p_dbpParametros[3].Size = 100;
p_dbpParametros[4].ParameterName = "@FKREQUISITO";
p_dbpParametros[4].Value = (object)objAdjunto.FKREQUISITO;
p_dbpParametros[4].DbType = DbType.Int32;
p_dbpParametros[5].ParameterName = "@FKSOLICITUD";
p_dbpParametros[5].Value = (object)objAdjunto.FKSOLICITUD;
p_dbpParametros[5].DbType = DbType.Int32;
this.baseDAL.intProcedimiento("PA_IUDREQUISITOSCFIA", ref p_dbpParametros, this.NombreConeccionBD);
adjuntoList.datos.Add(adjuntosEl);
adjuntoList.NumeroError = p_dbpParametros[0].Value.ToString();
adjuntoList.MensajeError = p_dbpParametros[1].Value.ToString();
return adjuntoList;
}
catch (Exception ex)
{
adjuntoList.NumeroError = p_dbpParametros[0].Value.ToString() + " : Error del sitio web: " + ex.HResult.ToString();
adjuntoList.MensajeError = p_dbpParametros[1].Value.ToString() + " : Error del sitio web: " + ex.Message.ToString();
adjuntoList.datos.Add(objAdjunto);
return adjuntoList;
}
}
#endregion
}
}