Example #1
0
        public Config.Database DatabaseConfig()
        {
            string  Config   = File.ReadAllText(AppPath.ConfigFile());
            dynamic JSConfig = JsonConvert.DeserializeObject(Config);

            Config.Database thisConfig = new Config.Database
            {
                Server       = JSConfig.Database.Server,
                UserName     = JSConfig.Database.UserName,
                Password     = JSConfig.Database.Password,
                DatabaseName = JSConfig.Database.DataBaseName
            };
            return(thisConfig);
        }
Example #2
0
        public static Config.ImportActionModel MigMiniModelToModel(List <Config.Database> dbs1, List <Config.Database> dbs2, Config.ImportActionMiniModel action)
        {
            Config.ImportActionModel newaction = null;
            if (action != null)
            {
                Config.Database db1 = null;
                Config.Database db2 = null;
                foreach (var a in dbs1)
                {
                    if (a.source + "_" + a.database == action.database1)
                    {
                        db1 = a;
                        break;
                    }
                }

                foreach (var a in dbs2)
                {
                    if (a.source + "_" + a.database == action.database2)
                    {
                        db2 = a;
                        break;
                    }
                }
                if (db1 != null && db2 != null)
                {
                    Config.ImportActionModel model = new Config.ImportActionModel();
                    model.database1         = db1;
                    model.database2         = db2;
                    model.importthreadcount = action.importthreadcount;
                    model.insertpagesize    = action.insertpagesize;
                    model.excepttables      = action.excepttables;
                    model.getpagesize       = action.getpagesize;
                    model.cutomsactions     = action.cutomsactions;
                    newaction = model;
                }
            }
            return(newaction);
        }