public void ATC6629c_CRMTESTINGEndtoEndSingleFormBPayCRM()
        {
            #region Start Up Excel
            MyApp = new Excel.Application();
            MyApp.Visible = false;
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString()== "6629")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string tenancyrequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string bond = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRibbonButton();

            TenancySearchPage tenancySearchPage = new TenancySearchPage(driver);
            tenancySearchPage.SetTenancySearchText(bond);

            Table table = new Table(tenancySearchPage.GetSearchResultTable());
            table.SelectTableRow("Bond Number", bond);

            TenancyPage tenancyPage = new TenancyPage(driver);
            tenancyPage.HoverBondPropertyRibbonTab();
            tenancyPage.ClickBondTenancyRequestRibbonButton();
            tenancyPage.ClickSelectViewButton();
            tenancyPage.SetViewList("All Tenancy Requests");

            table = new Table(tenancyPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyrequest, "Name"), tenancyrequest);
            table.ClickCellValue("Name", tenancyrequest, "Name");

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Financials processing successful");
            StringAssert.Contains(tenancyRequestPage.GetPropertyDataControlModeRTAFundedStatus(), "deactivated");
            StringAssert.Contains(tenancyRequestPage.GetAmountMatched(), "$1,000.00");
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Completed");

            //reveiced date?? step 19

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void SetSubStatus(string subStatus)
        {
            this.OpenLookUpRecordWindow("rta_inv_sub_statusid");

            driver.SwitchTo().DefaultContent();
            driver.SwitchTo().Frame(dialogFRAME);
            Table table = new Table(this.GetStatusTable());
            table.SelectTableRow("Name", subStatus);

            string BaseWindow = driver.CurrentWindowHandle;

            if (driver.WindowHandles.Count > 1)
            {
                driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Investigation Case Status");

                InvestigationCaseStatusPage investigationStatus = new InvestigationCaseStatusPage(driver);
                investigationStatus.CloseWindow();

                driver = driver.SwitchTo().Window(BaseWindow);
            }
        }
        public void ATC3284_CRMEntityAllegedOffenceBeliefDateblankedStatusReasonreverts()
        {
            string allegedoffenceId;
            string todayDate = DateTime.Now.ToString("d/MM/yyyy");
            string investigationID;

            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePageInvestigation = new HomePage(driver);
            homePageInvestigation.HoverCRMRibbonTab();
            homePageInvestigation.ClickInvestigationsRibbonButton();
            homePageInvestigation.HoverInvestigationsRibbonTab();
            homePageInvestigation.ClickInvestigationsCasesRibbonButton();

            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            homePageInvestigation.HoverCRMRibbonTab();
            homePageInvestigation.ClickInvestigationsRibbonButton();
            homePageInvestigation.HoverInvestigationsRibbonTab();
            homePageInvestigation.ClickRightScrollRibbonButton();
            homePageInvestigation.ClickAllegedOffencesButton();

            AllegendOffensesSearchPage allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);

            allegedOffencesSearchPage.ClickNewAllegedOffenceButton();

            AllegedOffencePage allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetInvestigationCaseValue(investigationID);
            allegedOffencesPage.SetProvisionValue("RTRA 116(1)");
            allegedOffencesPage.SetOffenceDateValue("1/01/2015");
            allegedOffencesPage.SetBeliefFormedDateValue(todayDate);
            allegedOffencesPage.ClickSaveButton();
            allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(investigationID);
            Table table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectTableRow("Status Reason", "Belief");

            allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetOffenceDateValue("");
            StringAssert.Contains(allegedOffencesPage.GetOffenceDateValue(),"--");
            allegedOffencesPage.SetBeliefFormedDateValue("");
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");

            allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(allegedoffenceId);
            table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectContainsTableRow("Investigation Case", investigationID);

            allegedOffencesPage = new AllegedOffencePage(driver);
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");
            StringAssert.Contains(allegedOffencesPage.GetOffenceDateValue(), "--");
            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), "--");

            allegedOffencesPage.SetOffenceDateValue("01/01/2015");
            allegedOffencesPage.ClickSaveButton();

            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), "1/01/2016");

            StringAssert.Contains(allegedOffencesPage.GetBefliefFormedDateValue(),"");
        }
        public void ATC3308_CRMInvestigationRecordPhoneCallActivityOnInvestigationsCase()
        {
            //Login in as role
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            String HomeWindow = driver.CurrentWindowHandle;
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();
            Thread.Sleep(1000);
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Phone Call");
            Thread.Sleep(2000);

            //Add new Phone Call
            String subject = "New Phone Call";
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            PhoneCallPage phoneCall = new PhoneCallPage(driver);
            Thread.Sleep(100);
            phoneCall.ClickPageTitle();
            phoneCall.SetSelectSubjectValue("Bond balance enquiry");
            phoneCall.SetSubject(subject);
            phoneCall.SetRecipient("BLAIR TEST");
            phoneCall.ClickSaveButton();
            phoneCall.ClickMarkCompleteButton();

            //Verify Phone Call details
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            Table table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            Thread.Sleep(1000);
            Assert.AreEqual(subject,table.GetCellValue("Activity Type","Phone Call","Subject"));
            Assert.AreEqual("Completed", table.GetCellValue("Subject", subject, "Activity Status"));

            //Re-open Phone Call
            table.SelectTableRow("Activity Type", "Phone Call");
            phoneCall = new PhoneCallPage(driver);
            phoneCall.ClickStartDialogButton();
            table = new Table(phoneCall.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "Re-open Phone Call Activity", "Created On");
            phoneCall.ClickDialogAddButton();
            Thread.Sleep(1000);

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Re-open Phone call Activity");

            ReOpenCall reOpenPhoneCall = new ReOpenCall(driver);
            reOpenPhoneCall.ClickNextButton();
            reOpenPhoneCall.ClickFinishButton();

            driver = driver.SwitchTo().Window(HomeWindow);
            driver.Navigate().Back();

            //Verify Reopned Phone call
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            Thread.Sleep(1000);
            Assert.AreEqual("Open", table.GetCellValue("Subject", subject, "Activity Status"));

            table.SelectTableRow("Activity Type", "Phone Call");

            //Amend Phone call
            phoneCall = new PhoneCallPage(driver);
            String newSubject = "Amend Phone Call";
            phoneCall.SetSubject(newSubject);
            phoneCall.ClickSaveCloseButton();

            //Verify Amended Phone call details
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            Thread.Sleep(1000);
            Assert.AreEqual(newSubject, table.GetCellValue("Activity Type", "Phone Call", "Subject"));
            table.SelectTableRow("Activity Type", "Phone Call");

            //Cancel Phone Call
            phoneCall = new PhoneCallPage(driver);
            phoneCall.ClickPageTitle();
            phoneCall.ClickClosePhoneCallButton();
            phoneCall.ConfirmDeactivation("Canceled");
            phoneCall.ClickConfirmDeactivationCloseButton();
            driver = driver.SwitchTo().Window(HomeWindow);
            driver.Navigate().Back();

            //Verify Canceled phone call details
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            Assert.AreEqual("Canceled", table.GetCellValue("Subject", newSubject, "Activity Status"));
        }
        public void ATC3306_CRMInvestigationCaseReopenclosedcase()
        {
            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            //investigationCaseSearchPage.ClickNewInvestigationCaseButton();
            investigationCaseSearchPage.SetPageFilterList("All Investigation Cases");
            Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.SelectTableRow("Investigation Status", "Closed");

             InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);
        }
        public void ATC3340_CRMInvestigationAllegedOffenseStatusChangesToBelief()
        {
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            string HomeWindow = driver.CurrentWindowHandle;
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.ClickNewInvestigationCaseButton();

            // Create new case and validate Status and Substatus fields
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(HomeWindow);
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickRightScrollRibbonButton();
            homePage.ClickAllegedOffencesButton();

            AllegendOffensesSearchPage allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);

            allegedOffencesSearchPage.ClickNewAllegedOffenceButton();

            AllegedOffencePage allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetInvestigationCaseValue(investigationID);
            allegedOffencesPage.SetProvisionValue("RTRA 116(1)");
            allegedOffencesPage.ClickSaveButton();
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");

            string OffenceDate = DateTime.Now.AddYears(-1).ToString("d/MM/yyyy");
            allegedOffencesPage.SetOffenceDateValue(OffenceDate);
            string todaysDate = DateTime.Now.ToString("d/MM/yyyy");
            allegedOffencesPage.SetBeliefFormedDateValue(todaysDate);
            allegedOffencesPage.ClickSaveButton();

            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Belief");
            string StatutoryDate = allegedOffencesPage.GetStatutoryLimitationValue();
            string allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(investigationID);
            Table table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectTableRow("Status Reason", "Belief");

            allegedOffencesPage = new AllegedOffencePage(driver);
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Belief");
            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), StatutoryDate);
            StringAssert.Contains(allegedOffencesPage.GetBefliefFormedDateValue(), todaysDate);
        }