private void butModifyUser_Click(object sender, RoutedEventArgs e) { try { User u = (User)lstUsers.SelectedItems[0]; //get the first selected row from the user list view and assign it to the textboxes as predefined text try { cboModuserRoles.SelectedIndex = (int)DownloadData.GetUserRole(u.email);//input the received data into the input fields } catch { MessageBox.Show("Unable to get the role assigned to this user");//return error if it fails } try { Farm f = DownloadData.GetUserFarm(u.email); //retrieve the farm details fromt the server that are assigned to the cboModuserfarmlist.SelectedIndex = f.farmid; // } catch { cboModuserfarmlist.SelectedIndex = 0; // MessageBox.Show("Unable to get a farm assigned to this user"); //return error if it fails } try { txtModuserEmail.Text = u.email; //Set predefined values from the selected account in the list txtModuserID.Text = u.id + ""; // txtModuserName.Text = u.name; // txtModuserPassword.Password = ""; //Clear these textboxes to keep consistent txtModuserPasswordConfirm.Password = ""; // panModifyUser.Visibility = Visibility.Visible; //Display the modification form if it made it this far ContentMainAdmin.Visibility = Visibility.Hidden; // } catch { MessageBox.Show("Error: Fortuna#326"); //Not sure what could cause this error however, during testing shit did go wrong here. Use as point of reference } } catch { MessageBox.Show("Please select a user account first"); } }
private void UserSigninProcess() { if (chkRememberMe.IsChecked == true) { SaveData(); } Uploader u = new Uploader(); Farm f = new Farm(); u.SetRole(DownloadData.GetUserRole(txtUsername.Text)); try { f = DownloadData.GetUserFarm(txtUsername.Text); u.SetFarm(f); } catch { MessageBox.Show("An error occured when attempting to load your farm details."); } this.Close(); u.ShowDialog(); }