Exemplo n.º 1
0
 /**
  * @author Anthony Scheeres
  */
 private bool isValideUsernamePasswordEmail(string username, string password, string email)
 {
     return(!ValidateInputUtilities.isNullOrEmty(username) && !ValidateInputUtilities.isNullOrEmty(password) && ValidateInputUtilities.IsValidEmail(email));
 }
        private double TokenToUserIdn(string token)
        {
            var sqlQueryForRegistingUser = "******";

            using var connectionWithDatabase = ConnectionProvider.getProvide();

            connectionWithDatabase.Open(); //open the connection


            using var command = new NpgsqlCommand(sqlQueryForRegistingUser, connectionWithDatabase);


            command.Parameters.AddWithValue("token", token);

            command.Prepare(); //Construct and optimize query

            var i  = command.ExecuteReader();
            int id = 0;

            PsqlUtilities.GetAll(i).ForEach(r => { Console.WriteLine(r.GetValue(0).ToString()); if (ValidateInputUtilities.isNumeric(r.GetValue(0).ToString()))
                                                   {
                                                       id = int.Parse(r.GetValue(0).ToString());
                                                   }
                                            });


            connectionWithDatabase.Close(); //close the connection to save bandwith
            return(id);
        }