/// <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); }
/// <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 sT5018Summary = @"C:\Users\Public\Documents\Simply Accounting\2018\Data\Summary of Contract Payments.pdf";// @"C:\Users\_sabvt\Documents\Simply Accounting\DATA\Summary of Contract Payments.pdf"; string sInstallPath = Simply._SA_GetProgramPath(); string sDllPath = string.Format(@"{0}acPDFCreatorLib.Net.dll", sInstallPath); // Check Sage 50 pdf engine dll is installed before starting test case if (Functions.VerifyFileExists(sDllPath)) { // Remove existing pdf file Functions.RemoveExistingFile(sT5018Summary); // Create a T5018 vendor VENDOR tvendor = new VENDOR(); tvendor.name = StringFunctions.RandStr("A(9)"); tvendor.includeFilingT5018CheckBox = true; PayablesLedger._SA_Create(tvendor); PayablesLedger._SA_Close(); // Create an item ITEM item = new ITEM(); ITEM_PRICE itemPrice = new ITEM_PRICE(); itemPrice.currency = "Canadian Dollars"; itemPrice.priceList = "Regular"; itemPrice.pricePerSellingUnit = Functions.RandCashAmount(); item.ItemPrices.Add(itemPrice); if (this.varItem == "") { item.invOrServNumber = StringFunctions.RandStr("A(9)"); InventoryServicesLedger._SA_Create(item); InventoryServicesLedger._SA_Close(); } else { item.invOrServNumber = this.varItem; } // Create purchase invoice using T5018 vendor PURCHASE_INVOICE purInv = new PURCHASE_INVOICE(); purInv.Vendor = tvendor; purInv.transNumber = StringFunctions.RandStr("9(8)"); ROW firstRow = new ROW(); firstRow.Item.invOrServNumber = item.invOrServNumber; firstRow.quantityReceived = Functions.RandCashAmount(2); firstRow.price = Functions.RandCashAmount(); purInv.GridRows.Add(firstRow); PurchasesJournal._SA_Create(purInv); PurchasesJournal._SA_Close(); // Print T5018 summary to a file string sCraNumber = "403381601RZ0001"; Simply._Print_T5018Summary(sCraNumber); // Verify printed file if (!Functions.VerifyFileExists(sT5018Summary)) { Functions.Verify(false, true, "Printed T5018 form found"); } } else { Functions.Verify(false, true, "PDF engine dll file found"); } // Wait 5 seconds before moving on to next testcase Thread.Sleep(5000); }
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); } } }