Beispiel #1
0
 public static List <float> GetDBData_List_Float(string query, params string[] columns)
 {
     try
     {
         List <float> Output = new List <float>();
         Command = new SqlCommand(query, Connection);
         Connection.Open();
         Reader = Command.ExecuteReader();
         var List = new ArrayList(columns);
         while (Reader.Read())
         {
             foreach (string column in List)
             {
                 Output.Add(float.Parse(Reader[column].ToString()));
                 if (List.IndexOf(column) == List.Count - 1)
                 {
                     break;
                 }
             }
         }
         Connection.Close();
         return(Output);
     }
     catch (Exception e)
     {
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver);
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
         Selenium.Log.Log(LogStatus.Fail, "Unable to run query " + e);
         throw (e);
     }
 }
Beispiel #2
0
 //validating error message 'Effective Date is required required'
 public void TS002_Ready_For_Completion()
 {
     try
     {
         Name         = MethodBase.GetCurrentMethod().Name;
         Selenium.Log = Selenium.Extent.StartTest(Name);
         Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
         GetInstance <LoginPage>().Login(ExcelReader.GetTestData_Integration(Name, DataConstants.LOGINID),
                                         ExcelReader.GetTestData_Integration(Name, DataConstants.PASSWORD));
         GetInstance <LandingPage>().Tasks("128");
         Thread.Sleep(3000);
         GetInstance <DashBoard_Overview_Page>().ActionsItems_ReadyForCompletion_ClickLnk();
         string Input_Date = DateTime.Now.ToString("MM/dd/yyyy");
         GetInstance <ActionItems_ReadyForCompletion_Page>().MinutesDate_Input(DateTime.Now.ToString("MM/dd/yyyy"));
         GetInstance <ActionItems_ReadyForCompletion_Page>().Submit_Btn();
         ExtentReportLog(GetInstance <ActionItems_ReadyForCompletion_Page>().Table_ErrorMessage_txt(1),
                         "Effective date is required to update the status",
                         "Validating error Message",
                         Name);
         ExtentReportLog(GetInstance <ActionItems_ReadyForCompletion_Page>().ApprenticeCompletionMessage_Txt(),
                         "Error updating probation, please check your information and try again!",
                         "Validating error Message",
                         Name);
     }
     catch (Exception e)
     {
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
         Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
         throw (e);
     }
 }
Beispiel #3
0
 public void ExtentReportLog(Dictionary <string, string> actual, Dictionary <string, string> expected, string message, string TestCaseName)
 {
     if (actual.Count == expected.Count) // Require equal count.
     {
         foreach (var pair in actual)
         {
             string value;
             if (expected.TryGetValue(pair.Key, out value))
             {
                 // Require value be equal.
                 if (value != pair.Value)
                 {
                     Selenium.Log.Log(LogStatus.Fail, " <b style=" + "color:hsl(0,60%,50%)>" + message + "  : " + actual + " != " + expected + "</b> ");
                     string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, TestCaseName);
                     Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                 }
             }
             else
             {
                 Selenium.Log.Log(LogStatus.Fail, " <b style=" + "color:hsl(0,60%,50%)>" + message + "  : " + actual + " != " + expected + "</b> ");
                 string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, TestCaseName);
                 Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
             }
         }
     }
     Selenium.Log.Log(LogStatus.Pass, " <b style=" + "color:hsl(147,50%,47%);>" + message + " : " + actual + " == " + expected + "</b> ");
 }
        public void TCOOO_Verify_Apprentice_Transfer()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_Transfer_Lnk();

                string App_ID           = "204890";
                string Transfer_Program = "Washington State UBC JATC";
                string Effective_Date   = "01/06/2020";

                GetInstance <TransferApprentice_Page_1_Internal>().ApprenticeID_Input(App_ID);
                GetInstance <TransferApprentice_Page_1_Internal>().FindApprentice_Btn();
                GetInstance <TransferApprentice_Page_2_Internal>().TransferDate_Input(Effective_Date);
                GetInstance <TransferApprentice_Page_2_Internal>().ProgramName_Input(Transfer_Program);
                GetInstance <TransferApprentice_Page_2_Internal>().OccupationDrpDwn_Select("2");
                string Transfer_Occupation = Selenium.Driver.GetText(GetInstance <TransferApprentice_Page_2_Internal>().OccupationDrpDwnBtn, "OccupationDrpDwnBtn");
                GetInstance <TransferApprentice_Page_2_Internal>().EmployerNameDrpDwn_Select("0");
                GetInstance <TransferApprentice_Page_2_Internal>().CreditPrevExperience_Input("250");
                GetInstance <TransferApprentice_Page_2_Internal>().CreditPrevRSIExperience_Input("50");
                GetInstance <TransferApprentice_Page_2_Internal>().StepDrpDwn_Select("0");
                GetInstance <TransferApprentice_Page_2_Internal>().Transfer_Btn();
                ExtentReportLog(GetInstance <TransferApprentice_Page_2_Internal>().ErrorMessage_Txt(),
                                "Transfer successful",
                                "Verify Transfer Status",
                                Name
                                );
                if (GetInstance <TransferApprentice_Page_2_Internal>().ErrorMessage_Txt() == "Transfer successful")
                {
                    GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();
                    GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(App_ID);
                    GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
                    ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableTxt(0),
                                    App_ID,
                                    "Verify Search App Id",
                                    Name
                                    );
                    ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().OccupationName_TableTxt(0),
                                    Transfer_Occupation,
                                    "Verify Occupation",
                                    Name
                                    );
                    ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().RegistrationDate_TableTxt(0),
                                    Effective_Date,
                                    "Verify Transfer Date",
                                    Name
                                    );
                }
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
 public static string GetAppRegInfo(string testcase, AppRegInfoConstants Constants)
 {
     try
     {
         int    column = (int)Constants;
         string Value  = "";
         int    count  = ExcelSheet.Dimension.End.Row;
         for (int index = 1; index <= count; index++)
         {
             if (ExcelSheet.GetValue(index, 1).ToString().Equals(testcase))
             {
                 Value = ExcelSheet.GetValue(index, column).ToString();
                 break;
             }
         }
         return(Value);
     }
     catch (Exception e)
     {
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, "ExcelReaderError" + DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
         Selenium.Log.Log(LogStatus.Fail, "Excel reader error || " + e);
         throw (e);
     }
 }
Beispiel #6
0
        public static List <string> GetDBData_List_String(string query)
        {
            try
            {
                List <string> res = new List <string>();
                Connection.Open();
                using (SqlDataAdapter adapter = new SqlDataAdapter(query, Connection))
                {
                    DataSet result = new DataSet();
                    adapter.Fill(result);

                    foreach (DataTable table in result.Tables)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            foreach (DataColumn column in table.Columns)
                            {
                                for (int i = 0; i < table.Columns.Count; i++)
                                {
                                    res.Add(row[column].ToString());
                                }
                            }
                        }
                    }
                }
                return(res);
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver);
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Unable to run query " + e);
                throw (e);
            }
        }
Beispiel #7
0
 public void ExtentReportLog(int actual, int expected, string message, string TestCaseName)
 {
     if (actual.Equals(expected))
     {
         Selenium.Log.Log(LogStatus.Pass, " <b style=" + "color:hsl(147,50%,47%);>" + message + " : " + actual + " == " + expected + "</b> ");
     }
     else
     {
         Selenium.Log.Log(LogStatus.Fail, " <b style=" + "color:hsl(0,60%,50%)>" + message + "  : " + actual + " != " + expected + "</b> ");
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, TestCaseName);
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
     }
 }
Beispiel #8
0
 public void ExtentReportLog(int actual, int expected, string message, string TestCaseName)
 {
     if (actual.Equals(expected))
     {
         Selenium.Log.Log(LogStatus.Pass, message + " : " + actual + " == " + expected);
     }
     else
     {
         Selenium.Log.Log(LogStatus.Fail, message + "  : " + actual + " != " + expected);
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, TestCaseName);
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
     }
 }
 public void TC003_Verify_Apprentice_Registration()
 {
     try
     {
         Name         = MethodBase.GetCurrentMethod().Name;
         Selenium.Log = Selenium.Extent.StartTest(Name);
         Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
         ExcelReader.SetSheet(ConfigurationManager.AppSettings.Get("TestApprenticeRegInfoSheet"));
         GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
         GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppReg_Lnk();
         GetInstance <AppReg_EnterSSN_Page_Internal>().ProgramId_InputNum("152");
         GetInstance <AppReg_EnterSSN_Page_Internal>().EnterSSN_InputNum(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.SSN));
         GetInstance <AppReg_EnterSSN_Page_Internal>().FindApprentice_ClickBtn();
         GetInstance <AppReg_Form_Page_Internal>().FirstName_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.FIRSTNAME));
         GetInstance <AppReg_Form_Page_Internal>().LastName_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.LASTNAME));
         GetInstance <AppReg_Form_Page_Internal>().AddressLine1_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.ADDRESS1));
         GetInstance <AppReg_Form_Page_Internal>().City_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.CITY));
         GetInstance <AppReg_Form_Page_Internal>().ZipCode_Input(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.ZIPCODE));
         GetInstance <AppReg_Form_Page_Internal>().State_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.STATE));
         GetInstance <AppReg_Form_Page_Internal>().Phone_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.APPLICANTPHONE));
         GetInstance <AppReg_Form_Page_Internal>().Gender_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.GENDER));
         GetInstance <AppReg_Form_Page_Internal>().MilitaryStatus_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.MILITARY));
         GetInstance <AppReg_Form_Page_Internal>().Race_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.RACEETHNICITY));
         GetInstance <AppReg_Form_Page_Internal>().EducationLevel_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.EDUCATION));
         GetInstance <AppReg_Form_Page_Internal>().Occupation_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.APPRENTICEOCCUPATION));
         GetInstance <AppReg_Form_Page_Internal>().Step_DrpDwn("1");
         GetInstance <AppReg_Form_Page_Internal>().DirectEntry_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.DIRECTENTERY));
         GetInstance <AppReg_Form_Page_Internal>().DOB_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.DOB));
         GetInstance <AppReg_Form_Page_Internal>().BeginDate_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.BEGINDATE));
         GetInstance <AppReg_Form_Page_Internal>().Register_Btn();
         int AppID = GetInstance <AppReg_Form_Page_Internal>().AppRegID_NumTxt();
         GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();
         GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(AppID.ToString());
         GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
         ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableTxt(0),
                         AppID.ToString(), "Verify App ID", Name);
         ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().FirstName_TableTxt(0),
                         ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.FIRSTNAME), "Verify First Name", Name);
         // ExtentReportLog(GetInstance<SearchApprentice_Page_Internal>().ProgramName_TableTxt(0),
         // ProgramName, "Verify Program Name", Name);
     }
     catch (Exception e)
     {
         string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
         Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
         Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
         throw (e);
     }
 }
Beispiel #10
0
        public void ExtentReportLog(List <string> actual, List <string> expected, string message, string TestCaseName)
        {
            bool x = actual.Any(z => expected.Contains(z));

            if (x == true)
            {
                Selenium.Log.Log(LogStatus.Pass, " <b style=" + "color:hsl(147,50%,47%);>" + message + " : " + actual + " == " + expected + "</b> ");
            }
            else
            {
                Selenium.Log.Log(LogStatus.Fail, " <b style=" + "color:hsl(0,60%,50%)>" + message + "  : " + actual + " != " + expected + "</b> ");
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, TestCaseName);
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
            }
        }
Beispiel #11
0
        //validating Total Hours required for completion
        //Message: "To complete the program apprentice needs xxxx hours, this apprentice has total of xxxx.xx hours."
        public void TS003_Ready_For_Completion()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                GetInstance <LoginPage>().Login(ExcelReader.GetTestData_Integration(Name, DataConstants.LOGINID),
                                                ExcelReader.GetTestData_Integration(Name, DataConstants.PASSWORD));
                GetInstance <LandingPage>().Tasks("128");
                Thread.Sleep(3000);
                GetInstance <DashBoard_Overview_Page>().ActionsItems_ReadyForCompletion_ClickLnk();
                string Input_Date = DateTime.Now.ToString("MM/dd/yyyy");
                GetInstance <ActionItems_ReadyForCompletion_Page>().EffectiveDate_Input(DateTime.Now.ToString("MM/dd/yyyy"));
                GetInstance <ActionItems_ReadyForCompletion_Page>().MinutesDate_Input(DateTime.Now.ToString("MM/dd/yyyy"));
                GetInstance <ActionItems_ReadyForCompletion_Page>().Submit_Btn();

                for (int i = 0; i < GetInstance <ActionItems_ReadyForCompletion_Page>().Table_ErrorMessageTxt.Count; i++)
                {
                    if (GetInstance <ActionItems_ReadyForCompletion_Page>().Table_ErrorMessage_txt(i) != "none")
                    {
                        string apprenticeID    = GetInstance <ActionItems_ReadyForCompletion_Page>().Table_ApprenticeID_Txt(i);
                        string list1           = "SELECT SUM(b.hrs_qty) AS 'OJTHour' FROM [aprnt].[apprentice_pgm_occpn] a INNER JOIN [aprnt].[apprentice_pgm_occpn_hour] b ON a.rid=b.apprentice_pgm_occpn_rid WHERE a.apprentice_rid = " + apprenticeID + "AND b.work_hour_type_code ='OJT'";
                        string CurrentAppHours = DBConnection.GetDBData(list1, "OJTHour");
                        string list2           = "SELECT term_qty FROM[aprnt].[apprentice_pgm_occpn] WHERE apprentice_rid = " + apprenticeID;
                        string ReqTermHours    = DBConnection.GetDBData(list2, "term_qty");
                        string ExpectedText    = "To complete the program apprentice needs " + ReqTermHours + " hours, this apprentice has total of " + CurrentAppHours + " hours.";
                        ExtentReportLog(GetInstance <ActionItems_ReadyForCompletion_Page>().Table_ErrorMessage_txt(i),
                                        ExpectedText,
                                        "Valodating message for " + apprenticeID + ": ",
                                        Name);
                    }
                }

                ExtentReportLog(GetInstance <ActionItems_ReadyForCompletion_Page>().ApprenticeCompletionMessage_Txt(),
                                "Error updating probation, please check your information and try again!",
                                "Validating error Message",
                                Name);
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TS001_Apprentice_Registration()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);

                GetInstance <LoginPage>().Login(ExcelReader.GetTestData_Integration(Name, DataConstants.LOGINID),
                                                ExcelReader.GetTestData_Integration(Name, DataConstants.PASSWORD));
                GetInstance <LandingPage>().Tasks("128");
                GetInstance <DashBoard_Overview_Page>().QuickLnks_RegisterAnApprenticeLnk_ClickLnk();
                GetInstance <AppReg_EnterSSN_Page>().EnterSSN("125252489");
                GetInstance <AppReg_EnterSSN_Page>().ClickVerify();
                GetInstance <AppReg_Form_Page>().RegisterApp_Btn();
                //GetInstance<AppReg_Form_Page>().AppFormErrorMsgList_Lnk(0);
                string[] Element_Ids = { "firstName",                        "lastName",                        "primaryAddress_address1", "primaryAddress_city",
                                         "primaryAddress_zipCode",           "apprenticeGenderForRegistration", "birthDate",               "raceOrEthnicity",
                                         "ethnicGroup",                      "highestEducationLevel",           "militaryStatus",          "apprenticeshipOccupation",
                                         "applicantQualifiedForDirectEntry", "confirmAgreement" };
                for (int i = 0; i < Element_Ids.Length; i++)
                {
                    GetInstance <AppReg_Form_Page>().AppFormErrorMsgList_Lnk(i);
                    IWebElement activeElement = Selenium.ObjDriver.SwitchTo().ActiveElement();
                    String      id            = activeElement.GetAttribute("id");
                    if (id == "")
                    {
                        continue;
                    }
                    else
                    {
                        ExtentReportLog(id, Element_Ids[i], "Verifing Error Links", Name);
                    }
                }
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TS000_Apprentice_Registration()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);

                GetInstance <LoginPage>().Login(ExcelReader.GetTestData_Integration(Name, DataConstants.LOGINID),
                                                ExcelReader.GetTestData_Integration(Name, DataConstants.PASSWORD));
                GetInstance <LandingPage>().Tasks("128");
                GetInstance <DashBoard_Overview_Page>().QuickLnks_RegisterAnApprenticeLnk_ClickLnk();
                GetInstance <AppReg_EnterSSN_Page>().EnterSSN("25254785");
                ExtentReportLog(GetInstance <AppReg_EnterSSN_Page>().ErrorMsg_Gettxt(), "Social Security Number must be 9 digits."
                                , "Verifying error message for length of ssn \n", Name);
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void Verify_Apprentice_Information_Internal_000()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();

                string Apprentice_ID = "87544";   //ID: 87544 (3 Programs) //136362 (2 Programs) //202781 (1 Program) 189595

                GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(Apprentice_ID);
                GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
                GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableLnk(0);
                Thread.Sleep(1000);
                string UI_Name                 = GetInstance <ApprenticeInformation_Page_Internal>().NameList_Txt();
                string UI_Education            = GetInstance <ApprenticeInformation_Page_Internal>().EduicationList_Txt();
                string UI_Email                = GetInstance <ApprenticeInformation_Page_Internal>().EmailAddressList_Txt();
                string UI_PhoneNumber          = GetInstance <ApprenticeInformation_Page_Internal>().PhoneNumberList_Txt();
                string UI_Address1             = GetInstance <ApprenticeInformation_Page_Internal>().AddressLine1List_Txt();
                string UI_Address2CityStateZip = GetInstance <ApprenticeInformation_Page_Internal>().AddressLine2List_Txt();
                string UI_Address              = UI_Address1 + " " + UI_Address2CityStateZip;

                string [] ssn    = (GetInstance <ApprenticeInformation_Page_Internal>().SSNList_Txt()).Split('-');
                string    UI_SSN = ssn[0] + ssn[1] + ssn[2];

                string BirthDate            = GetInstance <ApprenticeInformation_Page_Internal>().BirthDateList_Txt();
                string UI_BirthDate         = DateTime.Parse(BirthDate).ToString();
                string UI_Gender            = GetInstance <ApprenticeInformation_Page_Internal>().GenderList_Txt();
                string UI_MilitaryStatus    = GetInstance <ApprenticeInformation_Page_Internal>().MilitaryStatusList_Txt();
                string UI_Race              = (GetInstance <ApprenticeInformation_Page_Internal>().RaceList_Txt()).Trim();
                string UI_HispanicEthnicity = GetInstance <ApprenticeInformation_Page_Internal>().HispanicEthnicityList_Txt();
                string UI_ApprenticeID      = GetInstance <ApprenticeInformation_Page_Internal>().ApprenticeIDList_Txt();

                //list count starts from 1; 0 is the basic information - number of programs in history is from
                int UI_TotalPrograms = GetInstance <ApprenticeInformation_Page_Internal>().ApprenticeProgramHistoryExpandBtn.Count;

                string DB_ApprenticeID = "Select * FROM [aprnt].[apprentice_pgm_occpn] WHERE apprentice_rid = " + UI_ApprenticeID + " ORDER BY  registration_date DESC, rid DESC;";

                List <string> DB_Apprentice_Occupation_ID = DBConnection.GetDBData_List_String(DB_ApprenticeID, "rid");

                int Programs_Count = DB_Apprentice_Occupation_ID.Count;

                string DB_Apprentice_FirstName  = DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "FirstName");
                string DB_Apprentice_MiddleName = DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "MiddleName");
                string DB_Apprentice_LastName   = DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "LastName");
                string DB_Apprentice_Name       = "";
                if (DB_Apprentice_MiddleName == "" || (DB_Apprentice_MiddleName).ToLower() == "null" || DB_Apprentice_MiddleName == "None")
                {
                    DB_Apprentice_Name = DB_Apprentice_FirstName + " " + DB_Apprentice_LastName;
                }
                else
                {
                    DB_Apprentice_Name = DB_Apprentice_FirstName + " " + DB_Apprentice_MiddleName + " " + DB_Apprentice_LastName;
                }


                string DB_Apprentice_Education = DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "EducationLevel");
                string DB_Apprentice_Email     = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid =  " + DB_Apprentice_Occupation_ID[0], "ApprenticeEmail");

                string DB_Apprentice_Phone = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[0], "ApprenticePhone");
                if (DB_Apprentice_Phone != "")
                {
                    string[] Apprentice_Phone_0 = DB_Apprentice_Phone.Split('-');
                    DB_Apprentice_Phone = "(" + Apprentice_Phone_0[0] + ") " + Apprentice_Phone_0[1] + "-" + Apprentice_Phone_0[2];
                }

                string DB_Apprentice_Address = DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "AddressLine1") + " "
                                               + DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "CityName") + " , "
                                               + DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "StateCode") + " "
                                               + DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[0], "ZipCode");

                string DB_Apprentice_SSN          = DBConnection.GetDBData("SELECT ssn_num FROM [aprnt].[apprentice] a WHERE a.rid = " + UI_ApprenticeID, "ssn_num");
                string DB_Apprentice_DOB          = DBConnection.GetDBData("SELECT birth_date FROM [aprnt].[apprentice] a WHERE a.rid = " + UI_ApprenticeID, "birth_date");
                string DB_Apprentice_Gender       = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[0], "Gender");
                string DB_Apprentice_MilitaryStat = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[0], "VetStatus");
                string DB_Apprentice_Race         = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[0], "Race");

                string DB_Apprentice_HispanicStat = DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[0], "EthnicGroup");
                if (DB_Apprentice_HispanicStat.Equals("Not of Hispanic Origin"))
                {
                    DB_Apprentice_HispanicStat = "No";
                }
                else if (DB_Apprentice_HispanicStat.Equals("Hispanic Origin"))
                {
                    DB_Apprentice_HispanicStat = "Yes";
                }
                else
                {
                    DB_Apprentice_HispanicStat = "";
                }

                //verifing apprentice information
                ExtentReportLog(UI_ApprenticeID, Apprentice_ID, "Verify ID", Name);
                ExtentReportLog(UI_Name, DB_Apprentice_Name, "Verify Name", Name);
                ExtentReportLog(UI_Education, DB_Apprentice_Education, "Verify Education", Name);
                ExtentReportLog(UI_Email, DB_Apprentice_Email, "Verify Email", Name);
                ExtentReportLog(UI_PhoneNumber, DB_Apprentice_Phone, "Verify Phone Number", Name);
                ExtentReportLog(UI_Address, DB_Apprentice_Address, "Verify Address", Name);
                ExtentReportLog(DB_Apprentice_SSN, UI_SSN, "Verify SSN", Name);
                ExtentReportLog(UI_BirthDate, DB_Apprentice_DOB, "Verify Birth Date", Name);
                ExtentReportLog(UI_Gender, DB_Apprentice_Gender, "Verify Gender", Name);
                ExtentReportLog(UI_MilitaryStatus, DB_Apprentice_MilitaryStat, "Verify Military Status", Name);
                ExtentReportLog(UI_Race, DB_Apprentice_Race, "Verify Race", Name);
                ExtentReportLog(DB_Apprentice_HispanicStat, UI_HispanicEthnicity, "Verify Hispanic Ethinicity", Name);

                if (Programs_Count > 1)
                {
                    for (int k = 2; k <= Programs_Count; k++)
                    {
                        Thread.Sleep(1000);
                        GetInstance <ApprenticeInformation_Page_Internal>().ApprenticeProgramHistoryExpand_Btn((k).ToString());
                    }
                }

                int status_count     = 0;
                int step_count       = 0;
                int RSIpaid_count    = 0;
                int RSIunpaid_count  = 0;
                int OJT_count        = 0;
                int additional_count = 0;
                int yrs_RSIpaid      = 0;
                int yrs_RSIunpaid    = 0;
                int yrs_OJT          = 0;

                //Verifying information in programs histories
                for (int j = 0; j < Programs_Count; j++)
                {
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_Name_Txt(j.ToString()),
                                    DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "ProgramId")
                                    + "-"
                                    + DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "ProgramName"),
                                    "Verify Program Name", Name);


                    string subprogram_UI = GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_SubProgrma_Txt(j.ToString());
                    string subprogram_DB = DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "SubProgram");
                    if (subprogram_UI == "" || subprogram_UI == "None" || subprogram_DB == "" || subprogram_DB == "None")
                    {
                        subprogram_UI = "N/A";
                        subprogram_DB = "N/A";
                    }
                    ExtentReportLog(subprogram_UI, subprogram_DB, "Verify Sub Program", Name);

                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_Occupation_Txt(j.ToString()),
                                    DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "OccupationId")
                                    + "-"
                                    + DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "OccupationName"),
                                    "Verify Program Occupation", Name);

                    //ExtentReportLog(GetInstance<ApprenticeInformation_Page_Internal>().ProgramHistory_Employer_Txt(j.ToString()),
                    //DBConnection.GetDBData("---------------------------------------------------"),
                    //"Verify Sub Program", Name);

                    //Verify apprentice status in that program
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_AlltStatus_Txt(j.ToString()),
                                    DBConnection.GetDBData("EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "Status"),
                                    "Verify apprentice status in that program", Name);

                    //Verify apprentice registrtaion date for that program
                    ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_RegistrationDate_Txt(j.ToString())).ToString("MM/dd/yyyy"),
                                    DateTime.Parse(DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "BeginDate")).ToString("MM/dd/yyyy"),
                                    "Verify apprentice registrtaion date for that program", Name);

                    //Verify apprentice probation start date for that program
                    if (GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_ProbationStart_Txt(j.ToString()) != "")
                    {
                        ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_ProbationStart_Txt(j.ToString())).ToString("MM/dd/yyyy"),
                                        DateTime.Parse(DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "ProbationStartDate")).ToString("MM/dd/yyyy"),
                                        "Verify apprentice probation start date for that program", Name);
                    }
                    //Verify apprentice probation end date for that program
                    if (GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_ProbationEnd_Txt(j.ToString()) != "")
                    {
                        ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_ProbationEnd_Txt(j.ToString())).ToString("MM/dd/yyyy"),
                                        DateTime.Parse(DBConnection.GetDBData("EXEC[aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + DB_Apprentice_Occupation_ID[j], "ProbationEndDate")).ToString("MM/dd/yyyy"),
                                        "Verify apprentice probation end date for that program", Name);
                    }

                    //Verify apprentice direct entery flag of that program
                    string UI_DiretEntry = GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_DirectEntry_Txt(j.ToString());
                    if (UI_DiretEntry == "Yes")
                    {
                        UI_DiretEntry = "True";
                    }
                    else if (UI_DiretEntry == "No")
                    {
                        UI_DiretEntry = "False";
                    }
                    ExtentReportLog(UI_DiretEntry,
                                    DBConnection.GetDBData("Select direct_entry_flg AS DirectEntry FROM [aprnt].[apprentice_pgm_occpn] WHERE rid = " + DB_Apprentice_Occupation_ID[j], "DirectEntry"),
                                    "Verify apprentice direct entery flag of that program", Name);

                    //Verify apprentice Credit For Prevous OJT Exp for that program
                    if (GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_CreditOJT_Txt(j.ToString()) != "")
                    {
                        ExtentReportLog((float.Parse(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_CreditOJT_Txt(j.ToString()))).ToString() + ".00",
                                        DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j], "CreditForPreviousExp"),
                                        "Verify apprentice Credit For Prevous OJT Exp for that program", Name);
                    }

                    //Verify apprentice Credit For Prevous RSI Exp for that program
                    if (GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_CreditRSI_Txt(j.ToString()) != "")
                    {
                        ExtentReportLog((float.Parse(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_CreditRSI_Txt(j.ToString()))).ToString() + ".00",
                                        DBConnection.GetDBData("EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j], "CreditForPreviousRSIExp"),
                                        "Verify apprentice Credit For Prevous RSI Exp for that program", Name);
                    }

                    //Verify apprentice final hours for that program
                    if (GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_FinalHours_Txt(j.ToString()) != "")
                    {
                        ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().ProgramHistory_FinalHours_Txt(j.ToString()),
                                        DBConnection.GetDBData("SELECT * FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j] + " AND work_hour_type_code LIKE \"Final_Hours\"", "hrs_qty"),
                                        "Verify apprentice final hours for that program", Name);
                    }

                    //verifying status history and effective dates
                    List <string> DB_StatusList = DBConnection.GetDBData_List_String("SELECT * FROM [aprnt].[apprentice_pgm_occp_status] WHERE apprentice_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j] + " ORDER BY effective_date DESC", "status_code");
                    for (int m = 0; m < DB_StatusList.Count; m++)
                    {
                        if (DB_StatusList[m] == "A")
                        {
                            DB_StatusList[m] = "Active";
                        }
                        else if (DB_StatusList[m] == "C")
                        {
                            DB_StatusList[m] = "Completed";
                        }
                        else if (DB_StatusList[m] == "L")
                        {
                            DB_StatusList[m] = "Cancelled";
                        }
                        else if (DB_StatusList[m] == "S")
                        {
                            DB_StatusList[m] = "Suspended";
                        }
                        else if (DB_StatusList[m] == "T")
                        {
                            DB_StatusList[m] = "Transfered";
                        }
                        else
                        {
                            DB_StatusList[m] = "---UNKOWN---";
                        }
                    }

                    List <string> DB_StatusEffectiveDateList = DBConnection.GetDBData_List_String("SELECT * FROM [aprnt].[apprentice_pgm_occp_status] WHERE apprentice_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j] + " ORDER BY effective_date DESC", "effective_date");
                    if (DB_StatusList.Count != 0)
                    {
                        int l = status_count;
                        for (int temp = 0; temp < DB_StatusEffectiveDateList.Count; temp++)
                        {
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().StatusHistory_Status_Txt(l.ToString()),
                                            DB_StatusList[temp].ToString(),
                                            "Verify apprentice Status History for that program", Name);
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().StatusHistory_EffectiveDate_Txt(l.ToString())).ToString("MM/dd/yyyy"),
                                            DateTime.Parse(DB_StatusEffectiveDateList[temp]).ToString("MM/dd/yyyy"),
                                            "Verify apprentice Status History for that program", Name);
                            l++;
                        }
                    }

                    //verifying steps and effective date
                    List <float>  DB_StepList = DBConnection.GetDBData_List_Float("SELECT step_num FROM [aprnt].[apprentice_pgm_occp_step] WHERE apprentice_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j] + "ORDER BY step_num DESC", "step_num");
                    List <string> DB_StepEffectiveDateList = DBConnection.GetDBData_List_String("SELECT effective_date FROM [aprnt].[apprentice_pgm_occp_step] WHERE apprentice_pgm_occpn_rid = " + DB_Apprentice_Occupation_ID[j] + "ORDER BY step_num DESC", "effective_date");

                    if (DB_StepList.Count != 0)
                    {
                        int l = step_count;
                        for (int temp = 0; temp < DB_StepEffectiveDateList.Count; temp++)
                        {
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().StepHistory_Step_Txt(l.ToString()),
                                            DB_StepList[temp].ToString(),
                                            "Verify apprentice Steps hours for that program", Name);
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().StepHistory_EffectiveDate_Txt(l.ToString())).ToString("MM/dd/yyyy"),
                                            DateTime.Parse(DB_StepEffectiveDateList[temp]).ToString("MM/dd/yyyy"),
                                            "Verify apprentice Steps hours for that program", Name);
                            l++;
                        }
                    }

                    //verifying RSI Paid History Table
                    List <string> DB_RSIPaid_Yrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                      " AND work_hour_type_code LIKE 'RSI_Paid'" +
                                                                                      " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "year_num");
                    List <string> DB_RSIPaid_Qtrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                       " AND work_hour_type_code LIKE 'RSI_paid'" +
                                                                                       " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "quarter_num");
                    List <string> DB_RSIPaid_Date = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                       " AND work_hour_type_code LIKE 'RSI_paid'" +
                                                                                       " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "create_date");
                    List <float> DB_RSIPaid_Hrs = DBConnection.GetDBData_List_Float("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                    " AND work_hour_type_code LIKE 'RSI_Paid'" +
                                                                                    " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "hrs_qty");
                    int p = yrs_RSIpaid;
                    if (DB_RSIPaid_Hrs.Count != 0)
                    {
                        int l = RSIpaid_count;

                        if (GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Years_Txt(l.ToString()) == "No records found.")
                        {
                            p = RSIpaid_count + 1;
                        }

                        for (int temp = 0; temp < DB_RSIPaid_Hrs.Count; temp++)
                        {
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Years_Txt(p.ToString()),
                                            DB_RSIPaid_Yrs[temp].ToString(),
                                            "Verify apprentice RSI Paid Hours History Years for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Quater_Txt(l.ToString()),
                                            DB_RSIPaid_Qtrs[temp].ToString(),
                                            "Verify apprentice RSI Paid Hours History Qarters for that program", Name);
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_CreatedDate_Txt(l.ToString())).ToString("MM/dd/yyyy"),
                                            DateTime.Parse(DB_RSIPaid_Date[temp]).ToString("MM/dd/yyyy"),
                                            "Verify apprentice RSI Paid Hours History Created Date for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Hours_Txt(l.ToString()),
                                            DB_RSIPaid_Hrs[temp].ToString(),
                                            "Verify apprentice RSI Paid Hours History Hours for that program", Name);
                            l++; p++;
                        }
                    }

                    //verifying RSI UnPaid History Table
                    List <string> DB_RSIUnPaid_Yrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                        " AND work_hour_type_code LIKE 'RSI_Unpaid'" +
                                                                                        " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "year_num");
                    List <string> DB_RSIUnPaid_Qtrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                         " AND work_hour_type_code LIKE 'RSI_Unpaid'" +
                                                                                         " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "quarter_num");
                    List <string> DB_RSIUnPaid_Date = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                         " AND work_hour_type_code LIKE 'RSI_Unpaid'" +
                                                                                         " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "create_date");
                    List <float> DB_RSIUnPaid_Hrs = DBConnection.GetDBData_List_Float("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                      " AND work_hour_type_code LIKE 'RSI_Unpaid'" +
                                                                                      " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "hrs_qty");
                    int q = yrs_RSIpaid;
                    if (DB_RSIUnPaid_Hrs.Count != 0)
                    {
                        int l = RSIunpaid_count;
                        if (GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Years_Txt(l.ToString()) == "No records found.")
                        {
                            q = RSIunpaid_count + 1;
                        }

                        for (int temp = 0; temp < DB_RSIUnPaid_Hrs.Count; temp++)
                        {
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_Years_Txt(q.ToString()),
                                            DB_RSIUnPaid_Yrs[temp].ToString(),
                                            "Verify apprentice RSI UnPaid Hours History Years for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_Quater_Txt(l.ToString()),
                                            DB_RSIUnPaid_Qtrs[temp].ToString(),
                                            "Verify apprentice RSI UnPaid Hours History Qarters for that program", Name);
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_CreatedDate_Txt(l.ToString())).ToString("MM/dd/yyy"),
                                            DateTime.Parse(DB_RSIUnPaid_Date[temp]).ToString("MM/dd/yyyy"),
                                            "Verify apprentice RSI UnPaid Hours History Created Date for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_Hours_Txt(l.ToString()),
                                            DB_RSIUnPaid_Hrs[temp].ToString(),
                                            "Verify apprentice RSI UnPaid Hours History Hours for that program", Name);
                            l++; q++;
                        }
                    }

                    //verifying OJT History Table
                    List <string> DB_OJT_Yrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                  " AND work_hour_type_code LIKE 'OJT'" +
                                                                                  " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "year_num");
                    List <string> DB_OJT_Qtrs = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                   " AND work_hour_type_code LIKE 'OJT'" +
                                                                                   " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "quarter_num");
                    List <string> DB_OJT_Date = DBConnection.GetDBData_List_String("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                   " AND work_hour_type_code LIKE 'OJT'" +
                                                                                   " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "create_date");
                    List <float> DB_OJT_Hrs = DBConnection.GetDBData_List_Float("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                " AND work_hour_type_code LIKE 'OJT'" +
                                                                                " ORDER BY year_num DESC, quarter_num DESC, create_date DESC", "hrs_qty");
                    int r = yrs_OJT;
                    if (DB_OJT_Hrs.Count != 0)
                    {
                        int l = OJT_count;
                        if (GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Years_Txt(l.ToString()) == "No records found.")
                        {
                            r = OJT_count + 1;
                        }
                        for (int temp = 0; temp < DB_OJT_Hrs.Count; temp++)
                        {
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_Years_Txt(r.ToString()),
                                            DB_OJT_Yrs[temp].ToString(),
                                            "Verify apprentice OJT History Years for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_Quater_Txt(l.ToString()),
                                            DB_OJT_Qtrs[temp].ToString(),
                                            "Verify apprentice OJT History Qarters for that program", Name);
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_CreatedDate_Txt(l.ToString())).ToString("MM/dd/yyyy"),
                                            DateTime.Parse(DB_OJT_Date[temp]).ToString("MM/dd/yyyy"),
                                            "Verify apprentice OJT History Created Date for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_Hours_Txt(l.ToString()),
                                            DB_OJT_Hrs[temp].ToString(),
                                            "Verify apprentice OJT Hours History Hours for that program", Name);
                            l++; r++;
                        }
                    }

                    //verifying Additional Hours History Table
                    List <float> DB_Additional_Date = DBConnection.GetDBData_List_Float("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                        " AND work_hour_type_code LIKE 'Additional'" +
                                                                                        " ORDER BY year_num DESC, quarter_num DESC, create_date ASC", "create_date");
                    List <float> DB_Additional_Hrs = DBConnection.GetDBData_List_Float("SELECT year_num, quarter_num, create_date, hrs_qty FROM  [aprnt].[apprentice_pgm_occpn_hour] WHERE apprentice_pgm_occpn_rid =" + DB_Apprentice_Occupation_ID[j] +
                                                                                       " AND work_hour_type_code LIKE 'Additional'" +
                                                                                       " ORDER BY year_num DESC, quarter_num DESC, create_date ASC", "hrs_qty");
                    if (DB_Additional_Hrs.Count != 0)
                    {
                        int l = additional_count;
                        for (int temp = 0; temp < DB_Additional_Hrs.Count; temp++)
                        {
                            ExtentReportLog(DateTime.Parse(GetInstance <ApprenticeInformation_Page_Internal>().AdditionalHoursHistory_CreatedDate_Txt(l.ToString())).ToString(),
                                            DB_Additional_Date[temp].ToString(),
                                            "Verify apprentice Additional History Created Date for that program", Name);
                            ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().AdditionalHoursHistory_Hours_Txt(l.ToString()),
                                            DB_Additional_Hrs[temp].ToString(),
                                            "Verify apprentice Additional Hours History Hours for that program", Name);
                            l++;
                        }
                    }

                    yrs_RSIpaid   = p + RSIpaid_count;
                    yrs_RSIunpaid = q + RSIunpaid_count;
                    yrs_OJT       = r + OJT_count;

                    status_count     = status_count + DB_StatusList.Count;
                    step_count       = step_count + DB_StepList.Count;
                    RSIpaid_count    = RSIpaid_count + DB_RSIPaid_Hrs.Count;
                    RSIunpaid_count  = RSIunpaid_count + DB_RSIUnPaid_Hrs.Count;
                    OJT_count        = OJT_count + DB_OJT_Hrs.Count;
                    additional_count = additional_count + DB_Additional_Hrs.Count;
                }
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TC0000_Verify_Apprenticeship_Hours_Update_Internal()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                List <string> SelectedIDs = new List <string>();
                string        ProgramID   = "152";
                string        Status      = "1";
                string        ApprenticeSelectionCheckBoxes = "7;8;9"; //0 4 5 1 3 6 2
                string        OJTHours     = "10";
                string        RSIPaidHours = "10";
                string        RSIUnpaid    = "10";
                string        FromDate     = "01/20/2019";
                string        ToDate       = "01/21/2019";

                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_ReportHour_Lnk();

                GetInstance <ApprenticeReportHours_Page_Internal>().ProgramID_InputTxt(ProgramID);
                GetInstance <ApprenticeReportHours_Page_Internal>().Status_DrpDwn(Status);
                GetInstance <ApprenticeReportHours_Page_Internal>().Search_Btn();
                GetInstance <ApprenticeReportHours_Page_Internal>().ApprenticeSlection_ChkBox(ApprenticeSelectionCheckBoxes);
                GetInstance <ApprenticeReportHours_Page_Internal>().Continue_Btn();
                //Thread.Sleep(5000);
                SelectedIDs = GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().SelectIDs_ListTxt();
                GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().StartDate_Input(FromDate);
                GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().EndDate_Input(ToDate);
                GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().ApplyDatesToAll_Lnk();

                for (int i = 0; i < SelectedIDs.Count; i++)
                {
                    GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().OJTHoursTable_Input(i, OJTHours);
                    GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().RSIPaidHoursTable_Input(i, RSIPaidHours);
                    GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().RSIUnPaidHoursTable_Input(i, RSIUnpaid);
                }

                GetInstance <ApprenticeReportHoursPostSelection_Page_Internal>().UpdateHours_Btn();

                //Validating udated hours
                for (int j = 0; j < SelectedIDs.Count; j++)
                {
                    GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();
                    GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(SelectedIDs[j]);
                    GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
                    GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableLnk(0);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_Hours_Txt("0"),
                                    OJTHours,
                                    "Verify apprentice updated OJT Hours History", Name);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().OJTHistory_CreatedDate_Txt("0"),
                                    DateTime.Today.ToString("MM/dd/yyyy"),
                                    "Verify apprentice updated OJT Hours Credited Date", Name);
                    //ExtentReportLog(GetInstance<ApprenticeInformation_Page_Internal>().OJTHistory_Hours_Txt("0"),
                    //                                      ToDate,
                    //                                    "Verify apprentice updated OJT Hours History", Name);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_Hours_Txt("0"),
                                    RSIPaidHours,
                                    "Verify apprentice updated RSI Paid Hours History", Name);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIPaidHistory_CreatedDate_Txt("0"),
                                    DateTime.Today.ToString("MM/dd/yyyy"),
                                    "Verify apprentice updated RSI Paid Hours Credited Date", Name);
                    //ExtentReportLog(GetInstance<ApprenticeInformation_Page_Internal>().RSIPaidHistory_Hours_Txt("0"),
                    //                                      ToDate,
                    //                                    "Verify apprentice updated OJT Hours History", Name);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_Hours_Txt("0"),
                                    RSIUnpaid,
                                    "Verify apprentice updated RSI Unpaid Hours History", Name);
                    ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_CreatedDate_Txt("0"),
                                    DateTime.Today.ToString("MM/dd/yyyy"),
                                    "Verify apprentice updated RSI Unpaid Hours Credited Date", Name);
                    //ExtentReportLog(GetInstance<ApprenticeInformation_Page_Internal>().RSIUnpaidHistory_Hours_Txt("0"),
                    //                                      ToDate,
                    //                                    "Verify apprentice updated OJT Hours History", Name);
                }
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TC001_Verify_Apprenticeship_Step_Update_Internal()
        {
            try
            {
                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                int           status        = 1;
                string        ProgramID     = "152";
                List <string> NewStepInputs = new List <string>();
                List <string> SelectedIDs   = new List <string>();
                List <string> error_message = new List <string>();

                string ApprenticeSelection_CheckBox = "0;1;2;3;4;5;6;7;8;9";
                string EffectiveDate = DateTime.Today.ToString("MM/dd/yyyy");
                string MinutesDate   = DateTime.Today.ToString("MM/dd/yyyy");
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_StepUpdate_Lnk();
                GetInstance <ApprenticeUpdateStep_Page_Internal>().ProgramID_InputTxt(ProgramID);
                GetInstance <ApprenticeUpdateStep_Page_Internal>().Status_DrpDwn(status);
                GetInstance <ApprenticeUpdateStep_Page_Internal>().Search_Btn();
                GetInstance <ApprenticeUpdateStep_Page_Internal>().ApprenticeSlection_ChkBox(ApprenticeSelection_CheckBox);
                GetInstance <ApprenticeUpdateStep_Page_Internal>().Continue_Btn();
                GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().EffectiveDate_Input(EffectiveDate);
                GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().MinuteDate_Input(MinutesDate);
                GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().ApplyDatesToAll_Lnk();

                SelectedIDs = GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().SelectIDs_ListTxt();

                //Loops through the table adds new step to each input
                for (int i = 0; i < (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().CurrentStepNumberTableTxt).Count; i++)
                {
                    if (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().CurrentStepNumber_Txt(i).ToString() != "")
                    {
                        string new_step = (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().CurrentStepNumber_Txt(i) + 1).ToString();
                        GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().NewStepNumberTable_Input(i, new_step);
                    }
                }

                GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().UpdateSteps_Btn();

                if (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().ErrorMessage_PopUp() == "error! Please fix the error(s).")
                {
                    //copying the error message list to a new list
                    for (int j = 0; j < (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().Message).Count; j++)
                    {
                        error_message.Add(GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().MessageTable_Txt(j));
                    }
                    for (int k = 0; k < error_message.Count; k++)
                    {
                        if (error_message[k] == "")
                        {
                            continue;
                        }

                        /*
                         * else if (error_message[k] == "New step number should be higher than current step")
                         * {
                         *  ExtentReportLog("Test Failed", error_message[k], "Check Algorithum", Name);
                         * }
                         *
                         * else if (error_message[k] == "Enter Effective date.")
                         * {
                         *  ExtentReportLog("Error Message", error_message[k], "Check Test", Name);
                         *  ExtentReportLog("Test Failed", "", "Check Dates functioality", Name);
                         * }
                         *
                         * else if (error_message[k] == "Effective date should be greater than registration date.")
                         * {
                         *  ExtentReportLog("Error Message", error_message[k], "Check Test", Name);
                         *  GetInstance<ApprenticeUpdateStepPostSelection_Page_Internal>().Delete_Btn(k);
                         *  error_message.RemoveAt(k);
                         *  SelectedIDs.RemoveAt(k);
                         *  k = k - 1;
                         * }*/
                        else
                        {
                            ExtentReportLog("Error Message", error_message[k], "Check Test", Name);
                            GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().Delete_Btn(k);
                            error_message.RemoveAt(k);
                            SelectedIDs.RemoveAt(k);
                            k = k - 1;
                        }
                    }

                    for (int l = 0; l < (GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().NewStepNumberInput).Count; l++)
                    {
                        NewStepInputs.Add(Selenium.Driver.GetTextJS(GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().NewStepNumberInput[l], "NewStepNumberInput"));
                    }

                    SelectedIDs = GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().SelectIDs_ListTxt();
                    GetInstance <ApprenticeUpdateStepPostSelection_Page_Internal>().UpdateSteps_Btn();

                    //Validating udated hours
                    for (int j = 0; j < SelectedIDs.Count; j++)
                    {
                        GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();
                        GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(SelectedIDs[j]);
                        Console.WriteLine(SelectedIDs[j]);
                        GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
                        GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableLnk(0);
                        ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().StepHistory_Step_Txt("0"),
                                        NewStepInputs[j],
                                        "Verify apprentice updated OJT Hours History", Name);
                        ExtentReportLog(GetInstance <ApprenticeInformation_Page_Internal>().StepHistory_EffectiveDate_Txt("0"),
                                        EffectiveDate,
                                        "Verify apprentice updated OJT Hours Credited Date", Name);
                    }
                }
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TC000_Verify_Apprentice_Registration()
        {
            try
            {
                Thread.Sleep(2000);
                //----------------------------Random Name Generator (5 Length)-------------------------------
                var chars1       = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                var chars2       = "YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX";
                var num          = "00123456789";
                var stringChars1 = new char[5];
                var stringChars2 = new char[5];
                var intNum       = new char[9];
                var random       = new Random();

                for (int i = 0; i < stringChars1.Length; i++)
                {
                    stringChars1[i] = chars1[random.Next(chars1.Length)];
                }

                for (int i = 0; i < stringChars2.Length; i++)
                {
                    stringChars2[i] = chars2[random.Next(chars2.Length)];
                }

                for (int i = 0; i < intNum.Length; i++)
                {
                    intNum[i] = num[random.Next(num.Length)];
                }

                var firstname = new String(stringChars1);

                var lastname = new String(stringChars2);

                var ssn = new string(intNum);

                //--------------------------------------------------------------------------------------------

                Name         = MethodBase.GetCurrentMethod().Name;
                Selenium.Log = Selenium.Extent.StartTest(Name);
                Selenium.Log.Log(LogStatus.Info, "Started test " + Name);
                ExcelReader.SetSheet(ConfigurationManager.AppSettings.Get("TestApprenticeRegInfoSheet"));
                GetInstance <Left_Menu_Nav_Bar>().Main_Apprentice_Tab();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppReg_Lnk();
                GetInstance <AppReg_EnterSSN_Page_Internal>().ProgramId_InputNum("2156");
                //GetInstance<AppReg_EnterSSN_Page_Internal>().EnterSSN_InputNum(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.SSN));
                GetInstance <AppReg_EnterSSN_Page_Internal>().EnterSSN_InputNum(ssn);
                GetInstance <AppReg_EnterSSN_Page_Internal>().FindApprentice_ClickBtn();
                //GetInstance<AppReg_Form_Page_Internal>().FirstName_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.FIRSTNAME));
                GetInstance <AppReg_Form_Page_Internal>().FirstName_InputTxt(firstname);
                //GetInstance<AppReg_Form_Page_Internal>().LastName_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.LASTNAME));
                GetInstance <AppReg_Form_Page_Internal>().LastName_InputTxt(lastname);
                GetInstance <AppReg_Form_Page_Internal>().AddressLine1_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.ADDRESS1));
                GetInstance <AppReg_Form_Page_Internal>().City_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.CITY));
                GetInstance <AppReg_Form_Page_Internal>().ZipCode_Input(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.ZIPCODE));
                GetInstance <AppReg_Form_Page_Internal>().State_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.STATE));
                GetInstance <AppReg_Form_Page_Internal>().Phone_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.APPLICANTPHONE));
                GetInstance <AppReg_Form_Page_Internal>().Gender_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.GENDER));
                GetInstance <AppReg_Form_Page_Internal>().MilitaryStatus_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.MILITARY));
                GetInstance <AppReg_Form_Page_Internal>().Race_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.RACEETHNICITY));
                GetInstance <AppReg_Form_Page_Internal>().EducationLevel_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.EDUCATION));
                GetInstance <AppReg_Form_Page_Internal>().Occupation_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.APPRENTICEOCCUPATION));
                GetInstance <AppReg_Form_Page_Internal>().Step_DrpDwn("1");
                GetInstance <AppReg_Form_Page_Internal>().DirectEntry_DrpDwn(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.DIRECTENTERY));
                GetInstance <AppReg_Form_Page_Internal>().DOB_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.DOB));
                GetInstance <AppReg_Form_Page_Internal>().BeginDate_InputTxt(ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.BEGINDATE));
                GetInstance <AppReg_Form_Page_Internal>().Register_Btn();
                int AppID = GetInstance <AppReg_Form_Page_Internal>().AppRegID_NumTxt();
                GetInstance <Left_Menu_Nav_Bar>().Apprentice_AppSearch_Lnk();
                GetInstance <SearchApprentice_Page_Internal>().ApprenticeID_InputTxt(AppID.ToString());
                GetInstance <SearchApprentice_Page_Internal>().Search_Btn();
                ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().ApprenticID_TableTxt(0),
                                AppID.ToString(), "Verify App ID", Name);
                ExtentReportLog(GetInstance <SearchApprentice_Page_Internal>().FirstName_TableTxt(0),
                                ExcelReader.GetAppRegInfo(Name, AppRegInfoConstants.FIRSTNAME), "Verify First Name", Name);
                // ExtentReportLog(GetInstance<SearchApprentice_Page_Internal>().ProgramName_TableTxt(0),
                // ProgramName, "Verify Program Name", Name);
            }
            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }
        public void TS000_Apprentice_Info()
        {
            try
            {
                string[] ID_s = { };
                for (int p = 0; p < ID_s.Length; p++)
                {
                    Name         = MethodBase.GetCurrentMethod().Name;
                    Selenium.Log = Selenium.Extent.StartTest(Name);
                    Selenium.Log.Log(LogStatus.Info, "Started test " + Name);

                    GetInstance <LoginPage>().Login(ExcelReader.GetTestData_Integration(Name, DataConstants.LOGINID),
                                                    ExcelReader.GetTestData_Integration(Name, DataConstants.PASSWORD));
                    GetInstance <LandingPage>().Tasks(ExcelReader.GetTestData_Integration(Name, DataConstants.PROGRAMID));
                    GetInstance <DashBoard_Overview_Page>().LookupLinks_AppLookupUpdate_Lnk();

                    ExcelReader.SetSheet(ConfigurationManager.AppSettings.Get("Test_SmokeTest_Apprentice_Information"));

                    string ApprenticeID = ExcelReader.Get_TS_Apprentice_Information(Name, TS_Apprentice_Information.APPRENTICEID);

                    GetInstance <Apprentice_Lookup_Update>().SearchApprenticeID_Input(ApprenticeID);
                    GetInstance <Apprentice_Lookup_Update>().Search_Btn();
                    GetInstance <Apprentice_Lookup_Update>().Table_ApprenticeNameID_Lnk(0);

                    //Validating personal info First Name, Middle Name, Last Name, Apprentice ID, Address
                    //Gender, Race or Ethnicity, Highest Education Level Completed & Military Status

                    //string ApprenticPersonalInfo_Current_Query_1 = "EXEC [aprnt].[p_apprentice_details] @apprentice_id ="+ ApprenticeID;

                    string ApprenticPersonalInfo_Current_Query_1 = "SELECT TOP(1) ap.first_name As FirstName, \n" +
                                                                   "ap.last_name AS LastName, \n" +
                                                                   "Isnull(st.status_code, st_first.status_code)[Status], \n" +
                                                                   "p.full_name AS ProgramName, \n" +
                                                                   "oc.full_title_text AS OccupationName, \n" +
                                                                   "ap.rid AS ApprenticeId, \n" +
                                                                   "apo.rid AS ApprenticeOccupationRid, \n" +
                                                                   "Isnull(lk.name_text, lk1.name_text) AS StatusDescription, \n" +
                                                                   "app_hours.TotalOJT, \n" +
                                                                   "app_hours.TotalRSI, \n" +
                                                                   "po.term_hrs_qty AS OccupationTerm, \n" +
                                                                   "po.pgm_rid AS ProgramId \n" +
                                                                   "FROM   aprnt.apprentice ap \n" +
                                                                   "INNER JOIN aprnt.apprentice_pgm_occpn apo \n" +
                                                                   "ON ap.rid = apo.apprentice_rid \n" +
                                                                   "OUTER apply(SELECT TOP(1) * \n" +
                                                                   "FROM   aprnt.apprentice_pgm_occp_status apos \n" +
                                                                   "WHERE  apo.rid = apos.apprentice_pgm_occpn_rid \n" +
                                                                   "AND apos.[effective_date] <= Getdate() \n" +
                                                                   "ORDER  BY apos.[effective_date] DESC) st \n" +
                                                                   "-- if effective date is in future and there is only one record available for status then show this record with out of considering effective date \n" +
                                                                   "OUTER apply(SELECT TOP(1) * \n" +
                                                                   "FROM   aprnt.apprentice_pgm_occp_status apos \n" +
                                                                   "WHERE  apo.rid = apos.apprentice_pgm_occpn_rid \n" +
                                                                   "ORDER  BY apos.[effective_date] DESC) st_first \n" +
                                                                   "OUTER apply(SELECT  SUM(CASE WHEN occ_hr.[work_hour_type_code] in ('RSI_Paid', 'RSI_Unpaid') THEN ISNULL(occ_hr.[hrs_qty], 0) ELSE 0 END) TotalRSI, \n" +
                                                                   "SUM(CASE WHEN occ_hr.[work_hour_type_code] in ('OJT') THEN ISNULL(occ_hr.[hrs_qty], 0) ELSE 0 END) TotalOJT \n" +
                                                                   "FROM   aprnt.apprentice_pgm_occpn_hour occ_hr \n" +
                                                                   "WHERE occ_hr.apprentice_pgm_occpn_rid = apo.rid \n" +
                                                                   ") app_hours \n" +
                                                                   "INNER JOIN pgm.pgm_occpn po " +
                                                                   "ON po.rid = apo.pgm_occpn_rid \n" +
                                                                   "INNER JOIN pgm.pgm p \n" +
                                                                   "ON p.rid = po.pgm_rid \n" +
                                                                   "INNER JOIN occpn.occpn oc \n" +
                                                                   "ON oc.rid = po.occpn_rid \n" +
                                                                   "INNER JOIN[lookup].[aprnt_status] lk \n" +
                                                                   "ON lk.code = st.status_code \n" +
                                                                   "INNER JOIN[lookup].[aprnt_status] lk1 \n" +
                                                                   "ON lk1.code = st_first.status_code \n" +
                                                                   "WHERE  apo.apprentice_rid =" + ApprenticeID + "\n" +
                                                                   "ORDER BY Isnull(apo.aprnt_begin_date, apo.registration_date) DESC";

                    string   FirstName_temp_0 = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_1, "FirstName");
                    string[] FirstName_temp_1 = FirstName_temp_0.Split(' ');
                    string   FirstName        = FirstName_temp_1[0];
                    string   LastName         = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_1, "LastName");
                    string   Apprentice_Id    = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_1, "ApprenticeId");

                    string Apprentice_Occupation_rid = DBConnection.GetDBData("SELECT TOP 1 * FROM [aprnt].[apprentice_pgm_occpn] a WHERE a.apprentice_rid= " + ApprenticeID + " ORDER BY a.aprnt_begin_date DESC", "rid");

                    string ApprenticPersonalInfo_Current_Query_2 = "EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid =" + Apprentice_Occupation_rid;

                    string Address1 = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "AddressLine1");
                    //string Address2 = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query, "aprnt_addr2_data");
                    string City         = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "City");
                    string State        = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "State");
                    string Zip          = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "ZipCode");
                    string address_Cust = Address1 + ", " + City + ", " + State + ", " + Zip;

                    string Gender = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "Gender");

                    string ApprenticPersonalInfo_Current_Query_3 = "EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " + Apprentice_Occupation_rid;

                    string   Race         = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "Race");
                    string   Education    = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "EducationLevel");
                    string   Military     = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "VetStatus");
                    string   Tranfer      = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "TransferDate");
                    string   Cancellation = "";
                    string   Suspension_Start_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "SuspensionStartDate");
                    string[] ss_temp0         = Suspension_Start_Original.Split(' ');
                    string   Suspension_Start = ss_temp0[0];

                    string   Suspension_End_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "SuspensionEndDate");
                    string[] se_temp0       = Suspension_End_Original.Split(' ');
                    string   Suspension_End = se_temp0[0];

                    string Suspension = Suspension_Start + " to " + Suspension_End;

                    string   Probation_Start_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbationStartDate");
                    string[] ps_temp0        = Probation_Start_Original.Split(' ');
                    string   Probation_Start = ps_temp0[0];

                    string   Probation_End_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbationEndDate");
                    string[] pe_temp0      = Probation_End_Original.Split(' ');
                    string   Probation_End = pe_temp0[0];

                    string Probation = Probation_Start + " to " + Probation_End;

                    string CompletionDate = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CompletionDate");

                    //string[] BeginDate = (DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query, "aprnt_begin_date")).Split(' ') ;

                    string Apprenticeship_Hour_Required = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "OccupationTerm");
                    string Probation_Hour_Required      = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbabtionHoursRequired");

                    string   wageProgression_Step = DBConnection.GetDBData("select Top 1 [step_num] from [aprnt].[apprentice_pgm_occp_step] where [apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + " order by [step_num] Desc", "step_num");
                    string   wageProgression_EffectiveDate_Original = DBConnection.GetDBData("select Top 1 [effective_date] from [aprnt].[apprentice_pgm_occp_step] where [apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + " order by [effective_date] Desc", "effective_date");
                    string[] wp_temp0 = wageProgression_EffectiveDate_Original.Split(' ');
                    string   wageProgression_EffectiveDate          = wp_temp0[0];
                    string   Wage_ProgressionStep_and_EffectiveDate = "Step " + wageProgression_Step + " - " + wageProgression_EffectiveDate;

                    string Total_OJT_Query = "select  SUM((ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0))) AS TotalOJT from \n" +
                                             "(select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                             "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                             "where[apprentice_pgm_occpn_rid]= " + Apprentice_Occupation_rid + " and work_hour_type_code in ('OJT')" +
                                             "group by[year_num],[quarter_num] \n" +
                                             ") as q \n" +
                                             "PIVOT \n" +
                                             "( \n" +
                                             "sum(RISHours) \n" +
                                             "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                             ") as pvt";

                    string Total_OJT_Hours = DBConnection.GetDBData(Total_OJT_Query, "TotalOJT");
                    if (Total_OJT_Hours == "")
                    {
                        Total_OJT_Hours = "0";
                    }
                    else
                    {
                        float TOJT_temp_0 = float.Parse(Total_OJT_Hours); Total_OJT_Hours = TOJT_temp_0.ToString();
                    }

                    string Total_Credited_OJT_Hours = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CreditForPreviousExp");
                    if (Total_Credited_OJT_Hours == "")
                    {
                        Total_Credited_OJT_Hours = "0";
                    }
                    else
                    {
                        float TCOJT_temp_0 = float.Parse(Total_Credited_OJT_Hours); Total_Credited_OJT_Hours = TCOJT_temp_0.ToString();
                    }

                    string Total_RSI_Query = "select  SUM((ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0))) AS TotalRSI from \n" +
                                             "(select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                             "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                             "where[apprentice_pgm_occpn_rid]= " + Apprentice_Occupation_rid + " and work_hour_type_code in ('RSI_Paid','RSI_Unpaid')" +
                                             "group by[year_num],[quarter_num] \n" +
                                             ") as q \n" +
                                             "PIVOT \n" +
                                             "( \n" +
                                             "sum(RISHours) \n" +
                                             "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                             ") as pvt";

                    string Total_RSI_Hours = DBConnection.GetDBData(Total_RSI_Query, "TotalRSI");
                    if (Total_RSI_Hours == "")
                    {
                        Total_RSI_Hours = "0";
                    }
                    else
                    {
                        float TRSI_temp_0 = float.Parse(Total_RSI_Hours); Total_RSI_Hours = TRSI_temp_0.ToString();
                    }

                    string Total_Credited_RSI_Hours = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CreditForPreviousRSIExp");
                    if (Total_Credited_RSI_Hours == "")
                    {
                        Total_Credited_RSI_Hours = "0";
                    }
                    else
                    {
                        float TCRSI_temp_0 = float.Parse(Total_Credited_RSI_Hours); Total_Credited_RSI_Hours = TCRSI_temp_0.ToString();
                    }


                    String OJT_Years_Total_Query = "select YearNumber,Q1,Q2,Q3,Q4, (ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0)) AS Total from \n" +
                                                   "( \n" +
                                                   "select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                                   "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                                   "where[apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + "and work_hour_type_code in ('OJT') \n" +
                                                   "group by[year_num],[quarter_num] \n" +
                                                   ") as q \n" +
                                                   "PIVOT \n" +
                                                   "( \n" +
                                                   "sum(RISHours) \n" +
                                                   "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                                   ") as pvt \n" +
                                                   "order by YearNumber \n";

                    List <float> OJT_Years_Total = DBConnection.GetDBData_List_Float(OJT_Years_Total_Query, "Total");
                    GetInstance <Apprentice_LookUp_Details>().ViewHistory_Lnk();
                    Thread.Sleep(2000);


                    for (int i = 0; i < OJT_Years_Total.Count; i++)
                    {
                        ExtentReportLog(
                            GetInstance <Apprentice_LookUp_Details>().OJTHoursBreakDown_YearTotals_Table_Txt(i),
                            (OJT_Years_Total[i]).ToString(),
                            "Test OJT hours Break Down",
                            Name
                            );
                    }

                    String RSI_Years_Total_Query = "select YearNumber,Q1,Q2,Q3,Q4, (ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0)) AS Total from \n" +
                                                   "( \n" +
                                                   "select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                                   "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                                   "where[apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + "and work_hour_type_code in ('RSI_Paid','RSI_Unpaid') \n" +
                                                   "group by[year_num],[quarter_num] \n" +
                                                   ") as q \n" +
                                                   "PIVOT \n" +
                                                   "( \n" +
                                                   "sum(RISHours) \n" +
                                                   "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                                   ") as pvt \n" +
                                                   "order by YearNumber \n";

                    List <float> RSI_Years_Total = DBConnection.GetDBData_List_Float(RSI_Years_Total_Query, "Total");

                    for (int i = 0; i < OJT_Years_Total.Count; i++)
                    {
                        ExtentReportLog(
                            GetInstance <Apprentice_LookUp_Details>().RSIHoursBreakDown_YearTotals_Table_Txt(i),
                            (RSI_Years_Total[i]).ToString(),
                            "Test RSI hours Break Down",
                            Name
                            );
                    }

                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(0), FirstName, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(2), LastName, "Validating Info", Name);
                    //ExtentReportLog(GetInstance<Apprentice_LookUp_Details>().AppPersonalInfo_Txt(1), MiddleName, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(3), ApprenticeID, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(4), address_Cust, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(5), Gender, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(6), Race, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(7), Education, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(8), Military, "Validating Info", Name);
                    //ExtentReportLog(GetInstance<Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(0) , BeginDate[0], "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(4), Total_OJT_Hours, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(5), Total_Credited_OJT_Hours, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(6), Total_RSI_Hours, "Validating Info", Name);
                    ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(7), Total_Credited_RSI_Hours, "Validating Info", Name);

                    if (
                        Int32.Parse(DBConnection.GetDBData(
                                        "SELECT Count(rid) as Count FROM [aprnt].[apprentice_pgm_occpn] a WHERE a.apprentice_rid= " + ApprenticeID, "Count"))
                        >= 1)
                    {
                        GetInstance <Apprentice_LookUp_Details>().BackToApprenticeSearch_Lnk();

                        for (int i = 0;
                             i < (Int32.Parse(DBConnection.GetDBData(
                                                  "SELECT Count(rid) as Count FROM [aprnt].[apprentice_pgm_occpn] a WHERE a.apprentice_rid= " + ApprenticeID, "Count"))) - 1;
                             i++)
                        {
                            GetInstance <Apprentice_Lookup_Update>().Table_ApprenticeNameID_Lnk(0);
                            GetInstance <Apprentice_LookUp_Details>().ViewHistoryItem_Lnk(((
                                                                                               (GetInstance <Apprentice_LookUp_Details>().ViewHistoryItemLnk).Count) - 1) - i);

                            Thread.Sleep(5000);

                            Apprentice_Occupation_rid = DBConnection.GetDBData(
                                "SELECT  * FROM [aprnt].[apprentice_pgm_occpn] a WHERE a.apprentice_rid= " +
                                ApprenticeID + " ORDER BY a.aprnt_begin_date DESC OFFSET " + (i + 1) +
                                " ROW FETCH NEXT 1 ROWS ONLY ", "rid");

                            ApprenticPersonalInfo_Current_Query_2 =
                                "EXEC [aprnt].[p_apprentice_get_print_details] @aprnt_pgm_occpn_rid =" +
                                Apprentice_Occupation_rid;

                            Address1 = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "AddressLine1");
                            //string Address2 = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query, "aprnt_addr2_data");
                            City         = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "City");
                            State        = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "State");
                            Zip          = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "ZipCode");
                            address_Cust = Address1 + ", " + City + ", " + State + ", " + Zip;

                            Gender = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "Gender");

                            ApprenticPersonalInfo_Current_Query_3 = "EXEC [aprnt].[usp_apprentice_detail] @ProgramOccupationId = " +
                                                                    Apprentice_Occupation_rid;

                            Race      = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "Race");
                            Education = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "EducationLevel");
                            Military  = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "VetStatus");
                            Tranfer   = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "TransferDate");

                            Cancellation = "";

                            Suspension_Start_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "SuspensionStartDate");
                            string[] ss1_temp0 = Suspension_Start_Original.Split(' ');
                            Suspension_Start = ss1_temp0[0];

                            Suspension_End_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "SuspensionEndDate");
                            string[] se1_temp0 = Suspension_End_Original.Split(' ');
                            Suspension_End = se1_temp0[0];

                            Suspension = Suspension_Start + " to " + Suspension_End;

                            Probation_Start_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbationStartDate");
                            string[] ps1_temp0 = Probation_Start_Original.Split(' ');
                            Probation_Start = ps1_temp0[0];

                            Probation_End_Original = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbationEndDate");
                            string[] pe1_temp0 = Probation_End_Original.Split(' ');
                            Probation_End = pe1_temp0[0];

                            Probation = Probation_Start + " to " + Probation_End;

                            CompletionDate = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CompletionDate");

                            //string[] BeginDate = (DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query, "aprnt_begin_date")).Split(' ') ;

                            Apprenticeship_Hour_Required = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "OccupationTerm");
                            Probation_Hour_Required      = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_3, "ProbabtionHoursRequired");

                            wageProgression_Step = DBConnection.GetDBData("select Top 1 [step_num] from [aprnt].[apprentice_pgm_occp_step] where [apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + " order by [step_num] Desc", "step_num");
                            wageProgression_EffectiveDate_Original = DBConnection.GetDBData("select Top 1 [effective_date] from [aprnt].[apprentice_pgm_occp_step] where [apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + " order by [effective_date] Desc", "effective_date");
                            string[] wp1_temp0 = wageProgression_EffectiveDate_Original.Split(' ');
                            wageProgression_EffectiveDate          = wp1_temp0[0];
                            Wage_ProgressionStep_and_EffectiveDate = "Step " + wageProgression_Step + " - " + wageProgression_EffectiveDate;

                            Total_OJT_Query = "select  SUM((ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0))) AS TotalOJT from \n" +
                                              "(select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                              "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                              "where[apprentice_pgm_occpn_rid]= " + Apprentice_Occupation_rid + " and work_hour_type_code in ('OJT')" +
                                              "group by[year_num],[quarter_num] \n" +
                                              ") as q \n" +
                                              "PIVOT \n" +
                                              "( \n" +
                                              "sum(RISHours) \n" +
                                              "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                              ") as pvt";

                            Total_OJT_Hours = DBConnection.GetDBData(Total_OJT_Query, "TotalOJT");

                            if (Total_OJT_Hours == "")
                            {
                                Total_OJT_Hours = "0";
                            }
                            else
                            {
                                float TOJT_temp_0 = float.Parse(Total_OJT_Hours); Total_OJT_Hours = TOJT_temp_0.ToString();
                            }

                            Total_Credited_OJT_Hours = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CreditForPreviousExp");
                            if (Total_Credited_OJT_Hours == "")
                            {
                                Total_Credited_OJT_Hours = "0";
                            }
                            else
                            {
                                float TCOJT_temp_0 = float.Parse(Total_Credited_OJT_Hours); Total_Credited_OJT_Hours = TCOJT_temp_0.ToString();
                            }

                            Total_RSI_Query = "select  SUM((ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0))) AS TotalRSI from \n" +
                                              "(select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                              "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                              "where[apprentice_pgm_occpn_rid]= " + Apprentice_Occupation_rid + " and work_hour_type_code in ('RSI_Paid','RSI_Unpaid')" +
                                              "group by[year_num],[quarter_num] \n" +
                                              ") as q \n" +
                                              "PIVOT \n" +
                                              "( \n" +
                                              "sum(RISHours) \n" +
                                              "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                              ") as pvt";

                            Total_RSI_Hours = DBConnection.GetDBData(Total_RSI_Query, "TotalRSI");

                            if (Total_RSI_Hours == "")
                            {
                                Total_RSI_Hours = "0";
                            }
                            else
                            {
                                float TRSI_temp_0 = float.Parse(Total_RSI_Hours); Total_RSI_Hours = TRSI_temp_0.ToString();
                            }

                            Total_Credited_RSI_Hours = DBConnection.GetDBData(ApprenticPersonalInfo_Current_Query_2, "CreditForPreviousRSIExp");
                            if (Total_Credited_RSI_Hours == "")
                            {
                                Total_Credited_RSI_Hours = "0";
                            }
                            else
                            {
                                float TCRSI_temp_0 = float.Parse(Total_Credited_RSI_Hours); Total_Credited_RSI_Hours = TCRSI_temp_0.ToString();
                            }

                            OJT_Years_Total_Query = "select YearNumber,Q1,Q2,Q3,Q4, (ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0)) AS Total from \n" +
                                                    "( \n" +
                                                    "select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                                    "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                                    "where[apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + "and work_hour_type_code in ('OJT') \n" +
                                                    "group by[year_num],[quarter_num] \n" +
                                                    ") as q \n" +
                                                    "PIVOT \n" +
                                                    "( \n" +
                                                    "sum(RISHours) \n" +
                                                    "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                                    ") as pvt \n" +
                                                    "order by YearNumber \n";

                            OJT_Years_Total = DBConnection.GetDBData_List_Float(OJT_Years_Total_Query, "Total");

                            for (int j = 0; j < OJT_Years_Total.Count; j++)
                            {
                                ExtentReportLog(
                                    GetInstance <Apprentice_LookUp_Details>().OJTHoursBreakDown_YearTotals_Table_Txt(j),
                                    (OJT_Years_Total[j]).ToString(),
                                    "Test OJT hours Break Down",
                                    Name
                                    );
                            }

                            RSI_Years_Total_Query = "select YearNumber,Q1,Q2,Q3,Q4, (ISNULL(Q1,0)+ISNULL(Q2,0)+ISNULL(Q3,0)+ISNULL(Q4,0)) AS Total from \n" +
                                                    "( \n" +
                                                    "select[year_num] as YearNumber, 'Q' + cast([quarter_num] as varchar) as QuarterNum, sum(isnull([hrs_qty], 0))  RISHours \n" +
                                                    "from[aprnt].[apprentice_pgm_occpn_hour] \n" +
                                                    "where[apprentice_pgm_occpn_rid]=" + Apprentice_Occupation_rid + "and work_hour_type_code in ('RSI_Paid','RSI_Unpaid') \n" +
                                                    "group by[year_num],[quarter_num] \n" +
                                                    ") as q \n" +
                                                    "PIVOT \n" +
                                                    "( \n" +
                                                    "sum(RISHours) \n" +
                                                    "FOR QuarterNum in (Q1,Q2,Q3,Q4) \n" +
                                                    ") as pvt \n" +
                                                    "order by YearNumber \n";

                            OJT_Years_Total = DBConnection.GetDBData_List_Float(RSI_Years_Total_Query, "Total");

                            for (int j = 0; j < OJT_Years_Total.Count; j++)
                            {
                                ExtentReportLog(
                                    GetInstance <Apprentice_LookUp_Details>().RSIHoursBreakDown_YearTotals_Table_Txt(j),
                                    (OJT_Years_Total[j]).ToString(),
                                    "Test OJT hours Break Down",
                                    Name
                                    );
                            }

                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(0), FirstName, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(2), LastName, "Validating Info", Name);
                            //ExtentReportLog(GetInstance<Apprentice_LookUp_Details>().AppPersonalInfo_Txt(1), MiddleName, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(3), ApprenticeID, "Validating Info", Name);
                            Thread.Sleep(2000);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(4), address_Cust, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(5), Gender, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(6), Race, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(7), Education, "Validating Info", Name);
                            ExtentReportLog(GetInstance <Apprentice_LookUp_Details>().AppPersonalInfo_Txt(8), Military, "Validating Info", Name);
                            //ExtentReportLog(GetInstance<Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(0) , BeginDate[0], "Validating Info", Name);

                            ExtentReportLog(
                                GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(4), Total_OJT_Hours, "Validating Info",
                                Name);
                            ExtentReportLog(
                                GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(5), Total_Credited_OJT_Hours, "Validating Info",
                                Name);
                            ExtentReportLog(
                                GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(6), Total_RSI_Hours, "Validating Info",
                                Name);
                            ExtentReportLog(
                                GetInstance <Apprentice_LookUp_Details>().AppInfoCloumn_2_Txt(7), Total_Credited_RSI_Hours, "Validating Info",
                                Name);
                            GetInstance <Apprentice_LookUp_Details>().BackToApprenticeSearch_Lnk();
                        }
                    }
                }
            }

            catch (Exception e)
            {
                string screenShotPath = AutomationReport.Capture(Selenium.ObjDriver, DateTime.Today.ToString("MM-dd-yyyy_hh_mm_ss"));
                Selenium.Log.Log(LogStatus.Fail, "Snapshot below: " + Selenium.Log.AddScreenCapture(screenShotPath));
                Selenium.Log.Log(LogStatus.Fail, "Build Falure: " + e);
                throw (e);
            }
        }