Ejemplo n.º 1
0
        private void CreatePlugin()
        {
            if (firstPlugin)
            {
                string           path   = Application.StartupPath + "/plugins/SystemPlugin.dll";
                FileInfo         dir    = new FileInfo(path);
                AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();
                string           ip     = config.SysConfig.Ip;
                string           dbname = config.SysConfig.DbName;
                string           userid = config.SysConfig.UID;
                string           pwd    = config.SysConfig.Pwd;
                if (dir.Exists && dbname.Length > 0 && userid.Length > 0)
                {
                    System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(path);
                    Type t  = ass.GetType("SystemPlugin.StudentPlugin");
                    Type t1 = typeof(FT.DAL.IDataAccess);
                    System.Reflection.ConstructorInfo cinfo = t.GetConstructor(new Type[] { t1 });

                    object o1 = null;
                    if (config.SysConfig.DbType.ToLower() == "sqlserver")
                    {
                        o1 = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "oracle")
                    {
                        o1 = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "access")
                    {
                        if (pwd.Length > 0)
                        {
                            o1 = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"没有找到插件类,无法同步!");
                    }
                }

                firstPlugin = false;
            }
        }
Ejemplo n.º 2
0
        private void CreatePlugin()
        {
            if (firstPlugin)
            {
                string path = Application.StartupPath + "/plugins/SystemPlugin.dll";
                FileInfo dir = new FileInfo(path);
                AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();
                string ip = config.SysConfig.Ip;
                string dbname = config.SysConfig.DbName;
                string userid = config.SysConfig.UID;
                string pwd = config.SysConfig.Pwd;
                if (dir.Exists && dbname.Length > 0 && userid.Length > 0)
                {
                    System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(path);
                    Type t = ass.GetType("SystemPlugin.StudentPlugin");
                    Type t1 = typeof(FT.DAL.IDataAccess);
                    System.Reflection.ConstructorInfo cinfo = t.GetConstructor(new Type[] { t1 });

                    object o1 = null;
                    if (config.SysConfig.DbType.ToLower() == "sqlserver")
                    {
                        o1 = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "oracle")
                    {
                        o1 = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "access")
                    {
                        if (pwd.Length > 0)
                        {
                            o1 = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"û���ҵ�����࣬�޷�ͬ����");
                    }
                }

                firstPlugin = false;
            }
        }