public void DeleteBudget()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC06_DeleteBudget");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC006_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName = testdataBudget[3];
                string strOrgGroup   = testdataBudget[5];

                Console.WriteLine(strBudgetName);
                Console.WriteLine(strOrgGroup);

                budgetAdministrationPage.DeleteBudget(strOrgGroup, strBudgetName);

                string[] strBudgetDetails = budgetAdministrationPage.RetrieveBudgetDetails(strBudgetName);

                try
                {
                    Console.WriteLine("Budget name retrieved is: " + strBudgetDetails);
                    Assert.AreNotEqual(strBudgetDetails, strBudgetName);
                    PropertiesCollection.test.Log(Status.Pass, "DELETE BUDGET => Budget Deletion is successful");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "DELETE BUDGET => Budget Deletion is not successful");
                }
            }
            public void ViewBudget()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC02_ViewBudget");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC002_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName = testdataBudget[3];
                string strOrgGroup   = testdataBudget[5];

                try
                {
                    budgetAdministrationPage.ViewBudget(strOrgGroup, strBudgetName);
                    PropertiesCollection.test.Log(Status.Pass, "VIEW BUDGET => BUDGET: " + strBudgetName + " is successful");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Pass, "VIEW BUDGET => BUDGET: " + strBudgetName + " is unsuccessful");
                }
            }
            public void EditBudget()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC03_EditBudget");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC003_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";
                Int64  intDBAllocation = 0;
                string strDBBudgetDesc = "";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName  = testdataBudget[3];
                string strDescription = testdataBudget[4];
                string strOrgGroup    = testdataBudget[5];
                string strAllocation  = testdataBudget[13];

                budgetAdministrationPage.EditBudget(strOrgGroup, strBudgetName, strDescription, strAllocation);

                connectionString = "Data Source=" + ConfigurationManager.AppSettings["SQLServerDataSource"] + ";Initial Catalog=" + ConfigurationManager.AppSettings["SQLServerInitialCatalog"] + ";Integrated Security=" + ConfigurationManager.AppSettings["SQLServerIntegratedSecurity"] + ';';
                sqlCon           = new SqlConnection(connectionString);
                sqlCon.Open();

                string        query   = "select Description,Allocation From tblBudget where BudgetName = '" + strBudgetName + "'";
                SqlCommand    command = new SqlCommand(query, sqlCon);
                SqlDataReader reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    strDBBudgetDesc = reader.GetString(0);
                    intDBAllocation = reader.GetInt64(1);
                }

                reader.Close();

                try
                {
                    Assert.AreEqual(strDBBudgetDesc, strDescription);
                    PropertiesCollection.test.Log(Status.Pass, "EDIT BUDGET => BUDGET: " + strBudgetName + " description edit is successful");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "EDIT BUDGET => BUDGET: " + strBudgetName + " description edit is not successful");
                }
                try
                {
                    intDBAllocation = intDBAllocation / 60;
                    int allocation = Int32.Parse(strAllocation);
                    Assert.AreEqual(intDBAllocation, allocation);
                    PropertiesCollection.test.Log(Status.Pass, "EDIT BUDGET => BUDGET: " + strBudgetName + " allocation edit is successful");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "EDIT BUDGET => BUDGET: " + strBudgetName + " allocation edit is not successful");
                }
            }
            public void AddBudget()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC01_AddBudget");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC001_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName  = testdataBudget[3];
                string strDescription = testdataBudget[4];
                string strOrgGroup    = testdataBudget[5];
                string strPerson      = testdataBudget[6];
                string strPane        = testdataBudget[7];
                string strSubGroup    = testdataBudget[8];
                string strAssetType   = testdataBudget[9];
                string strStripType   = testdataBudget[10];
                string strDateFrom    = testdataBudget[11];
                string strDateTo      = testdataBudget[12];
                string strAllocation  = testdataBudget[13];

                budgetAdministrationPage.AddBudget(strBudgetName, strDescription, strOrgGroup, strPerson, strPane, strSubGroup, strAssetType, strStripType, strDateFrom, strDateTo, strAllocation);

                string[] budgetDetails = budgetAdministrationPage.RetrieveBudgetDetails(strBudgetName);

                try
                {
                    Assert.AreEqual(strBudgetName, budgetDetails[0]);
                    PropertiesCollection.test.Log(Status.Pass, "ADD BUDGET => BUDGET: " + strBudgetName + " created and validated");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "ADD BUDGET => BUDGET: " + strBudgetName + " created has failed");
                }
            }
            public void TS01_TC02_ValidateFlightProAdminMenus()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS01_TC02_ValidateFlightProAdminMenus");

                /* Validate Strip Sub Groups Page */

                FpAdminMenus AdminMenu = new FpAdminMenus();

                AdminMenu.AdminClick();
                AdminMenu.StripSubGroupsClick();
                System.Threading.Thread.Sleep(30000);
                FpStripSubGroupsPage StripSubGroups = new FpStripSubGroupsPage();

                try
                {
                    Assert.IsTrue(StripSubGroups.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Strip Sub Groups Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Strip Sub Groups Page not loaded");
                    throw;
                }

                /* Validate Catalogue Administration Page */

                AdminMenu.AdminClick();
                AdminMenu.CatalogueAdministrationClick();
                System.Threading.Thread.Sleep(30000);
                FpCatalogueAdministrationPage CatalogueAdministration = new FpCatalogueAdministrationPage();

                try
                {
                    Assert.IsTrue(CatalogueAdministration.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Catalogue Administration Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Catalogue Administration Page not loaded");
                    throw;
                }

                /* Validate Organisation Group Settings Page */

                AdminMenu.AdminClick();
                AdminMenu.OrganisationGroupSettingsClick();
                System.Threading.Thread.Sleep(30000);
                FpOrganisationGroupSettingsPage OrganisationGroupSettings = new FpOrganisationGroupSettingsPage();

                try
                {
                    Assert.IsTrue(OrganisationGroupSettings.IsTitleDisplayed());
                    PropertiesCollection.test.Log(Status.Pass, "Organisation Group Settings Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Organisation Group Settings Page not loaded");
                    throw;
                }

                /* Validate Budget Administration Page */

                AdminMenu.AdminClick();
                AdminMenu.BudgetAdministrationClick();
                System.Threading.Thread.Sleep(30000);
                FpBudgetAdministrationPage BudgetAdministration = new FpBudgetAdministrationPage();

                try
                {
                    Assert.IsTrue(BudgetAdministration.title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Budget Administration Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Budget Administration Page not loaded");
                    throw;
                }

                /* Validate Asset Type Settings Page */

                AdminMenu.AdminClick();
                AdminMenu.AssetTypeSettingsClick();
                System.Threading.Thread.Sleep(30000);
                FpAssetTypeSettingsPage AssetTypeSettings = new FpAssetTypeSettingsPage();

                try
                {
                    Assert.IsTrue(AssetTypeSettings.title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Asset Type Settings Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Asset Type Settings Page not loaded");
                    throw;
                }

                /* Validate Asset Type Systems Page */

                System.Threading.Thread.Sleep(30000);
                AdminMenu.AdminClick();
                AdminMenu.AssetTypeSystemsClick();
                System.Threading.Thread.Sleep(30000);
                FpAssetTypeSystemsPage AssetTypeSystems = new FpAssetTypeSystemsPage();

                try
                {
                    Assert.IsTrue(AssetTypeSystems.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Asset Type Systems Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Asset Type Systems Page not loaded");
                    throw;
                }

                /* Validate Roster Administration Page */


                AdminMenu.AdminClick();
                AdminMenu.RosterAdministrationClick();
                System.Threading.Thread.Sleep(30000);
                FpRosterAdministrationPage RosterAdministration = new FpRosterAdministrationPage();

                try
                {
                    Assert.IsTrue(RosterAdministration.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Roster Administration Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Roster Administration Page not loaded");
                    throw;
                }

                /* Validate Shift Administration Page */

                AdminMenu.AdminClick();
                AdminMenu.ShiftAdministrationClick();
                System.Threading.Thread.Sleep(30000);
                FpShiftAdministrationPage ShiftAdministration = new FpShiftAdministrationPage();

                try
                {
                    Assert.IsTrue(ShiftAdministration.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Shift Administration Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Shift Administration Page not loaded");
                    throw;
                }

                /* Validate Templates Page */

                AdminMenu.AdminClick();
                AdminMenu.TemplatesClick();
                System.Threading.Thread.Sleep(30000);
                FpTemplatesPage Templates = new FpTemplatesPage();

                try
                {
                    Assert.IsTrue(Templates.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Templates Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Templates Page not loaded");
                    throw;
                }

                /* Validate Syllabi Page */

                AdminMenu.AdminClick();
                AdminMenu.SyllabiClick();
                System.Threading.Thread.Sleep(30000);
                FpSyllabiPage Syllabi = new FpSyllabiPage();

                try
                {
                    Assert.IsTrue(Syllabi.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Syllabi Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Syllabi Page not loaded");
                    throw;
                }

                /* Validate Courses Page */

                AdminMenu.AdminClick();
                AdminMenu.CoursesClick();
                System.Threading.Thread.Sleep(30000);
                FpCoursesPage Courses = new FpCoursesPage();

                try
                {
                    Assert.IsTrue(Courses.Title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Courses Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Courses Page not loaded");
                    throw;
                }
            }
            public void ReturnWithOutSave()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC05_ReturnWithOutSave");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC005_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName = testdataBudget[3];
                string strOrgGroup   = testdataBudget[5];

                budgetAdministrationPage.NavigateToBudgetAdminPage();

                budgetAdministrationPage.cboOrgGroupSelector.Click();

                Thread.Sleep(5000);

                for (int i = 0; i < budgetAdministrationPage.cboOrgGroupName.Count; i++)
                {
                    if (budgetAdministrationPage.cboOrgGroupName.ElementAt(i).Text.Equals(strOrgGroup))
                    {
                        budgetAdministrationPage.cboOrgGroupName.ElementAt(i).Click();
                        break;
                    }
                }

                Thread.Sleep(4000);

                for (int i = 0; i < budgetAdministrationPage.lblBudgetName.Count; i++)
                {
                    if (budgetAdministrationPage.lblBudgetName.ElementAt(i).Text.Equals(strBudgetName))
                    {
                        budgetAdministrationPage.lstEditBudget.ElementAt(i).Click();
                        break;
                    }
                }

                Thread.Sleep(4000);

                budgetAdministrationPage.txtBudgetName.Clear();
                Thread.Sleep(2000);

                string mainWindow = PropertiesCollection.driver.CurrentWindowHandle;

                budgetAdministrationPage.btnReturn.Click();

                string childWindow = PropertiesCollection.driver.CurrentWindowHandle;

                PropertiesCollection.driver.SwitchTo().Window(childWindow);

                Thread.Sleep(5000);

                String errorText = budgetAdministrationPage.txtConfirmationMessage.Text;

                try
                {
                    String ExpectedErrorMessage = "Any unsaved changes will be lost. Are you sure?";
                    Assert.AreEqual(ExpectedErrorMessage, errorText);
                    PropertiesCollection.test.Log(Status.Pass, "RETURN WITHOUT SAVE => Validation for message received when navigating to a different window without save has passed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "RETURN WITHOUT SAVE => Validation for message received when navigating to a different window without save has not passed");
                }
                budgetAdministrationPage.btnCancel.Click();

                Thread.Sleep(2000);
                PropertiesCollection.driver.SwitchTo().Window(mainWindow);

                budgetAdministrationPage.txtBudgetName.SendKeys(strBudgetName);
                Thread.Sleep(2000);
                budgetAdministrationPage.btnSave.Click();
                Thread.Sleep(3000);
            }
            public void VerifyErrorMessages()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC04_VerifyErrorMessage");
                FpBudgetAdministrationPage budgetAdministrationPage = new FpBudgetAdministrationPage();

                strTestCaseNo = "TC004_Reg";
                strtblname    = "automation_budgetadministration";
                strTestType   = "Regression";

                var connection     = new ConnectToMySQL_Fetch_TestData();
                var testdataBudget = connection.Select(strtblname, strTestCaseNo, strTestType);

                string strBudgetName = testdataBudget[3];
                string strOrgGroup   = testdataBudget[5];
                string strAllocation = testdataBudget[13];

                budgetAdministrationPage.NavigateToBudgetAdminPage();

                budgetAdministrationPage.cboOrgGroupSelector.Click();

                Thread.Sleep(5000);

                for (int i = 0; i < budgetAdministrationPage.cboOrgGroupName.Count; i++)
                {
                    if (budgetAdministrationPage.cboOrgGroupName.ElementAt(i).Text.Equals(strOrgGroup))
                    {
                        budgetAdministrationPage.cboOrgGroupName.ElementAt(i).Click();
                        break;
                    }
                }

                Thread.Sleep(4000);

                for (int i = 0; i < budgetAdministrationPage.lblBudgetName.Count; i++)
                {
                    if (budgetAdministrationPage.lblBudgetName.ElementAt(i).Text.Equals(strBudgetName))
                    {
                        budgetAdministrationPage.lstEditBudget.ElementAt(i).Click();
                        break;
                    }
                }

                Thread.Sleep(4000);

                budgetAdministrationPage.txtBudgetName.Clear();
                Thread.Sleep(2000);

                try
                {
                    Assert.AreEqual(budgetAdministrationPage.txtBudgetName_ErrorMsg.Text, "Budget Name is required");
                    PropertiesCollection.test.Log(Status.Pass, "VERIFY ERROR MESSAGE ON EDIT BUDGET SCREEN => Error message validation when budget name is null is successful ");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "VERIFY ERROR MESSAGE ON EDIT BUDGET SCREEN => Error message validation when budget name is null is not successful ");
                }

                budgetAdministrationPage.txtBudgetName.SendKeys(strBudgetName);
                Thread.Sleep(3000);

                budgetAdministrationPage.txtAllocation.Clear();
                Thread.Sleep(3000);

                try
                {
                    Assert.AreEqual(budgetAdministrationPage.txtAllocation_ErrorMsg.Text, "A valid Allocation is required.");
                    PropertiesCollection.test.Log(Status.Pass, "VERIFY ERROR MESSAGE ON EDIT BUDGET SCREEN => Error message validation when Allocation has null value is successful ");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "VERIFY ERROR MESSAGE ON EDIT BUDGET SCREEN => Error message validation when Allocation has null value is not successful ");
                }

                budgetAdministrationPage.txtAllocation.SendKeys(strAllocation);
                Thread.Sleep(2000);

                budgetAdministrationPage.btnSave.Click();
                Thread.Sleep(3000);
            }