private void dgvSearchResults_SelectionChanged(object sender, EventArgs e) { String selectedUser = dgvSearchResults.SelectedRows[0].Cells[0].Value.ToString(); myUser = Program.ARTISClient.getResUser(selectedUser, Program.TOKEN); DataTable privLevels = Program.ARTISClient.getPrivLevels(); if (myUser.dbMessage == "Found") { lblFoundUser.Text = myUser.Username; lblFoundDateCreated.Text = myUser.CreateDate.ToString(); lblFoundPrivLevel.Text = myUser.PrivLevel; lblFoundNotes.Text = myUser.Notes; txtEditUserName.Text = myUser.Username; txtEditPassword.Text = myUser.Password; txtEditNotes.Text = myUser.Notes; //Add the PrivLevels to combobox foreach (DataRow row in privLevels.Rows) { comboPrivLevel.Items.Add(row["PrivLevel"]); } comboPrivLevel.SelectedItem = myUser.PrivLevel; } else { ArtisMessage msg = new ArtisMessage("User Not Found!"); msg.ShowDialog(); } }
private void btnLoadUser_Click(object sender, EventArgs e) { myUser = Program.ARTISClient.getResUser(txtUsername.Text, Program.TOKEN); DataTable privLevels = Program.ARTISClient.getPrivLevels(); if (searchResults != null) { lblFoundUser.Text = myUser.Username; lblFoundDateCreated.Text = myUser.CreateDate.ToString(); lblFoundPrivLevel.Text = myUser.PrivLevel; lblFoundNotes.Text = myUser.Notes; txtEditUserName.Text = myUser.Username; txtEditPassword.Text = myUser.Password; txtEditNotes.Text = myUser.Notes; //Add the PrivLevels to combobox foreach (DataRow row in privLevels.Rows) { comboPrivLevel.Items.Add(row["PrivLevel"]); } comboPrivLevel.SelectedItem = myUser.PrivLevel; } else { ArtisMessage msg = new ArtisMessage("User Not Found!"); msg.ShowDialog(); } }
private void btnAdd_Click(object sender, EventArgs e) { ARTISLAB.ResUser newUser = new ARTISLAB.ResUser(); newUser.Username = txtUsername.Text; newUser.Password = txtPassword.Text; newUser.Notes = txtNotes.Text; newUser.CreateDate = DateTime.Today; newUser.PrivLevel = comboPrivLevel.SelectedItem.ToString(); Program.ARTISClient.insertResUser(newUser, Program.TOKEN); }