public static void registerNewUser(string[] fullcommand) { if (fullcommand.Length == 5) { try { string username = fullcommand[1]; string password = fullcommand[2]; string country = fullcommand[3]; string stringBirthdate = fullcommand[4]; DateTime birthdate = DateTime.Parse(stringBirthdate); if (UserService.Register(username, password, birthdate, country)) { users.Add(username, password); Logger.Log("event", logLevel.INFO, $"user {username} add"); } } catch (Exception e) { Logger.Log("error", logLevel.ERROR, $"Init system: register user {e.Data}"); } } else { Logger.Log("error", logLevel.ERROR, "Init system: register user bad input"); } }
//public string Register(string username, string password) //{ // bool ret; // try // { // ret = UserService.Register(username, password); // return resultJson(ret); // } // catch (Exception e) // { // return generateMessageFormatJason(e.Message); // } //} public string Register(string username, string password, DateTime birthdate, string country) { bool ret; try { ret = UserService.Register(username, password, birthdate, country); return(resultJson(ret)); } catch (Exception e) { return(generateMessageFormatJason(e.Message)); } }
//public bool Register(string username, string password) //{ // return UserService.Register(username, password); //} public bool Register(string username, string password, DateTime birthdath, string country) { return(UserService.Register(username, password, birthdath, country)); }