public static void _SA_SetFlavorVariables()
        {
            Variables.bAcctEd = false;
            if (Simply._SA_IsItAccountantsEdition())
            {
                Variables.bAcctEd = true;
            }

            if (Simply._SA_IsItFlavor(FLAVOR.ENTERPRISE))
            {
                Variables.SimplyFlavor = FLAVOR.ENTERPRISE;
            }
            else if (Simply._SA_IsItFlavor(FLAVOR.PREMIUM))
            {
                Variables.SimplyFlavor = FLAVOR.PREMIUM;
            }
            else if (Simply._SA_IsItFlavor(FLAVOR.PRO))
            {
                Variables.SimplyFlavor = FLAVOR.PRO;
            }
            else if (Simply._SA_IsItFlavor(FLAVOR.FIRST_STEP))
            {
                Variables.SimplyFlavor = FLAVOR.FIRST_STEP;
            }
            else
            {
                Functions.Verify(false, true, "Able to set flavor variable");
            }
        }
        public static void _SA_OpenCompany(string dbPath)
        {
            if (!OpenCompany.repo.SelfInfo.Exists())
            {
                OpenCompany._Invoke();

                SimplyMessage._SA_HandleMessage(SimplyMessage.repo.Yes, SimplyMessage.repo._Msg_AreYouSureYouAreFinishedWithThisCompany);

                if (SimplyMessage.repo._Msg_DoyouwanttobackupthiscompanybeforeclosingInfo.Exists())
                {
                    SimplyMessage.repo.NoRadioBtn.Click();
                    SimplyMessage.repo.DoNotAskMeAgain.Check();
                    SimplyMessage.repo.OK.Click();
                }
            }

            OpenCompany.repo.FileName.TextValue = dbPath;
            OpenCompany.repo.Open.Click();

            // if necessary convert db, then handle messages to get to home window
            Simply._SA_GotoHomeWindow();

            // set flavor
            if ((!Functions.GoodData(Variables.bAcctEd)) || (Variables.bAcctEd))
            {
                Simply._SA_SetFlavorVariables();
            }

            // if we don't do this it will populate with previous db
            Settings._SA_GetCompanyInformation();
        }
        public static void _SA_StartSage50()
        {
            string sStartupLocation = Simply._SA_GetProgramPath() + Variables.sExecutable;

            Functions.LaunchAProgram(sStartupLocation);
            Thread.Sleep(1000);
        }
Exemple #4
0
 public static void _SA_Invoke()
 {
     if (Simply.isEnhancedView())
     {
         Simply.repo.Self.Activate();
         Simply.repo.EmployeeLink.Click();
         Simply.repo.PaychqRunIcon.Click();
     }
 }
 public static void _SA_Invoke()
 {
     if (Simply.isEnhancedView())
     {
         Simply.repo.Self.Activate();
         Simply.repo.ReceivablesLink.Click();
         Simply.repo.ReceiptsIcon.Click();
     }
 }
Exemple #6
0
 public static void _SA_Invoke()
 {
     if (Simply.isEnhancedView())
     {
         Simply.repo.Self.Activate();
         Simply.repo.PayablesLink.Click();
         Simply.repo.PurchaseIcon.Click();
     }
 }
Exemple #7
0
        public static void _SA_Invoke(Boolean bOpenLedger)
        {
            if (Simply.isEnhancedView())
            {
                Simply.repo.Self.Activate();
                Simply.repo.ProjectsLink.Click();
                Simply.repo.ProjectsIcon.Click();
            }
            else
            {
            }

            if (ProjectIcon.repo.SelfInfo.Exists())
            {
                if (bOpenLedger == true)
                {
                    ProjectIcon.repo.CreateNew.Click();
                    ProjectIcon.repo.Self.Close();
                }
            }
        }
Exemple #8
0
        public static void _SA_Invoke(Boolean bOpenLedger)
        {
            // open ledger depending on view type

            if (Simply.isEnhancedView())
            {
                Simply.repo.Self.Activate();
                Simply.repo.GeneralLink.Click();
                Simply.repo.GeneralJournalIcon.Click();
            }
            else
            {
            }

            if (VendorIcon.repo.SelfInfo.Exists())
            {
                if (bOpenLedger == true)
                {
                    VendorIcon.repo.CreateNew.Click();
                    VendorIcon.repo.Self.Close();
                }
            }
        }
        public static void _SA_StartProgram(bool bUseSample, string CompanyPath)
        {
            // or hard wait?
            while (!SelectCompany.repo.SelfInfo.Exists(Variables.iExistWaitTime))
            {
                Thread.Sleep(1000);
            }

            if (!SelectCompany.repo.Self.Visible)
            {
                _SA_StartSage50();

//                // handle the PU download dialog
//                if (DownloadUpdate.Instance.Window.Exists())
//                {
//                    DownloadUpdate.Instance.Window.SetActive();
//                    DownloadUpdate.Instance.DownloadLater.Click();
//                }

                // check if restart message shows
                // SimplyMessage._SA_HandleMessage(SimplyMessage.repo.No);
            }

            // we have to check this when the product is not yet registered
            // the below window only shows when company is already registered, therefore we need it to skip everything with registration window shows
            while (!SelectCompany.repo.Self.Visible)
            {
                Thread.Sleep(1000);
            }

            SelectCompany.repo.Self.Activate();

            if (Functions.GoodData(CompanyPath))
            {
                SelectCompany.repo.SelectAnExistingCompany.Click();
                SelectCompany.repo.OK.Click();

                OpenCompany.repo.Self.Activate();
                Simply._SA_OpenCompany(CompanyPath);
            }
            else
            {
                if (bUseSample)
                {
                    SelectCompany.repo.OpenSampleCompany.Click();
                }
                else    // defaults to last company opened
                {
                    // A Recently used company radio button and Last company you worked on are the same
                    if (SelectCompany.repo.OpenARecentlyUsedCompanyInfo.Exists())
                    {
                        SelectCompany.repo.OpenARecentlyUsedCompany.Click();
                    }
                    else        // log error
                    {
                        Functions.Verify(false, true, "The radio list item to open the last company used is found");
                    }
                }
                SelectCompany.repo.Self.Activate();
                SelectCompany.repo.OK.Click();

                // If necessary wait for CM service to start
                // Handle CM error, in main machine CM service is not started when opening sample db
                while (!SimplyMessage.repo.CmMessageTextInfo.Exists())
                {
                    if (UpgradeCompany.repo.SelfInfo.Exists() || SimplyMessage.repo.SelfInfo.Exists())
                    {
                        break;
                    }
                }

                if (SimplyMessage.repo.CmMessageTextInfo.Exists())                      // Ranorex see select company as SimplyMessage as well
                {
                    if (SimplyMessage.repo.CmMessageText.TextValue.Contains(SimplyMessage.sCmNotRunningMsg) || SimplyMessage.repo.CmMessageText.TextValue.Contains(SimplyMessage.sCmNotFoundMsg))
                    {
                        try
                        {
                            iCmTry++;
                            // Maximum 7 tries
                            if (iCmTry > 8)
                            {
                                Functions.Verify(false, true, "CM service started");
                            }
                            else
                            {
                                // wait
                                System.Threading.Thread.Sleep(10000);
                                SimplyMessage.repo.Self.Activate();
                                // SimplyMessage.repo.TryAgain.Click();
                                SimplyMessage.repo.Close.Click();                                       // if tryagain doesn't work
                                // Try from select company dialog again
                                _SA_StartProgram(bUseSample, CompanyPath);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                }
                else
                {
                    // for beta
                    // SimplyMessage.Instance._SA_HandleMessage(SimplyMessage.OK_LOC);

                    // handle messages and stuff to get to home window
                    Simply._SA_GotoHomeWindow();

                    // get the build number
                    //binfo.sBuildNumber =GetSimplyBuildNumber( + Simply.Instance._SA_GetProgramPath () + "simplyaccounting.exe"); NC

                    // set flavor
                    Simply._SA_SetFlavorVariables();

                    // get version Cdn or US
                    // Simply._SA_getVersion (true);
                }
            }
        }
        public static void _SA_Create(COMPANY Company)
        {
            Simply.repo.Self.Activate();
            Simply.repo.File.Click();
            Simply.repo.NewCompany.Click();

            SimplyMessage._SA_HandleMessage(SimplyMessage.repo.Yes, SimplyMessage.repo._Msg_AreYouSureYouAreFinishedWithThisCompany);

            NewCompanyWizard.repo.Next.Click();

            if (NewCompanyWizard.repo.QuantumInfo.Exists())
            {
                switch ((int)Company.edition)
                {
                case 1:
                    NewCompanyWizard.repo.First.Click();
                    break;

                case 2:
                    NewCompanyWizard.repo.Pro.Click();
                    break;

                case 3:
                    NewCompanyWizard.repo.Premium.Click();
                    break;

                case 4:
                    NewCompanyWizard.repo.Quantum.Click();
                    break;

                default:
                    NewCompanyWizard.repo.Premium.Click();
                    break;
                }

                NewCompanyWizard.repo.Next.Click();
            }

            NewCompanyWizard.repo.Name.TextValue = Company.companyInformation.companyName;
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.street1))
            {
                NewCompanyWizard.repo.Street1.TextValue = Company.companyInformation.Address.street1;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.street2))
            {
                NewCompanyWizard.repo.Street2.TextValue = Company.companyInformation.Address.street2;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.city))
            {
                NewCompanyWizard.repo.City.TextValue = Company.companyInformation.Address.city;
            }
//			if  (Variables.productVersion ==  "Canadian")
//			{
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.provinceCode))
            {
                NewCompanyWizard.repo.Province.Select(Company.companyInformation.Address.provinceCode);
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.province))
            {
                NewCompanyWizard.repo.ProvinceName.TextValue = Company.companyInformation.Address.province;
            }
//			}
//			else
//			{
//				if (Functions.GoodData (Company.companyInformation.Address) && Functions.GoodData (Company.companyInformation.Address.State))
//				{
//					NewCompanyWizard.Instance.State.SetText (Company.companyInformation.Address.State);
//				}
//			}
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.country))
            {
                NewCompanyWizard.repo.Country.TextValue = Company.companyInformation.Address.country;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.postalCode))
            {
                NewCompanyWizard.repo.Postal.TextValue = Company.companyInformation.Address.postalCode;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.phone1))
            {
                NewCompanyWizard.repo.Phone1.TextValue = Company.companyInformation.Address.phone1;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.phone2))
            {
                NewCompanyWizard.repo.Phone2.TextValue = Company.companyInformation.Address.phone2;
            }
            if (Functions.GoodData(Company.companyInformation.Address) && Functions.GoodData(Company.companyInformation.Address.fax))
            {
                NewCompanyWizard.repo.Fax.TextValue = Company.companyInformation.Address.fax;
            }
            NewCompanyWizard.repo.Next.Click();

            if (!(Functions.GoodData(Company.companyInformation.fiscalStart)))
            {
                Company.companyInformation.fiscalStart = "1/1/" + Variables.sLongYear + "";
            }
            NewCompanyWizard.repo.FiscalStart.TextValue = Company.companyInformation.fiscalStart;
            if (Functions.GoodData(Company.companyInformation.earliestTransaction))
            {
                NewCompanyWizard.repo.EarliestTransaction.TextValue = Company.companyInformation.earliestTransaction;
            }
            else
            {
                Company.companyInformation.earliestTransaction = NewCompanyWizard.repo.EarliestTransaction.TextValue;
            }
            if (Functions.GoodData(Company.companyInformation.fiscalEnd))
            {
                NewCompanyWizard.repo.FiscalEnd.TextValue = Company.companyInformation.fiscalEnd;
            }
            else
            {
                Company.companyInformation.fiscalEnd = NewCompanyWizard.repo.FiscalEnd.TextValue;
            }
            NewCompanyWizard.repo.Next.Click();

            // Select default the list of accounts
            NewCompanyWizard.repo.Next.Click();

            if (Company.ownership != 0)
            {
                NewCompanyWizard.repo.Ownership.Select(Company.ownership.ToString());
            }
            else
            {
                Company.ownership = (OWNERSHIP)NewCompanyWizard.repo.Ownership.SelectedItemIndex;
            }
            if (Company.industryType != 0)
            {
                NewCompanyWizard.repo.IndustryType.Select(Company.industryType.ToString());
            }
            else
            {
                Company.industryType = (INDUSTRY_TYPE)NewCompanyWizard.repo.IndustryType.SelectedItemIndex;
            }
            if (Functions.GoodData(Company.companyType))
            {
                NewCompanyWizard.repo.CompanyType.SelectListItem(Company.companyType);
            }
            else
            {
                Company.companyType = NewCompanyWizard.repo.CompanyType.SelectedItemText;
            }

            // Account ranges
            if (Company.AccountDetails.accountNumberDigits != 0)  // temp using till good data is properly updated
            {
                NewCompanyWizard.repo.AccountRanges.Click();

                if (Functions.GoodData(Company.AccountDetails.accountNumberDigits))
                {
                    AccountInformation.repo.Digits.Select(Company.AccountDetails.accountNumberDigits.ToString());
                }
                else
                {
                    Company.AccountDetails.accountNumberDigits = 4;
                }

                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.startingAssetAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.startingAssetAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.endingAssetAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.endingAssetAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.startingLiabilityAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.startingLiabilityAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.endingLiabilityAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.endingLiabilityAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.startingEquityAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.startingEquityAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.endingEquityAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.endingEquityAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.startingRevenueAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.startingRevenueAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.endingRevenueAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.endingRevenueAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.startingExpenseAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.startingExpenseAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                if (Functions.GoodData(Company.AccountDetails.endingExpenseAccountNumber))
                {
                    AccountInformation.repo.AccountContainer.SetText(Company.AccountDetails.endingExpenseAccountNumber);
                }
                AccountInformation.repo.AccountContainer.MoveRight();
                AccountInformation.repo.OK.Click();
            }
            else
            {
                Company.AccountDetails.accountNumberDigits = 4;
            }
            NewCompanyWizard.repo.Next.Click();

            if (Functions.GoodData(Company.companyNameFile))
            {
                NewCompanyWizard.repo.CompanyName.TextValue = Company.companyNameFile;
            }
            else
            {
                Company.companyNameFile = NewCompanyWizard.repo.CompanyName.TextValue;
            }
            if (Functions.GoodData(Company.companyFileLocation))
            {
                NewCompanyWizard.repo.Location.TextValue = Company.companyFileLocation;
            }
            else
            {
                Company.companyFileLocation = NewCompanyWizard.repo.Location.TextValue;
            }
            NewCompanyWizard.repo.Next.Click();

            //SimplyMessage._SA_HandleMessage(SimplyMessage.Yes, SimplyMessage._Msg_TheFolderAndFileDoNotExist)
//			//SimplyMessage._SA_HandleMessage (SimplyMessage.Yes, SimplyMessage._Msg_ReplaceExistingFile)
            if (SimplyMessage.repo.YesInfo.Exists())
            {
                SimplyMessage.repo.Yes.Click();
            }

            NewCompanyWizard.repo.Finish.Click();

            while (!NewCompanyWizard.repo.CloseInfo.Exists())
            {
                Thread.Sleep(1000);
            }

            NewCompanyWizard.repo.Close.Click();

            // Getting started always exists when a new company is created
            while (!GettingStarted.repo.SelfInfo.Exists())
            {
                Thread.Sleep(500);
            }
            GettingStarted.repo.Show.Uncheck();
            GettingStarted.repo.Close.Click();


            Simply.isEnhancedView();
//            Simply.Instance.SwitchViewLink.Click();
            // FunctionsLib.WUEn (Simply.Instance.SwitchToEnhancedViewLink);DW

            if ((!Functions.GoodData(Variables.bAcctEd)) || (Variables.bAcctEd))
            {
                Simply._SA_SetFlavorVariables();
            }

            Settings._SA_SetToGenericValues();                  // need to do this after getting a new, clean company
            Variables.bHistoryMode = true;
        }
        public static bool _SA_Install(string sDirToInstallFrom, string serial1, string serial2, bool bServerInstall)
        {
            string sPathToInstallFrom;
            bool   bSucess = true;

            try
            {
                // Compose install path
                if (Directory.Exists(string.Format(@"{0}\Setup", sDirToInstallFrom)))
                {
                    sPathToInstallFrom = string.Format(@"{0}\Setup\setup.exe", sDirToInstallFrom);
                }
                else if (Directory.Exists(string.Format(@"{0}\cd\setup", sDirToInstallFrom)))
                {
                    sPathToInstallFrom = string.Format(@"{0}\cd\setup\setup.exe", sDirToInstallFrom);
                }
                else
                {
                    Functions.Verify(false, true, "Valid install path found");
                    bSucess = false;
                    return(bSucess);
                }

                // Start setup.exe
                Functions.LaunchAProgram(sPathToInstallFrom);

                while (!SimplyInstall.repo.SelfInfo.Exists())
                {
                    Thread.Sleep(1000);
                }

                // Select language
                SimplyInstall.repo.SelectLanguage.Select("English");
                SimplyInstall.repo.OK.Click();

                // C++ packages
                if (SimplyInstall.repo.InstallInfo.Exists())
                {
                    SimplyInstall.repo.Install.Click();

                    // Known issue: failed to install lower version C++ package, can continue install
                    int x = 1;
                    while (!SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                    {
                        if (x > 60)
                        {
                            break;
                        }
                        Thread.Sleep(1000);
                        x++;
                    }
                    if (SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                    {
                        if (SimplyInstall.repo.UninstallDialogText.TextValue.Contains(SimplyMessage.sInstall_FailedInstallPackage))
                        {
                            SimplyInstall.repo.Yes.Click();
                        }
                    }
                }

                // Wait for Windows update page or Firwall or Installation page
                while (!SimplyInstall.repo.YesInfo.Exists() && !SimplyInstall.repo.NextInfo.Exists())
                {
                    Thread.Sleep(300);
                }

                // If Windows update question pops up
                if (SimplyInstall.repo.SelfInfo.Exists() && SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                {
                    if (SimplyInstall.repo.UninstallDialogText.TextValue.Contains(SimplyMessage.sInstall_WindowsUpdateMsg))
                    {
                        SimplyInstall.repo.Yes.Click();
                        Thread.Sleep(500);
                    }
                }

                // If Windows firewall is on
                if (SimplyInstall.repo.InstallDialogTextInfo.Exists())
                {
                    if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Firewall"))
                    {
                        SimplyInstall.repo.Next.Click();
                    }
                }

                // Installation type
                // Ranorex nullexception message when using: (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Type of installation") && bServerInstall)
                if (bServerInstall && SimplyInstall.repo.AdvancedBtnInfo.Exists())
                {
                    SimplyInstall.repo.AdvancedBtn.Click();
                    SimplyInstall.repo.Next.Click();

                    // Next page
                    SimplyInstall.repo.ServerOnlyBtn.Click();
                    SimplyInstall.repo.Next.Click();

                    // Next page
                    SimplyInstall.repo.Next.Click();
                }
                else                    // Full install
                {
                    SimplyInstall.repo.Next.Click();

                    // Serial number
                    if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Product installation"))
                    {
                        SimplyInstall.repo.Serial1.TextValue = serial1;
                        SimplyInstall.repo.Serial2.TextValue = serial2;
                        SimplyInstall.repo.Next.Click();
                    }
                }

                // License agreement
                if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("License agreement"))
                {
                    SimplyInstall.repo.AgreeToLicenseAgreement.Click();                     // need to use click to enable Install button
                    SimplyInstall.repo.Install.Click();
                }

                // Wait for Installation to complete
                int y = 1;
                while (!SimplyInstall.repo.FinishInfo.Exists())
                {
                    if (y > 1000)
                    {
                        bSucess = false;
                        Functions.Verify(false, true, "Install - Finish button found");
                        break;
                    }
                    Thread.Sleep(1000);
                    y++;
                }

                // Finish
                if (bServerInstall)
                {
                    SimplyInstall.repo.Finish.Click();
                    while (!InstallationGuide.repo.SelfInfo.Exists())
                    {
                        Thread.Sleep(500);
                    }
                    InstallationGuide.repo.Self.Close();
                }
                else
                {
                    SimplyInstall.repo.OpenReadMe.SetState(false);
                    SimplyInstall.repo.OpenSage50.SetState(false);
                    SimplyInstall.repo.Finish.Click();
                }
            }

            catch (Exception e)
            {
                Ranorex.Report.Info(e.Message);
                bSucess = false;
            }

            if (bSucess)
            {
                Ranorex.Report.Info(string.Format("Program installed successfully to {0}", Simply._SA_GetProgramPath()));
            }

            Functions.Verify(bSucess, true, "Program installed successfully");

            return(bSucess);
        }