示例#1
0
        void FillFromList(ComboBox comboBox_from)
        {
            comboBox_from.Items.Clear();

            comboBox_from.Items.Add("<全部>");

            if (this.DbFromInfos == null)
            {
                return;
            }

            Debug.Assert(this.DbFromInfos != null);

            string strFirstItem = "";

            // 装入检索途径
            for (int i = 0; i < this.DbFromInfos.Length; i++)
            {
                BiblioDbFromInfo info = this.DbFromInfos[i];

                comboBox_from.Items.Add(info.Caption /* + "(" + infos[i].Style+ ")"*/);

                if (i == 0)
                {
                    strFirstItem = info.Caption;
                }
            }

            comboBox_from.Text = strFirstItem;
        }
示例#2
0
        // 从计划文件中获得所有分类号检索途径 style
        internal int GetClassFromStyles(
            XmlElement root,
            out List<BiblioDbFromInfo> styles,
            out string strError)
        {
            strError = "";
            styles = new List<BiblioDbFromInfo>();

            XmlNodeList nodes = root.SelectNodes("classStyles/style");
            foreach (XmlElement element in nodes)
            {
                BiblioDbFromInfo info = new BiblioDbFromInfo();
                info.Caption = element.GetAttribute("caption");
                info.Style = element.GetAttribute("style");
                styles.Add(info);
            }
            return 0;
        }
示例#3
0
        // 获得所有分类号检索途径 style
        internal int GetClassFromStylesFromMainform(
            out List<BiblioDbFromInfo> styles,
            out string strError)
        {
            strError = "";
            styles = new List<BiblioDbFromInfo>();

            for (int i = 0; i < this.MainForm.BiblioDbFromInfos.Length; i++)
            {
                BiblioDbFromInfo info = this.MainForm.BiblioDbFromInfos[i];
                if (StringUtil.IsInList("__class", info.Style) == true)
                {
                    string strStyle = GetPureStyle(info.Style);
                    if (string.IsNullOrEmpty(strStyle) == true)
                    {
                        strError = "检索途径 " + info.Caption + " 的 style 值 '" + info.Style + "' 其中应该有至少一个不带 '_' 前缀的子串";
                        return -1;
                    }
                    BiblioDbFromInfo style = new BiblioDbFromInfo();
                    style.Caption = info.Caption;
                    style.Style = strStyle;
                    styles.Add(style);
                }
            }

            return 0;
        }
示例#4
0
        public int GetDbFroms(
            string strDbType,
            string strLang,
            out BiblioDbFromInfo[] infos,
            out string strError)
        {
            strError = "";
            infos = null;

            string strKey = strDbType + "|" + strLang;
            infos = (BiblioDbFromInfo[])this.m_fromTable[strKey];
            if (infos != null)
                return 1;

            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            try
            {

                // 临时的SessionInfo对象
                SessionInfo session = new SessionInfo(this);
                session.UserID = this.ManagerUserName;
                session.Password = this.ManagerPassword;
                session.IsReader = false;

                try
                {

                    // 获取虚拟库定义
                    long lRet = session.Channel.ListDbFroms(null,
        strDbType,
        strLang,
        out infos,
        out strError);
                    if (lRet == -1)
                    {
                        strError = "(" + session.UserID + ")获得from定义时发生错误: " + strError;
                        // this.WriteErrorLog(strError);
                        goto ERROR1;
                    }
                }
                finally
                {
                    session.CloseSession();
                }
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }

            this.m_fromTable[strKey] = infos;
            return 0;
        ERROR1:
            return -1;
        }