Fix eliminazione e cancellazione utenti
This commit is contained in:
+89
-18
@@ -63,6 +63,8 @@ namespace TestClient
|
||||
btnGetUserList.Enabled = enableBtn;
|
||||
btnTryUserLogin.Enabled = enableBtn;
|
||||
btnGetUserCreatedList.Enabled = enableBtn;
|
||||
btnImportUser.Enabled = enableBtn;
|
||||
btnDeleteUserHMI.Enabled = enableBtn;
|
||||
// controllo se visualizzare parametri di testing...
|
||||
bool showTP = chkTestMode.Checked;
|
||||
lblTokRet.Visible = showTP;
|
||||
@@ -354,13 +356,13 @@ namespace TestClient
|
||||
sb.AppendLine(string.Format("Cognome: {0}", userList[0].Cognome));
|
||||
sb.AppendLine(string.Format("Nome: {0}", userList[0].Nome));
|
||||
sb.AppendLine(string.Format("Status: {0}", userList[0].LoginStatus.ToString()));
|
||||
lblConsole.Text = sb.ToString();
|
||||
// aggiungo IMG user... se vuota default...
|
||||
if (userList[0].UserImage == null)
|
||||
{
|
||||
userList[0].UserImage = Image.FromFile(@"resources\userImg.png");
|
||||
}
|
||||
pictBox.Image = userList[0].UserImage;
|
||||
lblConsole.Text = sb.ToString();
|
||||
// refresh!
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
@@ -383,21 +385,24 @@ namespace TestClient
|
||||
sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine("USERS CREATED FOUND: " + userList.Count.ToString());
|
||||
sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine("first user:");
|
||||
sb.AppendLine(string.Format("user_id: {0}", userList[0].UserId));
|
||||
sb.AppendLine(string.Format("isAdmin: {0}", userList[0].IsAdmin));
|
||||
sb.AppendLine(string.Format("UserName: {0}", userList[0].Username));
|
||||
sb.AppendLine(string.Format("Email: {0}", userList[0].Email));
|
||||
sb.AppendLine(string.Format("Cognome: {0}", userList[0].Cognome));
|
||||
sb.AppendLine(string.Format("Nome: {0}", userList[0].Nome));
|
||||
sb.AppendLine(string.Format("Status: {0}", userList[0].LoginStatus.ToString()));
|
||||
lblConsole.Text = sb.ToString();
|
||||
// aggiungo IMG user... se vuota default...
|
||||
if (userList[0].UserImage == null)
|
||||
if (userList.Count > 0)
|
||||
{
|
||||
userList[0].UserImage = Image.FromFile(@"resources\userImg.png");
|
||||
sb.AppendLine("first user:");
|
||||
sb.AppendLine(string.Format("user_id: {0}", userList[0].UserId));
|
||||
sb.AppendLine(string.Format("isAdmin: {0}", userList[0].IsAdmin));
|
||||
sb.AppendLine(string.Format("UserName: {0}", userList[0].Username));
|
||||
sb.AppendLine(string.Format("Email: {0}", userList[0].Email));
|
||||
sb.AppendLine(string.Format("Cognome: {0}", userList[0].Cognome));
|
||||
sb.AppendLine(string.Format("Nome: {0}", userList[0].Nome));
|
||||
sb.AppendLine(string.Format("Status: {0}", userList[0].LoginStatus.ToString()));
|
||||
// aggiungo IMG user... se vuota default...
|
||||
if (userList[0].UserImage == null)
|
||||
{
|
||||
userList[0].UserImage = Image.FromFile(@"resources\userImg.png");
|
||||
}
|
||||
pictBox.Image = userList[0].UserImage;
|
||||
}
|
||||
pictBox.Image = userList[0].UserImage;
|
||||
lblConsole.Text = sb.ToString();
|
||||
// refresh!
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
@@ -415,7 +420,7 @@ namespace TestClient
|
||||
UserData userData = new UserData();
|
||||
var userResult = MCC.TryUserLogin(user, pwd);
|
||||
List<UserData> userList = ((UserPayload)userResult.Result.Payload).UserList;
|
||||
|
||||
var currImage = pictBox.Image;
|
||||
// controllo se ho risultato...)
|
||||
if (userList.Count == 1)
|
||||
{
|
||||
@@ -436,13 +441,12 @@ namespace TestClient
|
||||
sb.AppendLine(string.Format("Cognome: {0}", userData.Cognome));
|
||||
sb.AppendLine(string.Format("Nome: {0}", userData.Nome));
|
||||
sb.AppendLine(string.Format("Status: {0}", userList[0].LoginStatus.ToString()));
|
||||
lblConsole.Text = sb.ToString();
|
||||
// aggiungo IMG user... se vuota default...
|
||||
if (userList[0].UserImage == null)
|
||||
{
|
||||
userList[0].UserImage = Image.FromFile(@"resources\userImg.png");
|
||||
}
|
||||
pictBox.Image = userList[0].UserImage;
|
||||
currImage = userList[0].UserImage;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -455,6 +459,7 @@ namespace TestClient
|
||||
}
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
pictBox.Image = currImage;
|
||||
lblConsole.Text = sb.ToString();
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
@@ -629,6 +634,27 @@ namespace TestClient
|
||||
sb.AppendLine("");
|
||||
lblConsole.Text = sb.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// Username digitato
|
||||
/// </summary>
|
||||
protected string username
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtUser.Text.Trim();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Password digitata
|
||||
/// </summary>
|
||||
protected string passwd
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtPwd.Text.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// chiamata x login utente
|
||||
/// </summary>
|
||||
@@ -639,7 +665,7 @@ namespace TestClient
|
||||
// init in modalità Task based...
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var retObj = doUserLogin(txtUser.Text.Trim(), txtPwd.Text.Trim());
|
||||
var retObj = doUserLogin(username, passwd);
|
||||
});
|
||||
|
||||
// aggiorno log console
|
||||
@@ -690,5 +716,50 @@ namespace TestClient
|
||||
sb.AppendLine("");
|
||||
lblConsole.Text = sb.ToString();
|
||||
}
|
||||
|
||||
private async void btnImportUser_Click(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var taskResult = MCC.setUserImported(SourceType.LOCAL, username, true);
|
||||
// salvo il risultato restituito...
|
||||
reqStatus = taskResult.Result;
|
||||
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
});
|
||||
}
|
||||
|
||||
private async void btnDeleteUser_Click(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var taskResult = MCC.setUserImported(SourceType.LOCAL, username, false);
|
||||
// salvo il risultato restituito...
|
||||
reqStatus = taskResult.Result;
|
||||
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
});
|
||||
}
|
||||
|
||||
private async void btnDeleteUserCloud_Click(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var taskResult = MCC.setUserImported(SourceType.CLOUD, username, false);
|
||||
// salvo il risultato restituito...
|
||||
reqStatus = taskResult.Result;
|
||||
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
refreshRequestStatus();
|
||||
}), "");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user