Ejemplo n.º 1
0
        /// <summary>
        /// 获取打印末班配置文件信息
        /// </summary>
        /// <returns>打印模板文件信息</returns>
        protected ConfigInfo GetConfigInfo()
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(HttpContext.Current.Server.MapPath((@"~\template\template.xml")));

            ConfigInfo cfginfo = new ConfigInfo();

            if (xmldoc.DocumentElement == null)
            {
                return(cfginfo);
            }
            XmlNode root = xmldoc.DocumentElement;

            string stmp = this.Template;

            string[] arr = stmp.Split(new char[] { '\\' });

            XmlNodeList Nodes = root.SelectNodes("template [ @name = '" + arr[arr.Length - 1] + "']");

            if (Nodes.Count == 1)
            {
                for (int i = 0; i < Nodes[0].ChildNodes.Count; i++)
                {
                    SubItem  item   = new SubItem();
                    string[] sValue = Nodes[0].ChildNodes[i].InnerText.Split(new char[] { '|' });
                    if (sValue.Length != 0)
                    {
                        item.ColName   = sValue[0];
                        item.ExtraPara = sValue[1];
                        cfginfo._alTemplateInfo.Add(item);
                    }
                }
            }

            return(cfginfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取打印末班配置文件信息
        /// </summary>
        /// <returns>打印模板文件信息</returns>
        protected ConfigInfo GetConfigInfo()
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(HttpContext.Current.Server.MapPath((@"~\template\template.xml")));

            ConfigInfo cfginfo = new ConfigInfo();

            if (xmldoc.DocumentElement == null) return cfginfo;
            XmlNode root = xmldoc.DocumentElement;

            string stmp = this.Template;
            string[] arr = stmp.Split(new char[] { '\\' });

            XmlNodeList Nodes = root.SelectNodes("template [ @name = '" + arr[arr.Length - 1] + "']");

            if( Nodes.Count == 1)
            {
                for(int i=0;i<Nodes[0].ChildNodes.Count;i++)
                {
                    SubItem item = new SubItem();
                    string[] sValue = Nodes[0].ChildNodes[i].InnerText.Split(new char[]{'|'});
                    if (sValue.Length != 0)
                    {
                        item.ColName = sValue[0];
                        item.ExtraPara = sValue[1];
                        cfginfo._alTemplateInfo.Add(item);
                    }
                }
            }

            return cfginfo;
        }