Ejemplo n.º 1
0
 private void readerEditControl_new_GetLibraryCode(object sender, GetLibraryCodeEventArgs e)
 {
     e.LibraryCode = this.MainForm.GetReaderDbLibraryCode(e.DbName);
 }
Ejemplo n.º 2
0
        private void comboBox_readerType_DropDown(object sender, EventArgs e)
        {
            ComboBox combobox = (ComboBox)sender;
            if (combobox.Items.Count > 0
    /*|| this.GetValueTable == null*/)
                return;

            // 防止重入
            if (this.m_nInDropDown > 0)
                return;

            Cursor oldCursor = this.Cursor;
            this.Cursor = Cursors.WaitCursor;
            this.m_nInDropDown++;
            try
            {
                GetValueTableEventArgs e1 = new GetValueTableEventArgs();
                e1.DbName = Global.GetDbName(this.RecPath);

                if (combobox == this.comboBox_readerType)
                    e1.TableName = "readerType";
                else if (combobox == this.comboBox_state)
                    e1.TableName = "readerState";
                else if (combobox == this.comboBox_hirePeriod)
                    e1.TableName = "hirePeriod";
                else
                {
                    Debug.Assert(false, "不支持的sender");
                    return;
                }

                // this.GetValueTable(this, e1);
                this.OnGetValueTable(this, e1);

                if (e1.values != null)
                {
                    List<string> results = null;

                    string strRecPath = this.textBox_recPath.Text;
                    string strDbName = Global.GetDbName(strRecPath);
                    if (string.IsNullOrEmpty(strDbName) == false
                        && this.GetLibraryCode != null)
                    {
                        GetLibraryCodeEventArgs e2 = new GetLibraryCodeEventArgs();
                        e2.DbName = strDbName;
                        this.GetLibraryCode(this, e2);
                        string strLibraryCode = e2.LibraryCode;
                        // 过滤出符合管代码的那些值字符串
                        results = Global.FilterValuesWithLibraryCode(strLibraryCode,
                            StringUtil.FromStringArray(e1.values));
                    }
                    else
                    {
                        results = StringUtil.FromStringArray(e1.values);
                    }

                    foreach (string s in results)
                    {
                        combobox.Items.Add(s);
                    }
                }
                else
                {
                    combobox.Items.Add("<not found>");
                }

            }
            finally
            {
                this.Cursor = oldCursor;
                this.m_nInDropDown--;
            }
        }