Esempio n. 1
0
        public int AdicionarArchivoNotificacionProcesoDisciplinario(Decimal ID_PROCESO, Decimal REGISTRO_DESCARGO, Byte[] ARCHIVO_NOTIFICACION,
            Int32 ARCHIVO_NOTIFICACION_TAMANO,
            String ARCHIVO_NOTIFICACION_EXTENSION,
            String ARCHIVO_NOTIFICACION_TYPE)
        {
            String sql = null;
            Int32 registrosActualizados = 0;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_reg_proceso_disciplinario_actualizar_notificacion ";

            #region validaciones
            if (ID_PROCESO != 0)
            {
                sql += ID_PROCESO + ", ";
                informacion += "ID_PROCESO = " + ID_PROCESO + ", ";
            }
            else
            {
                MensajeError += "El campo ID_PROCESO no puede ser 0\n";
                ejecutar = false;
            }

            sql += "'[DATOS_BINARIOS]', ";
            informacion += "ARCHIVO_NOTIFICACION = '[DATOS_BINARIOS]', ";

            sql += "'" + ARCHIVO_NOTIFICACION_EXTENSION + "', ";
            informacion += "ARCHIVO_NOTIFICACION_EXTENSION = '" + ARCHIVO_NOTIFICACION_EXTENSION + "', ";

            sql += ARCHIVO_NOTIFICACION_TAMANO + ", ";
            informacion += "ARCHIVO_NOTIFICACION_TAMANO = '" + ARCHIVO_NOTIFICACION_TAMANO + "', ";

            sql += "'" + ARCHIVO_NOTIFICACION_TYPE + "', ";
            informacion += "ARCHIVO_NOTIFICACION_TYPE = '" + ARCHIVO_NOTIFICACION_TYPE + "', ";

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";
            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                conexion.IniciarTransaccion();
                try
                {
                    registrosActualizados = conexion.ExecuteNonQueryParaAdicionarArchivoNotificacionProcesoDisciplianario(ID_PROCESO, ARCHIVO_NOTIFICACION, ARCHIVO_NOTIFICACION_EXTENSION, ARCHIVO_NOTIFICACION_TAMANO, ARCHIVO_NOTIFICACION_TYPE, Usuario);

                    if (registrosActualizados <= 0)
                    {
                        conexion.DeshacerTransaccion();
                        MensajeError = "ERROR: al intentar actualizar el proceso.";
                    }
                    else
                    {
                        auditoria _auditoria = new auditoria(Empresa);

                        if (terminarProcesoDescargo(REGISTRO_DESCARGO, conexion) == false)
                        {
                            conexion.DeshacerTransaccion();
                        }
                        else
                        {
                            if (!(_auditoria.Adicionar(Usuario, tabla.CON_REG_PROCESOS_DISCIPLINARIOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion)))
                            {
                                conexion.DeshacerTransaccion();
                            }
                            else
                            {
                                conexion.AceptarTransaccion();
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    conexion.DeshacerTransaccion();
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return registrosActualizados;
        }