コード例 #1
0
    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);
    }
コード例 #2
0
    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);
    }
コード例 #3
0
ファイル: Register.cs プロジェクト: davisbd100/ClientePacman
    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);
    }