Example #1
0
        public EdiDbInterface()
        {
            applicationName = "EDI";
            var     assembly = System.Reflection.Assembly.GetExecutingAssembly();
            Version version  = assembly.GetName().Version;

            applicationVersion = version.ToString();
            userName           = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            machineName        = System.Environment.MachineName;

            var ediDbName        = "MFG_EDI";
            var conn             = new jbConnection();
            var dbServerLocation = conn.GetJbSettingsServer();

            connectionStringToMfgDb = "Data Source=" + dbServerLocation
                                      + ";Initial Catalog=" + ediDbName
                                      + ";User ID=jobboss;Password=Bali;User Instance=false;"
                                      + "MultipleActiveResultSets=true";

            try
            {
                var connectionToMfgDb = new System.Data.SqlClient.SqlConnection(
                    connectionStringToMfgDb);
                connectionToMfgDb.Open();
                connectionToMfgDb.Close();
            }
            catch (Exception e)
            {
                throw new DatabaseNotFoundException(e.Message);
            }
        }
Example #2
0
        static int Main(string[] args)
        {
              var mfgDbName = "MFG_EDI";
              var conn = new jbConnection();
              var dbServerLocation = conn.GetJbSettingsServer();

              var connectionStringToMfgDb = "Data Source=" + dbServerLocation
              + ";Initial Catalog=" + mfgDbName
              + ";User ID=jobboss;Password=Bali;User Instance=false;Trusted_connection=true;MultipleActiveResultSets=false";

            var upgrader =
                DeployChanges.To
                    .SqlDatabase(connectionStringToMfgDb)
                    .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
                    .LogToConsole()
                    .Build();

            var result = upgrader.PerformUpgrade();

            if (!result.Successful)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(result.Error);
                Console.ResetColor();
#if DEBUG
                Console.ReadLine();
#endif
                return -1;
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Success!");
            Console.ResetColor();
            return 0;
        }