Ejemplo n.º 1
0
        private static bool DoIsExistIdEx(object dsNmOrId, Mode mode)
        {
            XMLOperation    xmlOperation = new XMLOperation(SysConstManage.DSListFile);
            ILibXMLNodeRead noderead     = xmlOperation.NodeRead("/DSList/DSInfoCollection/DSInfo");

            while (!noderead.EOF)
            {
                if (mode == Mode.ByDSID)
                {
                    int id = LibSysUtils.ToInt32(noderead.Attributions["DSID"].ToString());
                    if (id == LibSysUtils.ToInt32(dsNmOrId))
                    {
                        return(true);
                    }
                }
                else if (mode == Mode.ByDSName)
                {
                    string dsName = noderead.InnerText.Trim();
                    if (string.Compare(dsNmOrId.ToString(), dsName, true) == 0)
                    {
                        return(true);
                    }
                }
                noderead.ReadNext();
            }
            return(false);
        }
Ejemplo n.º 2
0
        private static DataSource DoGetDataSourceEx(object dsNmOrId, Mode mode)
        {
            DataSource      datasource   = null;
            XMLOperation    xmlOperation = new XMLOperation(SysConstManage.DSListFile);
            ILibXMLNodeRead noderead     = xmlOperation.NodeRead("/DSList/DSInfoCollection/DSInfo");
            string          dsname       = null;
            string          package      = null;

            while (!noderead.EOF)
            {
                if (mode == Mode.ByDSID)
                {
                    int id = LibSysUtils.ToInt32(noderead.Attributions["DSID"].ToString());
                    if (LibSysUtils.ToInt32(dsNmOrId) == id)
                    {
                        dsname  = noderead.Attributions["Name"].ToString();
                        package = noderead.Attributions["PACKAGE"].ToString();
                        break;
                    }
                }
                else if (mode == Mode.ByDSName)
                {
                    dsname = noderead.Attributions["Name"].ToString();
                    if (string.Compare(dsname, dsNmOrId.ToString(), true) == 0)
                    {
                        package = noderead.Attributions["PACKAGE"].ToString().Trim();
                        break;
                    }
                }
                noderead.ReadNext();
            }
            InstanceDataSource(ref datasource, dsname, package);
            return(datasource);
        }