//单条记录编辑 void miEdit_Click(object sender, RoutedEventArgs e) { Model.TB_AthleteInfo selectedAth = dgAthlete.SelectedValue as Model.TB_AthleteInfo; if (selectedAth.Hidden != "0") { MessageBox.Show("该人员信息已被设置为隐藏,请在设置中选择“显示所有数据”后进行编辑", "系统信息"); return; } AddOrEditAthlete window = new AddOrEditAthlete(); window.Athlete = selectedAth; window.Owner = Application.Current.MainWindow; if (window.ShowDialog() == true) { RefrenshAthleteList(); } }
//编辑 private void btnEdit_Click(object sender, RoutedEventArgs e) { List <Model.TB_AthleteInfo> selectedAthleteList = athleteList.FindAll(model => model.IsChecked == true); if (selectedAthleteList.Count == 0 || selectedAthleteList.Count > 1) { MessageBox.Show("请选择一个测试者信息编辑!"); return; } Model.TB_AthleteInfo selectedAth = selectedAthleteList[0]; if (selectedAth.Hidden != "0") { MessageBox.Show("该人员信息已被设置为隐藏,请在设置中选择“显示所有数据”后进行编辑", "系统信息"); return; } AddOrEditAthlete window = new AddOrEditAthlete(); window.Athlete = selectedAth; window.Owner = Application.Current.MainWindow; if (window.ShowDialog() == true) { RefrenshAthleteList(); } }