/// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;


            // string sInstallPath = string.Format(@"{0}\{1}\",Environment.GetEnvironmentVariable("SA_InstallPath", EnvironmentVariableTarget.User), sBuildnumber.Replace("\"",""));
            // Format the string with or without \ depends on c:\temp\installinfo.csv
            string sInstallPath = string.Format(@"{0}{1}", Environment.GetEnvironmentVariable("SA_InstallPath", EnvironmentVariableTarget.User), sBuildnumber.Replace("\"", ""));
            // vars for registration
            string sSerialNumOne = "16ae5u2";
            string sSerialNumTwo = "9999985";
            string sClientId     = "3099099985";
            string sKeyTwo       = "LB81";
            string sKeyThree     = "GXNT";
            string sKeyFour      = "SRFR";
            string sKeyFive      = "BRVF";
            string sCompanyName  = "SageAuto";

            //16AE5U2-LB81-GXNT-SRFR-BRVF
            if (Simply.repo.SelfInfo.Exists())
            {
                Simply._SA_CloseProgram();
            }

            // check if Sage 50 is installed
            if (File.Exists(Simply._SA_GetProgramPath() + Variables.sExecutable))
            {
                SimplyUninstall._SA_Uninstall();
            }


            // do the install
            SimplyInstall._SA_Install(sInstallPath, "16AE5U2", "9999985");

            // activate Sage50
            Simply._SA_StartSage50();
            while (!Register.repo.Self.Visible)
            {
                Thread.Sleep(1000);
            }

            Register._SA_Register(sCompanyName, sSerialNumOne, sSerialNumTwo, sClientId, sSerialNumOne, sKeyTwo, sKeyThree, sKeyFour, sKeyFive);
        }
Beispiel #2
0
        public static void InstallSage50(string sBuildPath, REGI_DATA regdata, bool bOpenSampleDb, bool bServerInstall)
        {
            bool   bInstallSuccess = false;
            bool   bRegister       = true;
            string sInstalledPath  = "";
            bool   bNeedCleanup;

            string sCompanyName = regdata.Company;
            string sSerial1     = regdata.SerialNum1;
            string sSerial2     = regdata.SerialNum2;
            string sClientID    = regdata.ClientID;;
            string sKeyCode1    = sSerial1;
            string sKeyCode2    = "";
            string sKeyCode3    = "";
            string sKeyCode4    = "";
            string sKeyCode5    = "";

            if (GoodData(regdata.ClientID) && GoodData(regdata.Keycode2) && GoodData(regdata.Keycode3) && GoodData(regdata.Keycode4) && GoodData(regdata.Keycode5))
            {
                sKeyCode2 = regdata.Keycode2;
                sKeyCode3 = regdata.Keycode3;
                sKeyCode4 = regdata.Keycode4;
                sKeyCode5 = regdata.Keycode5;
            }
            else
            {
                bRegister = false;
            }

            if (!GoodData(bOpenSampleDb))
            {
                bOpenSampleDb = true;
            }

            // Close Sage 50 if necessary
            if (Simply.repo.SelfInfo.Exists())
            {
                Simply._SA_CloseProgram();
                // Make sure db is released from CM service
                System.Threading.Thread.Sleep(37000);
            }

            sInstalledPath = Simply._SA_GetProgramPath();
            bNeedCleanup   = CleanupNeeded(sInstalledPath);

            bool bCleanCompleted;

            if (bNeedCleanup)
            {
                bCleanCompleted = SimplyUninstall._SA_Uninstall();
            }
            else
            {
                bCleanCompleted = true;
            }

            // Install Sage 50
            bInstallSuccess = SimplyInstall._SA_Install(sBuildPath, sSerial1, sSerial2, bServerInstall);

            if (!bServerInstall && bRegister)
            {
                // Start sage 50
                Simply._SA_StartSage50();

                // Register
                Register._SA_Register(sCompanyName, sSerial1, sSerial2, sClientID, sKeyCode1, sKeyCode2, sKeyCode3, sKeyCode4, sKeyCode5);

                // Wait for Select company dialog to appear
                while (!SelectCompany.repo.SelfInfo.Exists())
                {
                    System.Threading.Thread.Sleep(1000);
                }

                // Open sample company or stop at Select company dialog
                if (bOpenSampleDb)
                {
                    Simply._SA_StartProgram(true);
                }
            }
        }