public IActionResult EliminarAmigo(AdapterId ids) { var id1 = Convert.ToInt32(ids.id); var id2 = Convert.ToInt32(ids.comentario); _dataService.EliminarAmigo(id1, id2); return(Json(new { success = true })); }
public IActionResult CommentPost(AdapterId idPost) { var id = Convert.ToInt32(idPost.id); var c = idPost.comentario; _dataService.AgregarComentario(UsuarioActual.GetUsuarioActual().GetUser().idPersona, c, id); //_dataService.LikePost(id); UsuarioActual.GetUsuarioActual().ActualizarMisPost(); UsuarioActual.GetUsuarioActual().ActualizarPostAmigos(); return(Json(new { success = true })); }
protected override void DoExecute(CodeActivityContext context) { devlog.Debug(string.Format("Called on '{0}'and '{1}'", ExchangeAppointment, AdapterId)); var myExchangeAppointment = ExchangeAppointment.Get(context); var myAdapterId = AdapterId.Get(context); devlog.Debug(string.Format("Got '{0}' and '{1}'", myExchangeAppointment, myAdapterId)); var dto = ExchangeRepository.ConvertToDTO(myExchangeAppointment, myAdapterId); AdapterAppointment.Set(context, dto); }
public bool Equals(IScreen other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(AdapterId.Equals(other.AdapterId) && OutputName.Equals(other.OutputName)); }
public IActionResult AgregarPost(AdapterId r) { var m = r.id; var url = r.comentario; if (url == null) { url = ""; } var res = _dataService.AgregarPost(m, UsuarioActual.GetUsuarioActual().GetUser().idPersona, url); UsuarioActual.GetUsuarioActual().ActualizarMisPost(); BusquedaTexto busqueda = new BusquedaTexto(m); BuscarHashtag opBuscarHashtag = new BuscarHashtag(busqueda); BuscarEtiqueta opBuscarEtiqueta = new BuscarEtiqueta(busqueda); Invoker invoker = new Invoker(); invoker.recibirOperacion(opBuscarHashtag); invoker.recibirOperacion(opBuscarEtiqueta); invoker.realizarOperaciones(); var q = busqueda.resultado; var e = busqueda.resultadoEtiquetas; foreach (var h in q) { _dataService.AgregarHashtag(h, res.Item2); } foreach (var ee in e) { Persona amigo = UsuarioActual.GetUsuarioActual().GetAmigos().Find(item => item.Nombre == ee.Item1 && item.Apellido == ee.Item2); if (amigo != null) { _dataService.AgregarEtiqueta(res.Item2, amigo.idPersona); //id dueño, id que etiqueta, post notificacion = new NotificacionLike(amigo.idPersona, UsuarioActual.GetUsuarioActual().GetUser().idPersona, res.Item2); notificacion = new Mencion(notificacion); notificacion.setTipo(); notificacion.Notificar(); } } return(Json(new { success = true })); }
public IActionResult SearchFriend(AdapterId busqueda) { UsuarioActual.GetUsuarioActual().ActualizarAmigos(); var bus = busqueda.id; var op = Convert.ToInt32(busqueda.comentario); SearchClass search = new SearchClass(new SearchName(), bus); if (op == 2) { search = new SearchClass(new SearchLastname(), bus); } else if (op == 3) { search = new SearchClass(new SearchCorreo(), bus); } var result = search.Search(); UsuarioActual.GetUsuarioActual().Buscar(result); return(Json(new { success = true, res = result, redirecturl = Url.Action("Index1", "Home") })); }
private void Teardown() { Console.WriteLine("Teardown connection to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); bluetoothClient?.Dispose(); bluetoothClient = null; disconnectedChannel.SetIsClosed(true); }
public async Task SendAsync(byte[] data) { using (await synchronization.LockAsync().ConfigureAwait(false)) { Console.WriteLine("Sending to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); try { var stream = bluetoothClient.GetStream(); await stream.WriteAsync(BitConverter.GetBytes(data.Length), 0, 4).ConfigureAwait(false); await stream.WriteAsync(data, 0, data.Length).ConfigureAwait(false); Console.WriteLine("Sent to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); } catch { Console.WriteLine("Failed to send to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); Teardown(); throw new NotConnectedException(); } } }
public async Task <bool> TryHandshakeAsync(double minTimeoutSeconds) { try { using (await synchronization.LockAsync().ConfigureAwait(false)) { Console.WriteLine("Attempting to connect to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); bluetoothClient = new BluetoothClient(); bluetoothClient.Authenticate = false; bluetoothClient.Encrypt = false; await bluetoothClient.ConnectAsync(address, CAMPFIRE_NET_SERVICE_CLASS).ConfigureAwait(false); disconnectedChannel.SetIsClosed(false); Console.WriteLine("Connected. Their Adapter ID is " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); ChannelsExtensions.Go(async() => { Console.WriteLine("Entered BT Reader Task"); var networkStream = bluetoothClient.GetStream(); try { while (!disconnectedChannel.IsClosed) { Console.WriteLine("Reading BT Frame"); var dataLengthBuffer = await ReadBytesAsync(networkStream, 4).ConfigureAwait(false); var dataLength = BitConverter.ToInt32(dataLengthBuffer, 0); Console.WriteLine("Got BT Frame Length: " + dataLength); var data = await ReadBytesAsync(networkStream, dataLength).ConfigureAwait(false); await inboundChannel.WriteAsync(data).ConfigureAwait(false); } } catch (Exception e) { Console.WriteLine(e); Teardown(); } }).Forget(); return(true); } } catch (Exception e) { Console.WriteLine("Failed to connect to ID " + AdapterId + " AKA " + string.Join(" ", AdapterId.ToByteArray())); Console.WriteLine(e.GetType().FullName); return(false); } }
/// <inheritdoc /> public override int GetHashCode() { return(AdapterId.GetHashCode()); }