public static BlackMarketItem AddUpdateUserData(this BlackMarketItem item, UpdateUserType type) => default;
void AdminForm_onUpdateUserFailed(string user, UpdateUserType type, System.Net.HttpStatusCode statusCode) { MessageBox.Show("Can't " + type.ToString() + " for user '" + user + "', status=" + statusCode + " !"); }
void AdminForm_onUpdateUserSuccessfully(string user, UpdateUserType type, string newValue) { switch(type) { case UpdateUserType.ChangePassword: { } break; case UpdateUserType.ChangeRole: { } break; case UpdateUserType.LockUser: { if ("yes".Equals(newValue, StringComparison.OrdinalIgnoreCase) || "1".Equals(newValue, StringComparison.OrdinalIgnoreCase) || "true".Equals(newValue,StringComparison.OrdinalIgnoreCase)) { ActiveUsersListBox.Items.Remove(user); LockedUsersListBox.Items.Add(user); DataCenter.Instance().Users[user].locked = true; } else { LockedUsersListBox.Items.Remove(user); ActiveUsersListBox.Items.Add(user); DataCenter.Instance().Users[user].locked = false; } } break; } }
public void updateUser(Form attachedForm, string userId, UpdateUserType type, string newValue) { new Thread(delegate() { byte[] respData; WebHeaderCollection headers; string url = getUrl(Action.updateuser) + "/" + userId + "/" + type.ToString() + "/" + newValue; HttpStatusCode statusCode = HTTPRequest.MakeRequest(url, "PUT", null, null, null, out respData, out headers); if (statusCode == HttpStatusCode.Accepted) { if (onUpdateUserSuccessfully != null) attachedForm.BeginInvoke(onUpdateUserSuccessfully, userId, type, newValue); } else { if (onUpdateUserFailed != null) attachedForm.BeginInvoke(onUpdateUserFailed, userId, type, statusCode); } }).Start(); }