Exemplo n.º 1
0
 void AdminForm_onUpdateUserFailed(string user, UpdateUserType type, System.Net.HttpStatusCode statusCode)
 {
     MessageBox.Show("Can't " + type.ToString() + " for user '" + user + "', status=" + statusCode + " !");
 }
Exemplo n.º 2
0
        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();
        }