示例#1
0
 /// <summary>
 /// 
 /// Description: 根据状态sql取出所有的状态
 /// Author:Liudpc
 /// Create Date: 2010-6-13 11:46:22
 /// </summary>
 /// <param name="sSqlstring"></param>
 /// <param name="db"></param>
 /// <returns></returns>
 public string[] GetStateValue(string sSqlstring, ServerDatabaseEntityCRF db)
 {
     DataTable dt = new DataHelper.DataTableAutoHelperCDH().GetDataTable(db, sSqlstring, null);
     string[] str = new string[dt.Rows.Count];
     for (int i = 0, j = str.Length; i < j; i++)
     {
         str[i] = dt.Rows[i][0].ToString().Trim();
     }
     return str;
 }
        public static bool LoadConfig()
        {
            ReplaceFileConfigEntityCCC rfce = new ReplaceFileConfigEntityCCC();
            rfce.DataServerList = new List<ServerDatabaseEntityCRF>();
            rfce.EmailServerList = new List<ServerEmailEntityCRF>();
            XmlDocument xdConfig = new XmlDocument();
            xdConfig.Load(CommonConfig.FrameWorkConfigCCC.GetFrameWorkConfigRoot().CommonConfigPath);

            XmlDocument xd = new XmlDocument();
            xd.Load(FrameWorkConfigCCC.GetConfigPath(XmlStaticCCF.GetChildValueByName(xdConfig.DocumentElement, "ReplaceFile/ReplaceFilePath")));
            XmlNode xnRoot = xd.DocumentElement;

            rfce.SplitString = XmlStaticCCF.GetChildValueByName(xnRoot, "Config/SplitString");
            rfce.ReplaceFrom = XmlStaticCCF.GetChildValueByName(xnRoot, "Config/ReplaceFrom");
            rfce.MainParmReplace = XmlStaticCCF.GetChildValueByName(xnRoot, "Config/MainParmReplace");

            rfce.XmlFileDirectory = FrameWorkConfigCCC.GetConfigPath(XmlStaticCCF.GetChildValueByName(xnRoot, "Config/XmlFileDirectory"));
            IoStaticCCF.CheckDirectory(rfce.XmlFileDirectory);

            rfce.XmlFileHistoryDir = FrameWorkConfigCCC.GetConfigPath(XmlStaticCCF.GetChildValueByName(xnRoot, "Config/XmlFileHistoryDir"));
            IoStaticCCF.CheckDirectory(rfce.XmlFileHistoryDir);

            rfce.CodeFileApp = XmlStaticCCF.GetChildValueByName(xnRoot, "Config/CodeFileApp");
            rfce.DesignFileApp = XmlStaticCCF.GetChildValueByName(xnRoot, "Config/DesignFileApp");

            rfce.ListFileDir = FrameWorkConfigCCC.GetConfigPath(XmlStaticCCF.GetChildValueByName(xnRoot, "Config/ListFileDir"));

            IoStaticCCF.CheckDirectory(rfce.ListFileDir);

            rfce.ListFilePath = rfce.ListFileDir + XmlStaticCCF.GetChildValueByName(xnRoot, "Config/ListFilePath");

            foreach (XmlNode xn in xnRoot.SelectNodes("DataServerInfo/DataServer"))
            {
                ServerDatabaseEntityCRF db = new ServerDatabaseEntityCRF();
                db.Id = xn.Attributes["id"].Value.Trim();

                switch (xn.Attributes["serverType"].Value.Trim())
                {
                    case "mssql":
                        db.ServerType = EnumCommon.DataServerType.MsSql;
                        break;

                    default:
                        db.ServerType = EnumCommon.DataServerType.MsSql;
                        break;
                }

                db.ConnString = XmlStaticCCF.GetAttValueByName(xn, "connString");

                rfce.DataServerList.Add(db);
            }

            foreach (XmlNode xn in xnRoot.SelectNodes("EmailServerInfo/EmailServer"))
            {
                ServerEmailEntityCRF em = new ServerEmailEntityCRF();
                em.Id = xn.Attributes["id"].Value.Trim();

                rfce.EmailServerList.Add(em);
            }

            rcEntity = rfce;
            return true;
        }