예제 #1
0
        static void Main()
        {
            ILl = new EfLoadL();

            DataTable dt = DataTableHelper.QueryableToTable(ILl.LoadLevellingTable);

            dt.TableName = "LoadLevelling";     // il nome della tabella nel db
            DataTable schema = DataTableHelper.QueryableToTable(ILl.SchemaTable);

            schema.TableName = "Schema";

            DataSet ds = new DataSet();

            ds.Tables.Add(dt);
            ds.Tables.Add(schema);

            CalcEXlogicClass.Execute(ds, "loadl", "LoadLevelling");

            DataTable returndt = ds.Tables[0];

            // converte il datatable
            var retlist = DataTableHelper.TableToList <LoadLevelling>(returndt).ToList();

            ILl.MassiveAddData(retlist);
            ILl.MassiveSaveData();
        }
예제 #2
0
        /// <summary>
        /// in argomento passare il path completao del file contenente
        /// gli statement di insert al database.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Dbq = new EfLoadL();

            if (args.Length != 1)
            {
                Console.Write($"Usage: loadDatabase(<path to Insert_statements_file>)\nExit");
                Environment.Exit(1);
            }
            Console.WriteLine($"Inizio insert in database {DateTime.Now:dd.MM.yyyy-HH:mm:ss.fff}");
            RunScript(args[0], Dbq.LlDatabase);
            Console.WriteLine($"Fine insert in database {DateTime.Now:dd.MM.yyyy-HH:mm:ss.fff}");

            // la funzione che segue corregge i dati in tabella, per  renderli coerenti
            // se non serve, commentare quella che segue e' necessario commentarla
            VerifyDataCongruence();

            Console.WriteLine($"START massive saving on database by Entity Framework: {DateTime.Now:dd.MM.yyyy-HH:mm:ss.fff}");
            Dbq.MassiveSaveData();
            Console.WriteLine($"END massive saving on database by Entity Framework: {DateTime.Now:dd.MM.yyyy-HH:mm:ss.fff}");
        }