private void CancelButtonClicked(object sender, RoutedEventArgs e) { AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); }
private void ListViewMenuSelectionChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs) { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "ListViewItemHome": HomeEmployee home = new HomeEmployee(); home.InitializeMenu(); home.Show(); Close(); break; case "ListViewItemAccountEdit": AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); break; case "ListViewItemBehind": ServiceOffered serviceOffered = new ServiceOffered(); serviceOffered.InitializeMenu(); serviceOffered.Show(); Close(); break; case "ListViewItemChat": ChatList chatList = new ChatList(); chatList.InitializeMenu(); chatList.Show(); Close(); break; case "ListViewItemRequest": RequestsReceivedList requestReceivedList = new RequestsReceivedList(); requestReceivedList.InitializeMenu(); requestReceivedList.Show(); Close(); break; case "ListViewItemServiceRegistration": ServiceRegistry serviceRegistry = new ServiceRegistry(); serviceRegistry.InitializeMenu(); serviceRegistry.Show(); Close(); break; case "ListViewItemCommentTracing": ReportGeneration reportGeneration = new ReportGeneration(); reportGeneration.InitializeMenu(); reportGeneration.Show(); Close(); break; default: break; } }
private void ListViewMenuSelectionChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs) { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "ListViewItemBehind": Service service = new Service(); service.InitializeMenu(); service.Show(); Close(); break; case "ListViewItemHome": HomeClient home = new HomeClient(); home.InitializeMenu(); home.Show(); Close(); break; case "ListViewItemAccountEdit": AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); break; case "ListViewItemChat": ChatList chatList = new ChatList(); chatList.InitializeMenu(); chatList.Show(); Close(); break; case "ListViewItemRequest": RequestsMadeList requestsMadeList = new RequestsMadeList(); requestsMadeList.InitializeMenu(); requestsMadeList.Show(); Close(); break; case "ListViewItemServiceRegistration": AccountActivate accountActivate = new AccountActivate(); accountActivate.InitializeMenu(); accountActivate.Show(); Close(); break; case "ListViewItemCommentTracing": CommentClient commentClient = new CommentClient(); commentClient.InitializeMenu(); commentClient.Show(); Close(); break; default: break; } }
private void ChangePassword() { Models.PasswordChange newpassword = new Models.PasswordChange(); newpassword.password = Security.Encrypt(PasswordBoxPassword.Password); newpassword.newPassword = Security.Encrypt(PasswordBoxNewPassword.Password); RestClient client = new RestClient(urlBase); client.Timeout = -1; string urlChage = "accounts/password/" + Login.tokenAccount.idMemberATE; var request = new RestRequest(urlChage, Method.PATCH); foreach (RestResponseCookie cookie in Login.cookies) { request.AddCookie(cookie.Name, cookie.Value); } request.AddHeader("Token", Login.tokenAccount.token); var json = JsonConvert.SerializeObject(newpassword); request.AddParameter("application/json", json, ParameterType.RequestBody); System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); }; try { IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK) { MessageBox.Show("La nueva contraseña se guardó exitosamente", "Cambio exitoso", MessageBoxButton.OK, MessageBoxImage.Information); Login.loginAccount.password = Security.Encrypt(PasswordBoxPassword.Password); AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); } else { Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content); MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (response.StatusCode != System.Net.HttpStatusCode.Conflict && response.StatusCode != System.Net.HttpStatusCode.BadRequest) { Login login = new Login(); login.Show(); Close(); } } } catch (Exception exception) { TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); MessageBox.Show("No se pudo cambiar la contraseña de la cuenta. Intente más tarde", "Error", MessageBoxButton.OK, MessageBoxImage.Error); AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); } }
private void ListViewMenuSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { switch (((System.Windows.Controls.ListViewItem)((System.Windows.Controls.ListView)sender).SelectedItem).Name) { case "ListViewItemAccountEdit": AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); break; case "ListViewItemChat": ChatList chatList = new ChatList(); chatList.InitializeMenu(); chatList.Show(); Close(); break; case "ListViewItemRequest": RequestsMadeList requestsMadeList = new RequestsMadeList(); requestsMadeList.InitializeMenu(); requestsMadeList.Show(); Close(); break; case "ListViewItemServiceRegistration": AccountActivate accountActivate = new AccountActivate(); accountActivate.InitializeMenu(); accountActivate.Show(); Close(); break; case "ListViewItemCommentTracing": CommentClient commentClient = new CommentClient(); commentClient.InitializeMenu(); commentClient.Show(); Close(); break; default: break; } }
private void ListViewMenuSelectionChanged(object sender, SelectionChangedEventArgs routedEvent) { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "ListViewItemHome": if (Login.tokenAccount.memberATEType == Number.NumberValue(NumberValues.ONE)) { HomeClient home = new HomeClient(); home.InitializeMenu(); home.Show(); } else { HomeEmployee home = new HomeEmployee(); home.InitializeMenu(); home.Show(); } Close(); break; case "ListViewItemChat": ChatList chatList = new ChatList(); chatList.InitializeMenu(); chatList.Show(); Close(); break; case "ListViewItemAccountEdit": AccountEdition accountEdition = new AccountEdition(); accountEdition.InitializeMenu(); accountEdition.Show(); Close(); break; case "ListViewItemRequest": if (Login.tokenAccount.memberATEType == Number.NumberValue(NumberValues.ONE)) { RequestsMadeList requestsMadeList = new RequestsMadeList(); requestsMadeList.InitializeMenu(); requestsMadeList.Show(); } else { RequestsReceivedList requestReceivedList = new RequestsReceivedList(); requestReceivedList.InitializeMenu(); requestReceivedList.Show(); } Close(); break; case "ListViewItemServiceRegistration": if (Login.tokenAccount.memberATEType == Number.NumberValue(NumberValues.ONE)) { AccountActivate accountActivate = new AccountActivate(); accountActivate.InitializeMenu(); accountActivate.Show(); } else { ServiceRegistry serviceRegistry = new ServiceRegistry(); serviceRegistry.InitializeMenu(); serviceRegistry.Show(); } Close(); break; case "ListViewItemCommentTracing": if (Login.tokenAccount.memberATEType == Number.NumberValue(NumberValues.ONE)) { CommentClient commentClient = new CommentClient(); commentClient.InitializeMenu(); commentClient.Show(); } else { ReportGeneration reportGeneration = new ReportGeneration(); reportGeneration.InitializeMenu(); reportGeneration.Show(); } Close(); break; default: break; } }