public Task Confirm() { ConfirmationServicesClient confirmation; confirmation = new ConfirmationServicesClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress("net.tcp://" + CurrentPlayer.IPDirection + ":8091/ConfirmationServices")); IConfirmationServicesJugador jugador = new IConfirmationServicesJugador(); jugador.Código = Code_InputField.text; jugador.Correo = CurrentPlayer.Email; Debug.Log(CurrentPlayer.Código); Debug.Log(CurrentPlayer.Email); try { switch (confirmation.ChangeConfirmationStatus(jugador)) { case DBOperationResultAddResult.SQLError: throw new TimeoutException(); case DBOperationResultAddResult.WrongCredentials: throw new WrongCodeException(); } } catch (SocketException) { throw new SocketException(); } catch (TimeoutException) { throw new TimeoutException(); } return(Task.CompletedTask); }
public Task NewCode() { System.Random generator = new System.Random(); ConfirmationServicesClient confirmation; confirmation = new ConfirmationServicesClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress("net.tcp://" + CurrentPlayer.IPDirection + ":8091/ConfirmationServices")); IConfirmationServicesJugador jugador = new IConfirmationServicesJugador(); jugador.Código = generator.Next(0, 999999).ToString("D6"); jugador.Correo = CurrentPlayer.Email; try { if (confirmation.GenerateNewCode(jugador) == DBOperationResultAddResult.SQLError) { throw new TimeoutException(); } } catch (SocketException) { throw new SocketException(); } catch (TimeoutException) { throw new TimeoutException(); } CurrentPlayer.Código = jugador.Código; return(Task.CompletedTask); }
private void SendEmail(IRegisterServiceJugador jugador) { ConfirmationServicesClient confirmation; confirmation = new ConfirmationServicesClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress("net.tcp://" + CurrentPlayer.IPDirection + ":8091/ConfirmationServices")); IConfirmationServicesJugador player = new IConfirmationServicesJugador(); player.Correo = jugador.Correo; player.Código = jugador.Código; confirmation.SendEmail(player); }