示例#1
0
        // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
        // return:
        //      -1  出错
        //      0   没有找到定义
        //      1   找到定义
        internal static int GetActionCfg(
            XmlDocument cfg_dom,
            string strFieldName,
            out OneActionCfg cfg,
            out string strError)
        {
            strError = "";
            cfg      = null;

            if (string.IsNullOrEmpty(strFieldName) == true)
            {
                strError = "strFieldName 参数不应为空";
                return(-1);
            }

            XmlElement cfg_node = null;

            if (strFieldName[0] == '{' || strFieldName[0] == '<')
            {
                string strElement = Unquote(strFieldName);
                cfg_node = cfg_dom.DocumentElement.SelectSingleNode("action[@element='" + strElement + "']") as XmlElement;
                if (cfg_node == null)
                {
                    strError = "元素名 '" + strFieldName + "' 在配置文件中没有定义";
                    return(0);
                }
            }
            else
            {
                // 从 CfgDom 中查找元素名
                XmlNode node = cfg_dom.DocumentElement.SelectSingleNode("//caption[text()='" + strFieldName + "']");
                if (node == null)
                {
                    strError = "字段名 '" + strFieldName + "' 在配置文件中没有定义";
                    return(0);
                }
                cfg_node = node.ParentNode as XmlElement;
            }

            cfg            = new OneActionCfg();
            cfg.Element    = cfg_node.GetAttribute("element");
            cfg.Type       = cfg_node.GetAttribute("type");
            cfg.List       = cfg_node.GetAttribute("list");
            cfg.Additional = cfg_node.GetAttribute("additional");
            cfg.Length     = cfg_node.GetAttribute("length");
            cfg.Style      = cfg_node.GetAttribute("style");

            return(1);
        }
示例#2
0
        void OnFieldNameChanged()
        {
            if (this.CfgDom == null)
            {
                // 没有配置文件
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            OneActionCfg cfg = null;

            string strError = "";
            // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
            // return:
            //      -1  出错
            //      0   没有找到定义
            //      1   找到定义
            int nRet = GetActionCfg(
                this.CfgDom,
                this.comboBox_fieldName.Text,
                out cfg,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);

            this._actionCfg = cfg;

            if (this._actionCfg == null)
            {
                // 没有明确定义
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            SetMenu(this._actionCfg);
            this.comboBox_fieldValue.Items.Clear();
        }
示例#3
0
        int LoadCfgDom(string strFileName,
                       out string strError)
        {
            strError = "";

            this.CfgDom = new XmlDocument();
            try
            {
                this.CfgDom.Load(strFileName);
            }
            catch (Exception ex)
            {
                strError = "装载文件 '" + strFileName + "' 时间发生错误: " + ex.Message;
                return(-1);
            }

#if NO
            OneActionCfg cfg = null;

            // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
            // return:
            //      -1  出错
            //      0   没有找到定义
            //      1   找到定义
            int nRet = OneActionDialog.GetActionCfg(
                this.CfgDom,
                "{state}",
                out cfg,
                out strError);
            if (nRet == -1)
            {
                throw new Exception(strError);
            }

            this._stateActionCfg = cfg;
#endif
            return(0);
        }
示例#4
0
        // 根据 type 属性值设置 RFC 1123 等菜单
        void SetMenu(OneActionCfg cfg)
        {
            if (cfg == null)
            {
                this.ToolStripMenuItem_rfc1123Single.Enabled = true;
                this.ToolStripMenuItem_readerRights.Enabled  = true;
                this.ToolStripMenuItem_objectRights.Enabled  = true;
                return;
            }

            if (cfg.Type == "rfc1123")
            {
                this.ToolStripMenuItem_rfc1123Single.Enabled = true;
            }
            else
            {
                this.ToolStripMenuItem_rfc1123Single.Enabled = false;
            }

            if (StringUtil.IsInList("readerRights", cfg.List) == true)
            {
                this.ToolStripMenuItem_readerRights.Enabled = true;
            }
            else
            {
                this.ToolStripMenuItem_readerRights.Enabled = false;
            }

            if (StringUtil.IsInList("objectRights", cfg.List) == true)
            {
                this.ToolStripMenuItem_objectRights.Enabled = true;
            }
            else
            {
                this.ToolStripMenuItem_objectRights.Enabled = false;
            }
        }
示例#5
0
        void OnFieldNameChanged()
        {
            if (this.CfgDom == null)
            {
                // 没有配置文件
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            OneActionCfg cfg = null;

            string strError = "";
            // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
            // return:
            //      -1  出错
            //      0   没有找到定义
            //      1   找到定义
            int nRet = GetActionCfg(
                this.CfgDom,
                this.comboBox_fieldName.Text,
                out cfg,
                out strError);

            if (nRet == -1)
            {
                throw new Exception(strError);
            }

            this._actionCfg = cfg;

            if (this._actionCfg == null)
            {
                // 没有明确定义
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            SetMenu(this._actionCfg);

            this.comboBox_fieldValue.Items.Clear();
            if (StringUtil.IsInList("combine", this._actionCfg.Additional) == true)
            {
                this.comboBox_fieldValue.Items.Add("<不改变>");
                this.comboBox_fieldValue.Items.Add("<增、减>");

                if (StringUtil.IsInList("removable", this._actionCfg.Style) == true)
                {
                    this.comboBox_fieldValue.Items.Add("<删除>");
                }

                this.label_add.Visible = true;
                this.checkedComboBox_stateAdd.Visible    = true;
                this.label_remove.Visible                = true;
                this.checkedComboBox_stateRemove.Visible = true;
            }
            else
            {
                if (this.comboBox_fieldValue.Text.Length > 0 &&
                    this.comboBox_fieldValue.Text[0] == '<')
                {
                    this.comboBox_fieldValue.Text = "";
                }

                this.label_add.Visible                   = false;
                this.checkedComboBox_stateAdd.Text       = "";
                this.checkedComboBox_stateAdd.Visible    = false;
                this.label_remove.Visible                = false;
                this.checkedComboBox_stateRemove.Text    = "";
                this.checkedComboBox_stateRemove.Visible = false;
            }
        }
示例#6
0
        void OnFieldNameChanged()
        {
            if (this.CfgDom == null)
            {
                // 没有配置文件
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            OneActionCfg cfg = null;

            string strError = "";
            // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
            // return:
            //      -1  出错
            //      0   没有找到定义
            //      1   找到定义
            int nRet = GetActionCfg(
                this.CfgDom,
                this.comboBox_fieldName.Text,
                out cfg,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);

            this._actionCfg = cfg;

            if (this._actionCfg == null)
            {
                // 没有明确定义
                this.comboBox_fieldValue.Enabled = true;
                SetMenu(null);
                this.comboBox_fieldValue.Items.Clear();
                return;
            }

            SetMenu(this._actionCfg);

            this.comboBox_fieldValue.Items.Clear();
            if (StringUtil.IsInList("combine", this._actionCfg.Additional) == true)
            {
                this.comboBox_fieldValue.Items.Add("<不改变>");
                this.comboBox_fieldValue.Items.Add("<增、减>");

                if (StringUtil.IsInList("removable", this._actionCfg.Style) == true)
                    this.comboBox_fieldValue.Items.Add("<删除>");

                this.label_add.Visible = true;
                this.checkedComboBox_stateAdd.Visible = true;
                this.label_remove.Visible = true;
                this.checkedComboBox_stateRemove.Visible = true;
            }
            else
            {
                if (this.comboBox_fieldValue.Text.Length > 0
                    && this.comboBox_fieldValue.Text[0] == '<')
                    this.comboBox_fieldValue.Text = "";

                this.label_add.Visible = false;
                this.checkedComboBox_stateAdd.Text = "";
                this.checkedComboBox_stateAdd.Visible = false;
                this.label_remove.Visible = false;
                this.checkedComboBox_stateRemove.Text = "";
                this.checkedComboBox_stateRemove.Visible = false;
            }
        }
示例#7
0
        // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
        // return:
        //      -1  出错
        //      0   没有找到定义
        //      1   找到定义
        internal static int GetActionCfg(
            XmlDocument cfg_dom,
            string strFieldName,
            out OneActionCfg cfg,
            out string strError)
        {
            strError = "";
            cfg = null;

            if (string.IsNullOrEmpty(strFieldName) == true)
            {
                strError = "strFieldName 参数不应为空";
                return -1;
            }

            XmlElement cfg_node = null;

            if (strFieldName[0] == '{' || strFieldName[0] == '<')
            {
                string strElement = Unquote(strFieldName);
                cfg_node = cfg_dom.DocumentElement.SelectSingleNode("action[@element='"+strElement+"']") as XmlElement;
                if (cfg_node == null)
                {
                    strError = "元素名 '" + strFieldName + "' 在配置文件中没有定义";
                    return 0;
                }
            }
            else
            {
                // 从 CfgDom 中查找元素名
                XmlNode node = cfg_dom.DocumentElement.SelectSingleNode("//caption[text()='" + strFieldName + "']");
                if (node == null)
                {
                    strError = "字段名 '" + strFieldName + "' 在配置文件中没有定义";
                    return 0;
                }
                cfg_node = node.ParentNode as XmlElement;
            }

            cfg = new OneActionCfg();
            cfg.Element = cfg_node.GetAttribute("element");
            cfg.Type = cfg_node.GetAttribute("type");
            cfg.List = cfg_node.GetAttribute("list");
            cfg.Additional = cfg_node.GetAttribute("additional");
            cfg.Length = cfg_node.GetAttribute("length");
            cfg.Style = cfg_node.GetAttribute("style");

            return 1;
        }
示例#8
0
        // 根据 type 属性值设置 RFC 1123 等菜单
        void SetMenu(OneActionCfg cfg)
        {
            if (cfg == null)
            {
                this.ToolStripMenuItem_rfc1123Single.Enabled = true;
                this.ToolStripMenuItem_readerRights.Enabled = true;
                this.ToolStripMenuItem_objectRights.Enabled = true;
                return;
            }

            if (cfg.Type == "rfc1123")
                this.ToolStripMenuItem_rfc1123Single.Enabled = true;
            else
                this.ToolStripMenuItem_rfc1123Single.Enabled = false;

            if (StringUtil.IsInList("readerRights", cfg.List) == true)
                this.ToolStripMenuItem_readerRights.Enabled = true;
            else
                this.ToolStripMenuItem_readerRights.Enabled = false;

            if (StringUtil.IsInList("objectRights", cfg.List) == true)
                this.ToolStripMenuItem_objectRights.Enabled = true;
            else
                this.ToolStripMenuItem_objectRights.Enabled = false;
        }
示例#9
0
 // 根据 type 属性值设置 RFC 1123 等菜单
 void SetMenu(OneActionCfg cfg)
 {
     if (cfg == null)
     {
         this.ToolStripMenuItem_rfc1123Single.Enabled = true;
         return;
     }
     if (cfg.Type == "rfc1123")
     {
         this.ToolStripMenuItem_rfc1123Single.Enabled = true;
     }
     else
     {
         this.ToolStripMenuItem_rfc1123Single.Enabled = false;
     }
 }
示例#10
0
        int LoadCfgDom(string strFileName,
            out string strError)
        {
            strError = "";

            this.CfgDom = new XmlDocument();
            try
            {
                this.CfgDom.Load(strFileName);
            }
            catch(Exception ex)
            {
                strError = "装载文件 '"+strFileName+"' 时间发生错误: " + ex.Message;
                return -1;
            }

            OneActionCfg cfg = null;

            // 根据语言相关的 caption 值或者 <> {} 形态的 element 名, 获取 <action> 配置参数
            // return:
            //      -1  出错
            //      0   没有找到定义
            //      1   找到定义
            int nRet = OneActionDialog.GetActionCfg(
                this.CfgDom,
                "{state}",
                out cfg,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);

            this._stateActionCfg = cfg;


            return 0;
        }