示例#1
0
        static void SetCheckedComboBoxState(CheckedComboBox combobox, string strText, object default_value)
        {
            if (string.IsNullOrEmpty(strText) == true &&
                default_value != null)
            {
                if (default_value is string)
                {
                    combobox.Text = (default_value as string);
                }
                else
                {
                    throw new ArgumentException("CheckedComboBox 的缺省值应当为 string 类型", "default_value");
                }
                return;
            }

            string strState = "";

            if (IsType(strText, combobox, out strState) == false)
            {
                return;
            }
            combobox.Text = StringUtil.UnescapeString(strState);
        }
示例#2
0
 static string GetCheckedComboBoxState(CheckedComboBox combobox)
 {
     return(combobox.GetType().ToString() + ":" + StringUtil.EscapeString(combobox.Text, ":;,"));
 }
        void FillReaderStateDropDown(CheckedComboBox combobox)
        {
            // 防止重入
            if (this.m_nInDropDown > 0)
                return;

            Cursor oldCursor = this.Cursor;
            this.Cursor = Cursors.WaitCursor;
            this.m_nInDropDown++;
            try
            {
                if (combobox.Items.Count <= 0
                    && this.GetValueTable != null)
                {
                    GetValueTableEventArgs e1 = new GetValueTableEventArgs();
                    e1.DbName = this.RefDbName;

                    e1.TableName = "readerState";

                    this.GetValueTable(this, e1);

                    if (e1.values != null)
                    {
                        for (int i = 0; i < e1.values.Length; i++)
                        {
                            combobox.Items.Add(e1.values[i]);
                        }
                    }
                    else
                    {
                        // combobox.Items.Add("{not found}");
                    }
                }
            }
            finally
            {
                this.Cursor = oldCursor;
                this.m_nInDropDown--;
            }
        }
示例#4
0
        void FillStateDropDown(CheckedComboBox combobox)
        {
            // 防止重入
            if (this.m_nInDropDown > 0)
                return;

#if NO
            string strTableName = "";
            if (_stateActionCfg != null)
                strTableName = _stateActionCfg.List;
#endif

            Cursor oldCursor = this.Cursor;
            this.Cursor = Cursors.WaitCursor;
            this.m_nInDropDown++;
            try
            {
                if (combobox.Items.Count <= 0
                    && this.GetValueTable != null)
                {
                    GetValueTableEventArgs e1 = new GetValueTableEventArgs();
                    e1.DbName = this.RefDbName;
                    e1.TableName = this._actionCfg.List;

#if NO
                    if (this.DbType == "patron")
                        e1.TableName = "readerState";
                    else if (this.DbType == "item")
                        e1.TableName = "state";
                    else
                        e1.TableName = this.DbType + "State";
#endif

                    this.GetValueTable(this, e1);

                    if (e1.values != null)
                    {
                        if (e1.TableName == "readerState" && e1.values.Length == 0)
                        {
                            e1.values = StringUtil.SplitList("注销,停借,挂失").ToArray();
                        }
                        for (int i = 0; i < e1.values.Length; i++)
                        {
                            combobox.Items.Add(e1.values[i]);
                        }
                    }
                    else
                    {
                        // combobox.Items.Add("{not found}");
                    }
                }
            }
            finally
            {
                this.Cursor = oldCursor;
                this.m_nInDropDown--;
            }
        }
示例#5
0
        void FillItemStateDropDown(CheckedComboBox combobox)
        {
            // 防止重入
            if (this.m_nInDropDown > 0)
                return;

            Cursor oldCursor = this.Cursor;
            this.Cursor = Cursors.WaitCursor;
            this.m_nInDropDown++;
            try
            {
                if (combobox.Items.Count <= 0
                    && this.GetValueTable != null)
                {
                    GetValueTableEventArgs e1 = new GetValueTableEventArgs();
                    e1.DbName = this.RefDbName;

                    e1.TableName = "state";

                    this.GetValueTable(this, e1);

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

                        string strLibraryCode = "";
                        string strPureName = "";

                        string strLocationString = this.comboBox_location.Text;
                        if (strLocationString == "<不改变>")
                            strLocationString = "";

                        Global.ParseCalendarName(strLocationString,
                    out strLibraryCode,
                    out strPureName);

                        if (String.IsNullOrEmpty(strLocationString) == false)
                        {
                            // 过滤出符合馆代码的那些值字符串
                            results = Global.FilterValuesWithLibraryCode(strLibraryCode,
                                StringUtil.FromStringArray(e1.values));
                        }
                        else
                        {
                            results = StringUtil.FromStringArray(e1.values);
                        }

                        foreach (string s in results)
                        {
                            combobox.Items.Add(s);
                        }
#if NO
                        for (int i = 0; i < e1.values.Length; i++)
                        {
                            combobox.Items.Add(e1.values[i]);
                        }
#endif
                    }
                    else
                    {
                        // combobox.Items.Add("{not found}");
                    }
                }
            }
            finally
            {
                this.Cursor = oldCursor;
                this.m_nInDropDown--;
            }
        }