public ClassResultV Usp_Mensajes_Update_Respuesta(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            DtoMensajes  dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Value = dto.IdMensaje
                };
                pr[1] = new SqlParameter("@Respuesta", SqlDbType.VarChar, 3000)
                {
                    Value = (V_ValidaPrNull(dto.Respuesta))
                };
                pr[2] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };

                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_Update_Respuesta", pr);
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar la respuesta";
            }
            ObjCn.Close();
            return(cr);
        }
        public DtoMensajes Usp_Mensajes_SelectOne(DtoB dtoBase)
        {
            DtoMensajes dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Value = (dto.IdMensaje)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_SelectOne", pr);

                if (reader.Read())
                {
                    dto = new DtoMensajes
                    {
                        IdMensaje             = GetValue("IdMensaje", reader).ValueInt32,
                        ContactoId            = GetValue("ContactoId", reader).ValueInt32,
                        Asunto                = GetValue("Asunto", reader).ValueString,
                        Mensaje               = GetValue("Mensaje", reader).ValueString,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Respondido         = GetValue("IB_Respondido", reader).ValueBool,
                        Respuesta             = GetValue("Respuesta", reader).ValueString,
                        IN_TipoMensaje        = GetValue("IN_TipoMensaje", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Mensajes_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoMensajes Usp_Mensajes_Insert(DtoB dtoBase)
        {
            DtoMensajes dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@ContactoId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.ContactoId))
                };
                pr[2] = new SqlParameter("@Asunto", SqlDbType.VarChar, 500)
                {
                    Value = (V_ValidaPrNull(dto.Asunto))
                };
                pr[3] = new SqlParameter("@Mensaje", SqlDbType.VarChar, 3000)
                {
                    Value = (V_ValidaPrNull(dto.Mensaje))
                };
                pr[4] = new SqlParameter("@IN_TipoMensaje", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_TipoMensaje))
                };
                pr[5] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.OrganizacionId))
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_Insert", pr);
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al crear mensaje";
            }
            ObjCn.Close();
            return(dto);
        }