示例#1
0
        private static void Init()
        {
            try
            {
                // 初始化OrderBLL
                SystemBLL.InitOrderBLL();
                List<EntityInfo> listResult = new List<EntityInfo>();
                List<XElement> listEntityXml = new List<XElement>();
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                //  string path = ConfigurationManager.AppSettings["UIXml"];
                string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

                doc.Load(path + "\\FB_UI_Config.xml");
                XmlNodeList list = doc.SelectNodes("FB/Orders/Order");
                foreach (XmlNode node in list)
                {

                    XElement xOrder = GetXOrder(node);
                    listEntityXml.Add(xOrder);

                    XmlNode nodeEntity = node.SelectSingleNode("OrderEntity/Entity");
                    if (nodeEntity != null)
                    {
                        EntityInfo eInfo = new EntityInfo();
                        eInfo.EntityCode = node.Attributes["Type"].Value;
                        eInfo.Type = nodeEntity.Attributes["Type"].Value;
                        eInfo.KeyName = nodeEntity.Attributes["KeyName"].Value;
                        if (nodeEntity.Attributes["CodeName"] != null)
                        {
                            eInfo.CodeName = nodeEntity.Attributes["CodeName"].Value;
                        }
                        listResult.Add(eInfo);
                    }
                }
                FBCommonBLL.FBCommonEntityList = listResult;

                // 预算设置
                list = doc.SelectNodes("FB/Settings/Setting");
                foreach (XmlNode node in list)
                {
                    SystemBLL.Settings.Add(node.Attributes["Key"].Value, node.Attributes["Value"].Value);
                }
                FBCommonBLL.FBServiceUrl = ConfigurationManager.AppSettings["FBServiceUrl"];
                SystemBLL.DebugMode = ConfigurationManager.AppSettings["FBDebugMode"] == "True" ? true : false;
                #region beyond, 元数据模版
                Dictionary<string, XElement> dictXE = new Dictionary<string, XElement>();
                System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"xml\");
                dirInfo.GetFiles().ToList().ForEach(item =>
                {
                    XElement xeroot = XElement.Load(item.FullName);
                    XElement xe = xeroot;
                    dictXE.Add(item.Name.ToLower().Replace(".xml", ""), xe);

                });
                AuditBLL.dictXML_XE = dictXE;

                #endregion
            }
            catch (Exception ex)
            {

                Tracer.Debug("系统初始化失败" + ex.ToString());
            }
        }