/// <summary> /// 提交本次操作,将确定专业代码的专业名称、专业自设名称、专业代码,写入代码表中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_zymcConfim_Click(object sender, RoutedEventArgs e) { List <Zymc> unmatchedZymcList = dg_zymcFail.DataContext as List <Zymc>; for (int i = 0; i < unmatchedZymcList.Count; i++) { Zymc z = unmatchedZymcList[i]; if (z.zydm == null || z.zymc == null) { System.Windows.MessageBox.Show("专业代码不允许为空,请确定所有专业代码"); testZymcSuccess = false; break; } else { testZymcSuccess = true; } } if (testZymcSuccess) { DB.setDmZymc(unmatchedZymcList); MessageBox.Show("已更新代码表"); this.Close(); } }
/// <summary> /// 为当前专业名称设定专业代码,从专业代码表或原始专业代码表中选择。注意:上报名单中的学生专业不能修改,但民族可以修改,民族有可能出现错别字或为空的情况 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_setZymcDm_Click(object sender, RoutedEventArgs e) { List <Zymc> unmatchedZymcList = dg_zymcFail.DataContext as List <Zymc>; if (dg_zymcFail.SelectedIndex == -1) { MessageBox.Show("请选择要设定代码的专业!"); return; } else { if (this.ti_zydm.IsSelected) //如果从本校的专业代码表中查找专业码 { if (this.dg_dmZymc.SelectedIndex == -1) { MessageBox.Show("请在代码列表中选择该专业的代码"); } else { Zymc z = dg_dmZymc.SelectedItem as Zymc; unmatchedZymcList[dg_zymcFail.SelectedIndex].zydm = z.zydm; unmatchedZymcList[dg_zymcFail.SelectedIndex].zymc = z.zymc; dg_zymcFail.DataContext = null; dg_zymcFail.DataContext = unmatchedZymcList; } } if (ti_zydmInit.IsSelected) //如果从原始专业代码表中查找专业码 { if (this.dg_dmZymcInit.SelectedIndex == -1) { MessageBox.Show("请在原始代码列表中选择该专业的代码"); } else { ZymcInit z = this.dg_dmZymcInit.SelectedItem as ZymcInit; unmatchedZymcList[dg_zymcFail.SelectedIndex].zydm = z.zydm; unmatchedZymcList[dg_zymcFail.SelectedIndex].zymc = z.zymc; dg_zymcFail.DataContext = null; dg_zymcFail.DataContext = unmatchedZymcList; } } return; } }