private void btn_newuser_Click(object sender, RoutedEventArgs e) { win_add_edit_user w_u = new win_add_edit_user(); w_u.win_type = 1; w_u.ShowDialog(); ShowUserInfo(SearchStatement); }
private void btn_edituser_Click(object sender, RoutedEventArgs e) { object item = dataGrid_user.SelectedItem; win_add_edit_user w_u = new win_add_edit_user(); if (item != null) { w_u.win_type = 2; w_u.UserID = Convert.ToInt32((dataGrid_user.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text); w_u.UserName = (dataGrid_user.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; w_u.UserFamliy = (dataGrid_user.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; w_u.UserTel = (dataGrid_user.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; w_u.UserAge = Convert.ToByte((dataGrid_user.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text); w_u.UserGender = (dataGrid_user.SelectedCells[6].Column.GetCellContent(item) as TextBlock).Text; w_u.UserUserName = (dataGrid_user.SelectedCells[8].Column.GetCellContent(item) as TextBlock).Text; w_u.ShowDialog(); } ShowUserInfo(SearchStatement); }