Exemple #1
0
        /// <summary>获取数据源列表 </summary>
        private static List <DataSource> DoGetDataSourceList(ref DSList dsinfolist)
        {
            List <DataSource> dsList        = new List <DataSource>();
            FileOperation     fileOperation = new FileOperation();

            fileOperation.FilePath = SysConstManage.DSListFile;
            fileOperation.Encoding = LibEncoding.UTF8;
            string dsListXML = fileOperation.ReadFile();

            dsinfolist = SerializerUtils.XMLDeSerialize <DSList>(dsListXML);
            if (dsinfolist.DSInfoCollection != null && dsinfolist.DSInfoCollection.Count > 0)
            {
                DataSource ds = null;
                foreach (DSInfo info in dsinfolist.DSInfoCollection)
                {
                    ds                = new DataSource();
                    ds.DSID           = info.DSID;
                    ds.DataSourceName = info.Name;
                    //ds.DSDisplayText = info.DISPLAYTEXT;
                    ds.Package = info.PACKAGE;
                    dsList.Add(ds);
                }
            }
            #region 旧的做法
            //XMLOperation xmlOperation = new XMLOperation(SysConstManage.DSListFile);
            //ILibXMLNodeRead noderead = xmlOperation.NodeRead("/DATASOURCES/Name");
            //while (!noderead.EOF)
            //{
            //    DataSource ds = new DataSource();
            //    ds.DSID = LibSysUtils.ToInt32(noderead.Attributions["DSID"]);
            //    ds.DataSourceName = noderead.InnerText.Trim();
            //    ds.DSDisplayText = noderead.Attributions["DISPLAYTEXT"].ToString();
            //    ds.Package = noderead.Attributions["PACKAGE"].ToString();
            //    dsList.Add(ds);
            //    noderead.ReadNext();
            //}
            #endregion
            return(dsList);
        }
Exemple #2
0
 public static List <DataSource> DoGetDataSourceListEx(ref DSList dsinfolist)
 {
     return(DoGetDataSourceList(ref dsinfolist));
 }