public static UserData GetUserData() { GetUserDataCommand command = new GetUserDataCommand(); command.EMail = EMAIL; command.Hash = HASH; return(JsonConvert.DeserializeObject <UserData>(TCPManager.SendRequest(JsonConvert.SerializeObject(command)))); }
public async Task <CommandResult <InputUserDataResult> > GetUsers([FromServices] GetUserDataCommand _getUserDataCommand, string siteId, string cookieSessionId = null) { var userInput = new UserInput <GetUserDataInput> { Data = new GetUserDataInput { SiteId = siteId }, UserId = User?.GetUserId() }; var result = await Business .InvokeAsync <GetUserDataCommand, UserInput <GetUserDataInput>, CommandResult <InputUserDataResult> >( _getUserDataCommand, userInput).ConfigureAwait(false); return(result); }
private static string GetUserData(string CommandPara) { SQLManager.Connection.Close(); UserData Result = new UserData(); GetUserDataCommand Command = new GetUserDataCommand(); Command = JsonConvert.DeserializeObject <GetUserDataCommand>(CommandPara); if (CheckUserData(Command.EMail, Command.Hash) == false) { Result.statusCode = 270; return(JsonConvert.SerializeObject(Result)); } using (MySqlCommand mysqlCommand = SQLManager.Connection.CreateCommand()) { SQLManager.Connection.Open(); mysqlCommand.CommandText = "SELECT UID, Firstname, Lastname, Gender, HasSelected, HasActivated FROM users WHERE EMail='" + Command.EMail + "'"; MySqlDataReader mysqlreader; mysqlreader = mysqlCommand.ExecuteReader(); if (mysqlreader.Read()) { Result.UID = mysqlreader.GetInt32("UID"); Result.Firstname = mysqlreader.GetString("Firstname"); Result.Lastname = mysqlreader.GetString("Lastname"); Result.Gender = mysqlreader.GetString("Gender"); Result.HasActivated = mysqlreader.GetBoolean("HasActivated"); Result.HasSelected = mysqlreader.GetBoolean("HasSelected"); } mysqlreader.Close(); SQLManager.Connection.Close(); Result.statusCode = 201; return(JsonConvert.SerializeObject(Result)); } }
protected void GetUserDataCommandHandler(GetUserDataCommand cmd) { _backendService.GetUserData(cmd.UserID, cmd.Fields); }