コード例 #1
0
ファイル: Setting.cs プロジェクト: ewin66/Management-System
        /// <summary>
        /// 获得配置
        /// </summary>
        /// <param name="FileName">HisProfile.xml文件名</param>
        /// <returns>0正确 -1错误</returns>
        public int GetSetting(string FileName)
        {
            XmlDocument doc;

            Neusoft.FrameWork.Xml.XML manageXml = new Neusoft.FrameWork.Xml.XML();
            doc = manageXml.LoadXml(FileName);
            if (doc == null)
            {
                this.Err     = "无法打开文件!" + manageXml.Err;
                this.ErrCode = "-1";
                return(-1);
            }
            XmlNodeList nodes;
            XmlNode     node;

            try
            {
                //数据库设置
                node = doc.SelectSingleNode(@"/设置/数据库设置");
                this.objSetting.ConnectionString = node.Attributes[0].Value;
                //ftp设置
                node = doc.SelectSingleNode(@"/设置/设置");
                objSetting.SQLByXMl = Neusoft.FrameWork.Function.NConvert.ToBoolean(node.Attributes["sql开关"].Value);

                //web service设置
                nodes = doc.SelectNodes(@"/设置/WebService设置");
                foreach (XmlNode mynode in nodes)
                {
                    Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject();
                    obj.ID   = mynode.Attributes[0].Value;
                    obj.Name = mynode.Attributes[1].Value;
                    try
                    {
                        obj.Memo = node.Attributes[2].Value;
                    }
                    catch {}
                    this.objSetting.alWebservice.Add(obj);
                }
            }
            catch
            {
                return(-1);
            }
            return(0);
        }
コード例 #2
0
        /// <summary>
        /// 加载xml配置文件
        /// </summary>
        /// <returns></returns>
        private int LoadXml()
        {
            Neusoft.FrameWork.Xml.XML xml = new Neusoft.FrameWork.Xml.XML();

            System.Xml.XmlDocument doc = null;
            try
            {
                doc = xml.LoadXml(this.strFileName);
            }
            catch
            {
                return(-1);
            }
            if (doc == null)
            {
                return(-1);
            }
            System.Xml.XmlNodeList nodes = doc.SelectNodes("/Setting/Panel");
            System.Xml.XmlNodeList ControlNodes;
            foreach (System.Xml.XmlNode node in nodes)
            {
                this.AddSplitButton();
                ControlNodes = node.SelectNodes("Control");
                foreach (System.Xml.XmlNode ControlNode in ControlNodes)
                {
                    try
                    {
                        this.AddButton(ControlNode.Attributes["Text"].Value, int.Parse(ControlNode.Attributes["Special"].Value), ControlNode.Attributes["Tag"].Value);
                    }
                    catch {}
                }
                this.AddSplitButton();
            }
            this.btnLastButton.Dock = DockStyle.Bottom;
            return(0);
        }
コード例 #3
0
        /// <summary>
        /// 读取xml接口文件
        /// <br>读取配置文件 HIS_SETTING.XML,LIS_SETTING.XML,PACS_SETTING.XML</br>
        /// </summary>
        /// <param name="xmlFileName"></param>
        /// <returns></returns>
        public int ReadXML(string xmlFileName)
        {
            //显示进度
            this.ProgressBarValue = 0;
            this.ProgressBarText  = "读取设置信息...";

            System.Xml.XmlDocument           doc;
            System.Xml.XmlNodeList           nodes;
            Neusoft.FrameWork.Models.NeuInfo info = new Neusoft.FrameWork.Models.NeuInfo();

            Neusoft.FrameWork.Xml.XML manageXml = new Neusoft.FrameWork.Xml.XML();
            doc = manageXml.LoadXml(xmlFileName);
            if (doc == null)
            {
                this.Err     = "无法打开文件!" + xmlFileName + manageXml.Err;
                this.ErrCode = "-1";
                this.WriteErr();
                return(-1);
            }
            nodes = doc.SelectNodes("设置/变量");
            try
            {
                foreach (System.Xml.XmlNode node in nodes)
                {
                    this.ProgressBarValue = this.ProgressBarValue + (100 / nodes.Count);

                    info      = new Neusoft.FrameWork.Models.NeuInfo();
                    info.Name = node.Attributes["显示名称"].Value;
                    info.ID   = node.Attributes["变量名"].Value;
                    switch (node.Attributes["类型"].Value.ToString())
                    {
                    case "参数":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Param;
                        break;

                    case "全局变量":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Global;
                        break;

                    case "临时变量":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Temp;
                        break;

                    case "常量":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Const;
                        break;

                    case "患者列表":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.PatientList;
                        break;

                    case "科室列表":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.inDeptList;
                        break;

                    case "关联变量":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Associate;
                        break;

                    case "事件":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.Event;
                        break;

                    case "其它列表":
                        info.type = Neusoft.FrameWork.Models.NeuInfo.infoType.List;
                        break;

                    default:
                        info.type = (Neusoft.FrameWork.Models.NeuInfo.infoType) int.Parse(node.Attributes["类型"].Value.ToString());
                        break;
                    }
                    info.Sql = node.ChildNodes[0].InnerText;
                    try
                    {
                        info.showType = node.ChildNodes[2].InnerText;
                    }
                    catch {}
                    try
                    {
                        info.UpdateSql = node.ChildNodes[1].InnerText;
                    }
                    catch {}
                    info.Memo = info.Sql;                    //存储以前的sql

                    alInfo.Add(info);
                }
                this.ProgressBarValue = 100;
                return(0);
            }
            catch (Exception ex) {
                this.ProgressBarValue = 0;
                Err = ex.Message;
                return(-1);
            }
        }