private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e) { //先把目前的資料存起來 _tempInfo[_previousType] = updateRecordInfo1.GetElement(); switch (comboBoxEx1.SelectedIndex) { default: case 0: updateRecordInfo1.Style = UpdateRecordType.學籍異動; break; case 1: updateRecordInfo1.Style = UpdateRecordType.轉入異動; break; case 2: updateRecordInfo1.Style = UpdateRecordType.新生異動; break; case 3: updateRecordInfo1.Style = UpdateRecordType.畢業異動; break; } XmlElement typeRec = _tempInfo[updateRecordInfo1.Style]; if (typeRec != null) { BindDataFromElement(typeRec); } _previousType = updateRecordInfo1.Style; }
private void Initialize() { if (!string.IsNullOrEmpty(_updateid)) { updateRecordInfo1.StudentID = _id; updateRecordInfo1.SetUpdateValue(_updateid); } else { updateRecordInfo1.SetDefaultValue(_id); } switch (updateRecordInfo1.Style) { case UpdateRecordType.學籍異動: comboBoxEx1.SelectedIndex = 0; break; case UpdateRecordType.轉入異動: comboBoxEx1.SelectedIndex = 1; break; case UpdateRecordType.新生異動: comboBoxEx1.SelectedIndex = 2; break; case UpdateRecordType.畢業異動: comboBoxEx1.SelectedIndex = 3; break; default: break; } _previousType = updateRecordInfo1.Style; }