private void clearTextBox() { TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxInitials.Clear(); TextBoxLoginUser.Clear(); TextBoxPasswordUser.Clear(); ChkBoxAdministrator.IsChecked = false; ChkBoxDismissed.IsChecked = false; ChkBoxPreClean.IsChecked = false; ChkBoxTesting.IsChecked = false; ChkBoxDebug.IsChecked = false; ChkBoxRepaire.IsChecked = false; ChkBoxFinalQC.IsChecked = false; ChkBoxReport.IsChecked = false; //ChkBoxOrder.IsChecked = false; btAddUser.Visibility = Visibility.Visible; btDeleteUser.Visibility = Visibility.Hidden; btUpdateUser.Visibility = Visibility.Hidden; }
private void dataGridViewUser_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataGrid gd = (DataGrid)sender; DataRowView row_selected = gd.SelectedItem as DataRowView; if (row_selected != null) { idEmployee = row_selected["id_employee"].ToString(); TextBoxFirstName.Text = row_selected["First name"].ToString(); TextBoxLastName.Text = row_selected["Last name"].ToString(); TextBoxInitials.Text = row_selected["Initials"].ToString(); string s = row_selected["employee_privilege"].ToString(); if (s[0].ToString() == "1") { ChkBoxAdministrator.IsChecked = true; } if (s[1].ToString() == "1") { ChkBoxDismissed.IsChecked = true; } if (s[2].ToString() == "1") { ChkBoxPreClean.IsChecked = true; } if (s[3].ToString() == "1") { ChkBoxTesting.IsChecked = true; } if (s[4].ToString() == "1") { ChkBoxDebug.IsChecked = true; } if (s[5].ToString() == "1") { ChkBoxRepaire.IsChecked = true; } if (s[6].ToString() == "1") { ChkBoxFinalQC.IsChecked = true; } if (s[7].ToString() == "1") { ChkBoxReport.IsChecked = true; } /* * string s = dt.Rows[0][7].ToString(); * * data.Administrator = s[0].ToString(); * * data.Dismissed = s[1].ToString(); * data.PreClean = s[2].ToString(); * data.Testing = s[3].ToString(); * data.Repaire = s[4].ToString(); * data.Debug = s[5].ToString(); * data.FinalQC = s[6].ToString(); */ btAddUser.Visibility = Visibility.Hidden; btDeleteUser.Visibility = Visibility.Visible; btUpdateUser.Visibility = Visibility.Visible; TextBoxLoginUser.Clear(); TextBoxPasswordUser.Clear(); } }