private void comboBox_location_TextChanged(object sender, EventArgs e) { this.comboBox_seller.Items.Clear(); this.comboBox_source.Items.Clear(); this.checkedComboBox_state.Items.Clear(); this.comboBox_bookType.Items.Clear(); #if NO if (m_bInInitial == false) { this.label_location_color.BackColor = this.ColorChanged; this.Changed = true; } #endif // 比较新旧两个值 if (this.LocationStringChanged != null) { TextChangeEventArgs e1 = new TextChangeEventArgs(); e1.OldText = this._previousLocation; e1.NewText = this.comboBox_location.Text; this.LocationStringChanged(this, e1); } _previousLocation = this.comboBox_location.Text; }
void edit_LocationStringChanged(object sender, TextChangeEventArgs e) { string strError = ""; EntityEditControl edit = sender as EntityEditControl; if (edit.Initializing == false && string.IsNullOrEmpty(edit.AccessNo) == false) { ArrangementInfo old_info = null; string strOldName = "[not found]"; // 获得关于一个特定馆藏地点的索取号配置信息 // <returns>-1: 出错; 0: 没有找到; 1: 找到</returns> int nRet = this.MainForm.GetArrangementInfo(e.OldText, out old_info, out strError); if (nRet == -1) goto ERROR1; if (nRet == 1) strOldName = old_info.ArrangeGroupName; ArrangementInfo new_info = null; string strNewName = "[not found]"; // 获得关于一个特定馆藏地点的索取号配置信息 nRet = this.MainForm.GetArrangementInfo(e.NewText, out new_info, out strError); if (nRet == -1) goto ERROR1; if (nRet == 1) strNewName = new_info.ArrangeGroupName; if (strOldName != strNewName) { DialogResult result = MessageBox.Show(this.Owner, "您修改了馆藏地点,因而变动了记录所从属的排架体系,现有的索取号已不再适合变动后的排架体系。\r\n\r\n是否重新创建索取号?", "册登记", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.No) return; edit.AccessNo = ""; edit.ErrorInfo = ""; if (this.GenerateData != null) { Cursor old_cursor = edit.Cursor; edit.Cursor = Cursors.WaitCursor; try { GenerateDataEventArgs e1 = new GenerateDataEventArgs(); e1.ScriptEntry = "CreateCallNumber"; e1.FocusedControl = edit; // sender为 EntityEditControl this.GenerateData(this, e1); } finally { edit.Cursor = old_cursor; } } } } return; ERROR1: MessageBox.Show(this.Owner, strError); }