Beispiel #1
0
        public User Login(string email, string password)
        {
            var userReader = Reader.GetTableReader(UserRequest.User(email, password));

            userReader.Read();
            var role = new Role(userReader["RoleId"].ToString());
            var user = new User(
                userReader["Email"].ToString(),
                userReader["Password"].ToString(),
                userReader["FirstName"].ToString(),
                userReader["LastName"].ToString(),
                role
                );

            if (role.roleId == "R")
            {
                var runnerReader = Reader.GetTableReader(UserRequest.RunnerData(email));
                runnerReader.Read();
                var runner = new RunnerData(
                    runnerReader["Gender"].ToString(),
                    runnerReader["Date"].ToString(),
                    runnerReader["CountryCode"].ToString(),
                    runnerReader["CountryName"].ToString()
                    );
                user.runnerData = runner;
            }


            return(user);
        }
        private RunnerData GetRunnerData(string email)
        {
            var runnerReader = Reader.GetTableReader(UserRequest.RunnerData(email));

            runnerReader.Read();
            var country = new Country(
                runnerReader["CountryCode"].ToString(),
                runnerReader["CountryName"].ToString()
                );
            var runner = new RunnerData(
                runnerReader["RunnerId"].ToString(),
                runnerReader["Gender"].ToString(),
                runnerReader["Date"].ToString(),
                country
                );

            return(runner);
        }
Beispiel #3
0
 public static string UpdateRunnerData(RunnerData runner, string email)
 {
     return($"UPDATE [Runner] SET Gender = '{runner.gender}', DateOfBirth = '{Convert.ToDateTime(runner.birthday)}', CountryCode = '{runner.countryCode}' " +
            $"WHERE Email = '{email}'");
 }
Beispiel #4
0
 public static string UpdateRunnerData(RunnerData runner, string email)
 {
     return($"UPDATE [Runner] SET Gender = '{runner.gender}', DateOfBirth = @DateOfBirth, CountryCode = '{runner.country.code}' " +
            $"WHERE Email = '{email}'");
 }