private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { this.sourceTable = db.GetWorksheet(t.Selection); this.dgvAnalysisSource.DataSource = sourceTable; this.comboBox1.Items.Clear(); this.checkedListBox1.Items.Clear(); foreach (DataColumn col in sourceTable.Columns) { this.comboBox1.Items.Add(col.ColumnName); this.checkedListBox1.Items.Add(col.ColumnName); } this.comboBox1.SelectedIndex = 0; } } } }
/// <summary> /// Launched when the user clicks the File -> Open menu item. /// </summary> /// private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); this.dgvAnalysisSource.DataSource = tableSource; this.dgvProjectionSource.DataSource = tableSource.Copy(); double[,] graph = tableSource.ToMatrix(out columnNames); inputScatterplot.DataSource = graph; createMappingScatterplot(graphMapInput, graph); lbStatus.Text = "Now, click 'Run analysis' to start processing the data!"; } } } }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); double[,] sourceMatrix = tableSource.ToMatrix(out sourceColumns); // Detect the kind of problem loaded. if (sourceMatrix.GetLength(1) == 2) { MessageBox.Show("Missing class column."); } else { this.dgvLearningSource.DataSource = tableSource; this.dgvTestingSource.DataSource = tableSource.Copy(); CreateScatterplot(graphInput, sourceMatrix); } } } } }
public void ReadXlsxTest() { ExcelReader reader = new ExcelReader(); ImportData data = new ImportData(); string testDataLocation = "/Assets/Vendor/DataHelpers/Editor/Tests/Fixtures/TestData.xlsx"; reader.ReadAsset(testDataLocation, ref data); Assert.AreEqual(2, data.vars.Count, "it should load 2 variables"); Assert.AreEqual("100", data.vars["foo1"]); Assert.AreEqual("200", data.vars["foo2"]); Assert.AreEqual(2, data.meta.Count, "it should load 2 meta values"); Assert.AreEqual("foo author", data.meta["author"]); Assert.AreEqual("foo description", data.meta["description"]); Assert.AreEqual(3, data.fieldNames.Count, "it should load 3 field names"); Assert.AreEqual("Foo", data.fieldNames[0]); Assert.AreEqual("Bar", data.fieldNames[1]); Assert.AreEqual("Baz", data.fieldNames[2]); Assert.AreEqual(2, data.rows.Count, "it should load 2 rows of data"); Assert.AreEqual("1", data.rows[0].fields["Foo"].value); Assert.AreEqual("2", data.rows[0].fields["Bar"].value); Assert.AreEqual("3", data.rows[0].fields["Baz"].value); Assert.AreEqual("4", data.rows[1].fields["Foo"].value); Assert.AreEqual("5", data.rows[1].fields["Bar"].value); Assert.AreEqual("6", data.rows[1].fields["Baz"].value); }
public void SetUp() { var rangesInWorksheet = new IRange[3][]; for (int i = 0; i < rangesInWorksheet.Length; i++) { rangesInWorksheet[i] = A.CollectionOfFake<IRange>(4).ToArray(); for (int j = 0; j < rangesInWorksheet[i].Length; j++) { A.CallTo(() => rangesInWorksheet[i][j].Text).Returns(string.Format("{0} {1}", i+1, j+1)); } } var range = A.Fake<IRange>(); for (int i = 0; i < rangesInWorksheet.Length; i++) { for (int j = 0; j < rangesInWorksheet[i].Length; j++) { A.CallTo(() => range[i+1, j+1]).Returns(rangesInWorksheet[i][j]); } } _worksheet = A.Fake<IWorksheet>(); A.CallTo(() => _worksheet.Name).Returns("WorksheetName"); A.CallTo(() => _worksheet.Cells).Returns(range); _sut = ExcelReaderFactory.CreateExcelReader(); }
public bool ReadExcel() { if (null == m_excelReader) { m_excelReader = new ExcelReader(m_strFullExcelName); } return actiBase.ReadData(m_excelReader); }
//批量修改excel private void btAutoEdit_Click(object sender, EventArgs e) { int fileCount = lvFile.Items.Count; ExcelReader reader = new ExcelReader(); for (int i = 0; i < fileCount; i++) { reader.ReplaceOne(lvFile.Items[i].SubItems[2].Text); } }
public void InitFactoryTest() { var reader = new ExcelReader(); var result = reader.GetProductsFromFile(excelFileName); var resultArray = result.ToArray(); resultArray.Should().Not.Be.Null() .Should().Count.AtLeast(1); }
public void TestRead() { ExcelReader reader = new ExcelReader(@"C:\Users\mikawudi\Desktop\test.xls"); if(!reader.Open()) { return; } var result = reader.Select<TestClass>("Sheet1"); reader.Close(); }
public void ReadXlsxTest() { ExcelReader reader = new ExcelReader(); ReadBundle readBundle = new ReadBundle(); string testDataLocation = "/Assets/Vendor/DataHelpers/Editor/Tests/Fixtures/TestData.xlsx"; ExcelReader.ReadXLSX(testDataLocation, ref readBundle); Assert.AreEqual(3, readBundle.fieldNames.Count, "it should load 3 field names"); Assert.AreEqual(2, readBundle.rows.Count, "it should load 2 rows of data"); }
public override bool ReadData(ExcelReader reader) { if (! base.ReadData(reader)) { return false; } //// m_listBase = reader.GetSheetData<BaseSheetInfo>(CustomDefine.SHEET_BASE); if (m_listBase.Count > 1) { throw new Exception("Failed to read the sheet=" + CustomDefine.SHEET_BASE + " of excel=" + reader.ToString()); } //// m_listOwn = reader.GetSheetData<IntimeOnlineInfo>(m_strExcelSheet); return true; }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { this.sourceTable = db.GetWorksheet(t.Selection); this.dataGridView1.DataSource = sourceTable; } } } }
public bool ReadExcel() { if (null == m_excelReader) { m_excelReader = new ExcelReader(m_strFullExcelName); } // int nSheets = m_excelReader.GetSheetsCount(); for (int i = 0; i < nSheets; i++) { string strBoxID = m_excelReader.GetSheetNameByIndex(i); List<BoxInfo> listInfo = m_excelReader.GetSheetData<BoxInfo>(strBoxID); // cBoxInfo info = new cBoxInfo(strBoxID); info.CopyAllBox(listInfo); m_listBoxInfo.Add(info); } return true; }
public void CellDataTypesTest() { ExcelReader reader = new ExcelReader(dataTypesTestFile); reader.HasHeaders = true; SourceDataTable dataTable = reader.ReadToDataTable(); string[] headers = reader.GetHeaderNames(); SourceDataEntry entry1 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[0]); Assert.AreEqual(DataType.Bool, entry1.DataType); Assert.AreEqual("1", entry1.Value); SourceDataEntry entry2 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[1]); Assert.AreEqual(DataType.DateTime, entry2.DataType); Assert.AreEqual("12/30/1899 00:00:00", entry2.Value); SourceDataEntry entry3 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[2]); Assert.AreEqual(DataType.Error, entry3.DataType); Assert.AreEqual("", entry3.Value); SourceDataEntry entry4 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[3]); Assert.AreEqual(DataType.String, entry4.DataType); Assert.AreEqual("Test string", entry4.Value); SourceDataEntry entry5 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[4]); Assert.AreEqual(DataType.Number, entry5.DataType); Assert.AreEqual("1.23", entry5.Value); SourceDataEntry entry6 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[5]); Assert.AreEqual(DataType.String, entry6.DataType); Assert.AreEqual("Test string", entry6.Value); SourceDataEntry entry7 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[6]); Assert.AreEqual(DataType.String, entry7.DataType); Assert.AreEqual("Test string", entry7.Value); SourceDataEntry entry8 = dataTable.GetDataRow(0).GetSourceDataEntry(headers[7]); Assert.AreEqual(DataType.Number, entry8.DataType); Assert.AreEqual("1.23", entry8.Value); }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); this.dgvAnalysisSource.DataSource = tableSource; this.dgvProjectionSource.DataSource = tableSource.Copy(); double[,] graph = tableSource.ToMatrix(out sourceColumns); inputScatterplot.DataSource = graph; } } } }
public ExcelExtractor(Stream stream) { _reader = new ExcelReader(); _reader.Initialize(stream); }
public ActionResult ReadExcelDemo() { List<ExcelDataViewModel> modelList = null; string filePhysicalPath = SysContext.Config.ReportTemplateDirectory_Physical + "测试模板.xlsx"; string sheetName = "哈哈"; bool hasTitle = true; using (ExcelReader excelReader = new ExcelReader(filePhysicalPath, sheetName, hasTitle)) { modelList = excelReader.Read<ExcelDataViewModel>(); } DataTable dataTable = FormatConverter.ListToDataTable<ExcelDataViewModel>( modelList, (p => p.GetCustomAttributes(typeof(DisplayNameAttribute), true).Length > 0), useDisplayName: true); return View("~/Views/Shared/Controls/Table_DataTable_Partial.cshtml", dataTable); //return View("~/Views/Shared/Controls/Table_IEnumerable_Partial.cshtml", modelList); }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); this.dgvAnalysisSource.DataSource = tableSource; double[,] data = tableSource.ToMatrix(); var x = data.GetColumn(0); var y = data.GetColumn(1); CreateScatterplot(graphInput, x, y, null, null, null, null); } } } lbStatus.Text = "Click Compute the estimate a robust linear regression!"; }
/// <summary> /// Launched when the user clicks the File -> Open menu item. /// </summary> /// private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { this.dgvAnalysisSource.DataSource = db.GetWorksheet(t.Selection); this.dgvProjectionSource.DataSource = db.GetWorksheet(t.Selection); } } else if (extension == ".xml") { DataTable dataTableAnalysisSource = new DataTable(); dataTableAnalysisSource.ReadXml(openFileDialog.FileName); this.dgvAnalysisSource.DataSource = dataTableAnalysisSource; this.dgvProjectionSource.DataSource = dataTableAnalysisSource.Clone(); } } }
static int Main(string[] args) { Comp2 c = new Comp2(); c.DocumentType = DocumentType.Word; for (int i=0;i<args.Length;i++) { if (args[i].ToLower().Trim('/','-') == "?") { Console.WriteLine("//Правила аргументов командной строки такие...."); Console.WriteLine("// - WordXML имя_файла - имя входного WORD файла"); Console.WriteLine("// - ExcelXML имя_файла - имя входного Excel файла"); Console.WriteLine("// - readXSD имя_файла - имя входной схемы XSD"); Console.WriteLine("// - outXSL имя_файла - имя выходного XSLT файла"); Console.WriteLine("// - uri имя_URI - URI (тип документа)"); Console.WriteLine("// - ? - помощь"); return -1; } if (args[i].ToLower().Trim('/','-') == "wordxml" && i+1 < args.Length) { c.DocumentType = DocumentType.Word; c.inputXMLFile = args[i+1].Trim('\"','\'','`'); i++; continue; } if (args[i].ToLower().Trim('/', '-') == "excelxml" && i + 1 < args.Length) { c.DocumentType= DocumentType.Excel; c.inputXMLFile = args[i + 1].Trim('\"', '\'', '`'); i++; continue; } if (args[i].ToLower().Trim('/','-') == "readxsd" && i+1 < args.Length) { c.inputXSDFile = args[i+1].Trim('\"','\'','`'); i++; continue; } if (args[i].ToLower().Trim('/','-') == "outxsl" && i+1 < args.Length) { c.outXMLFile = args[i+1].Trim('\"','\'','`'); i++; continue; } if (args[i].ToLower().Trim('/','-') == "uri" && i+1 < args.Length) { c.URI = args[i+1].Trim('\"','\'','`'); i++; continue; } } /*string input = "apof1w1.xml"; string output = "out_word.xsl"; string URI = "APOF1"; string xsd = "apof1s.xsd";*/ if (c.DocumentType == DocumentType.Word) { ReadWordXml read = new ReadWordXml(c.inputXMLFile, c.URI); read.Read(); WriteWordXml write = new WriteWordXml(read.node, c.outXMLFile, c.inputXSDFile); write.Write(); return 0; } else { //Excel XSD xsd = null; try { xsd = new XSD(c.inputXSDFile); xsd.Load(); } catch (Exception ex) { Console.WriteLine("Ошибка парсинга xsd: " + ex); return 1; } ExcelReader reader = new ExcelReader(c.inputXMLFile); ExcelDocument st = reader.Process(); XmlNode node = st.GenerateXSLT(xsd); node.OwnerDocument.Save(c.outXMLFile); return 0; } }
protected ExtractorDecorator(ExcelReader excelReader) { ExcelReader = excelReader; }
private DataSet GetDataSourceForDynamicExportDemo() { DataSet dataSource = new DataSet(); // 标题表 DataTable 标题表 = new DataTable("标题表"); 标题表.Columns.Add("标题"); 标题表.Columns.Add("副标题"); DataRow dr = 标题表.NewRow(); dr["标题"] = "动态报表" + typeof(DynamicExcelDataViewModel).Name; dr["副标题"] = "动态模版:" + typeof(ExcelDataViewModel).Name; 标题表.Rows.Add(dr); dataSource.Tables.Add(标题表); // 数据表 using (ExcelReader excelReader = new ExcelReader(SysContext.Config.ReportTemplateDirectory_Physical + "测试模板.xlsx", "哈哈", true)) { List<DynamicExcelDataViewModel> modelList = excelReader.Read<DynamicExcelDataViewModel>(); DataTable 数据表 = FormatConverter.ListToDataTable<DynamicExcelDataViewModel>(modelList, (p => p.GetCustomAttributes(typeof(DisplayNameAttribute), true).Length > 0)); 数据表.TableName = "数据表"; dataSource.Tables.Add(数据表); } return dataSource; }
public TextColorExtractor(ExcelReader excelReader) : base(excelReader) { }
private void readSource(string sourcePath) { reader = new ExcelReader(sourcePath); readWorkSheet(); SelectedWorkSheet = reader.WorkSheetNames[0]; NotifyPropertyChanged("SourceWorkSheets"); }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); double[,] sourceMatrix = tableSource.ToMatrix(out columnNames); // Detect the kind of problem loaded. if (sourceMatrix.GetLength(1) == 2) { MessageBox.Show("Missing class column."); } else { this.dgvLearningSource.DataSource = tableSource; this.dgvTestingSource.DataSource = tableSource.Copy(); double[,] graph = tableSource.ToMatrix(out columnNames); graphInput.DataSource = graph; inputNames = columnNames.Submatrix(2); lbStatus.Text = "Now, click 'Run analysis' to start processing the data!"; } } } } }
public ExcelExtractor(string path) { _reader = new ExcelReader(); _reader.Initialize(new FileStream(path, FileMode.Open, FileAccess.Read)); }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); this.dgvLearningSource.DataSource = tableSource; this.dgvTestingSource.DataSource = tableSource.Copy(); double[,] sourceMatrix = tableSource.ToMatrix(out columnNames); CreateScatterplot(graphInput, sourceMatrix); } } } }
void Populate(string filePath) { /* lokaliteter = new ArrayList (); lokaliteter.Add (new Lokalitet ("12394", "Ørnøya", new Vector2(63.759167f, 8.449133f))); lokaliteter.Add (new Lokalitet ("31959", "Rataren", new Vector2(63.782383f, 8.526367f))); */ var excelReader = new ExcelReader (); lokaliteter = excelReader.readFile (filePath, lokaliteter); OnlineMapsControlBase3D control = onlineMaps.GetComponent<OnlineMapsControlBase3D> (); control.RemoveAllMarker3D (); onlineMaps.RemoveAllDrawingElements (); enhetDrawingLines.Clear (); for (int i = 0; i < lokaliteter.Count; i++) { Lokalitet l = lokaliteter [i] as Lokalitet; GameObject mapObject = (GameObject)Resources.Load ("markerPrefab", typeof(GameObject)); //GameObject mapObject = Instantiate(Resources.Load("markerPrefab", typeof(GameObject))) as GameObject; //mapObject.name = lokaliteter[i].getLokalitetsnavn(); Vector2 position = l.getCoordinates (); marker = control.AddMarker3D (position, mapObject); marker.position = position; marker.label = l.getLokalitetsnavn (); marker.scale = defaultMarkerScale; marker.customData = l; control = onlineMaps.GetComponent<OnlineMapsControlBase3D> (); l.setMarker (marker); //control.AddMarker3D (marker); List<Enhet> enheter = l.getEnheter(); float radius = 0.1f; //var circlePoints = new List<Vector2> (); for(int j=0; j<l.getEnheter().Count; j++){ Enhet e = enheter[j] as Enhet; GameObject mapObjectChild = (GameObject)Resources.Load ("markerEnhetPrefab", typeof(GameObject)); //GameObject mapObjectChild = Instantiate(Resources.Load("markerEnhetPrefab", typeof(GameObject))) as GameObject; //mapObjectChild.name = enheter[j].getEnhetsId(); var angle = j * Mathf.PI * 2 / enheter.Count; position = l.getCoordinates (); var pos = new Vector2 (position.x + Mathf.Cos (angle) * radius, position.y + Mathf.Sin (angle) * radius * 0.5f); marker = control.AddMarker3D (pos, mapObjectChild); marker.label = l.getLokalitetsnavn () + ": " + e.getEnhetsId().Replace(" ", ""); marker.scale = defaultMarkerScale; marker.customData = e; e.setMarker (marker); //Destroy(mapObjectChild); //circlePoints.Add (pos); var linePoints = new List<Vector2> (); linePoints.Add (l.getCoordinates ()); linePoints.Add (pos); OnlineMapsDrawingElement line = new OnlineMapsDrawingLine (linePoints, Color.black, 0.3f); //onlineMaps.AddDrawingElement (line); enhetDrawingLines.Add (line); } //OnlineMapsDrawingElement circle = new OnlineMapsDrawingPoly (circlePoints); //onlineMaps.AddDrawingElement (circle); if (visEnhet) { foreach (var line in enhetDrawingLines) { onlineMaps.AddDrawingElement (line); } } //Destroy(mapObject); } UpdateSliderDates (); oppdaterMarkers (); dataTypeChanged (); }
public HorizontalAlignmentExtractor(ExcelReader excelReader) : base(excelReader) { }
private void MenuFileOpen_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog.FileName; string extension = Path.GetExtension(filename); if (extension == ".xls" || extension == ".xlsx") { ExcelReader db = new ExcelReader(filename, true, false); TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList()); if (t.ShowDialog(this) == DialogResult.OK) { DataTable tableSource = db.GetWorksheet(t.Selection); this.dgvSequenceSource.DataSource = tableSource; loadTesting(tableSource); } } } }
public void TS001_OJT_RSI_Report_Hours() { //Search filters functionality validation 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_RSI_OJTReporting_ClickLnk(); //Validating Program Selection filter GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgram_DrpDwn("128"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); string Result_App_ID = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeID_Txt(0); string query = "EXEC [aprnt].[p_apprentice_details] @apprentice_id = " + Result_App_ID; string Result_Pgm_Name = DBConnection.GetDBData(query, "ProgramName"); ExtentReportLog( (Selenium.Driver.GetSelectedTxt( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgramDrpDwn, "128")).Trim(), Result_Pgm_Name, "PGM NAME VALID", Name); //Validating First Name filter GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgram_DrpDwn("128"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchFirstName_Input("David"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { string FullName = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameID_Txt(i); string[] temp1 = FullName.Split(','); string[] temp2 = (temp1[1].Trim()).Split(' '); string FirstName = temp2[0]; ExtentReportLog( FirstName.ToLower(), "David".ToLower(), "Checking for first name filter functionlity", Name); } //Validating Last Name filter GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgram_DrpDwn("128"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchLasttName_Input("Wright"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { string FullName = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameID_Txt(i); string[] temp1 = FullName.Split(','); string LastName = temp1[0]; ExtentReportLog( LastName.ToLower(), "Wright".ToLower(), "Checking for Last name filter functionlity", Name); } //Validating Apprentice ID filter GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgram_DrpDwn("128"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchLasttName_Input("200136"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { string FullName = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameID_Txt(i); string[] temp1 = FullName.Split('('); string[] temp2 = temp1[1].Split(')'); string Apprentice_Id = temp2[0]; ExtentReportLog( Apprentice_Id, "200136", "Checking for Apprentice ID filter functionlity", Name); } //Validating status filter GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SelectProgram_DrpDwn("128"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchStatus_DrpDwn("Active"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_Status_Txt(i), "Active", "Checking for Status filter functionlity", Name); } GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchStatus_DrpDwn("Suspended"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_Status_Txt(i), "Suspended", "Checking for Status filter functionlity", Name); } GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchStatus_DrpDwn("Cancelled"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_Status_Txt(i), "Cancelled", "Checking for Status filter functionlity", Name); } GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().SearchStatus_DrpDwn("Completed"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_Status_Txt(i), "Completed", "Checking for Status filter functionlity", Name); } //RSI & OJT, RSI, OJT search filters GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().PreferenceHours_RdoBtns("0"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(1) + " & " + GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(2), "RSI Hours & OJT Hours", "Verifing Hours Preference", Name); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().PreferenceHours_RdoBtns("1"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(1) + " " + GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(2) + " " + GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(3), "From To RSI Hours", "Verifing Hours Preference", Name); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().PreferenceHours_RdoBtns("2"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); ExtentReportLog( GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(1) + " " + GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(2) + " " + GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_Txt(3), "From To OJT Hours", "Verifing Hours Preference", Name); //Validating 'Autofill Date' GetInstance <ApprenticeReadyTo_Report_Hours_Page>().FromDate_Input("05/13/2019"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().ToDate_Input("05/13/2019"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().AutoFill_btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( Selenium.Driver.GetAttribute(GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_FromDateinput[i], "value", "Table_FromDateinput[" + i + "]"), "05/13/2019", "Checking for From Date Auto Fill functionlity", Name); ExtentReportLog( Selenium.Driver.GetAttribute(GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ToDateinput[i], "value", "Table_FromDateinput[" + i + "]"), "05/13/2019", "Checking for To Date Auto Fill functionlity", Name); } //Validating History Expand/ Shrink button GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_ExpandAll_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( Selenium.Driver.GetText(GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_HistoryShrinkBtn[i], "Table_HistoryShrinkBtn[" + i + "]"), "-", "Checking for expand functionlity", Name); } GetInstance <ApprenticeReadyTo_Report_Hours_Page>().TableHeader_ExpandAll_Btn(); for (int i = 0; i < (GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ApprenticeNameLnk).Count; i++) { ExtentReportLog( Selenium.Driver.GetText(GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_HistoryExpandBtn[i], "Table_HistoryExpandBtn[" + i + "]"), "+", "Checking for expand functionlity", Name); } //Validating Error messages: Date range should be with in the quarter of the year GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().PreferenceHours_RdoBtns("1"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Search_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().FromDate_Input("08/01/2018"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().ToDate_Input("11/01/2018"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().AutoFill_btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 0); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 1); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 2); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 3); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 4); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 5); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 6); List <string> _msg_ = new List <string>(); Thread.Sleep(3000); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Submit_ClickBtn(); Thread.Sleep(3000); _msg_ = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ErrorMessageInfo_Status_Check_Txt(); for (int i = 0; i < _msg_.Count; i++) { string[] txt_0 = _msg_[i].Split('('); string temp = txt_0[0].Substring(txt_0[0].IndexOf(' ')); string txt_1 = temp.Substring(temp.IndexOf(' ') + 1); ExtentReportLog(txt_1, "Date range should be with in the quarter of the year ", "CHECK", Name); } //Validating Error messages: Enter From/To date. GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 0); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 1); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 2); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 3); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 4); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 5); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 6); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Submit_ClickBtn(); _msg_ = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ErrorMessageInfo_Status_Check_Txt(); for (int i = 0; i < _msg_.Count; i++) { string[] txt_0 = _msg_[i].Split(':'); string temp = txt_0[0].Substring(txt_0[0].IndexOf(' ')); string txt_1 = temp.Substring(temp.IndexOf(' ') + 1); ExtentReportLog(txt_1, "Start Date and End Dates are required.", "CHECK", Name); } // Validating Error messages: From Date should not be earlier than begin date for apprentice GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Reset_Btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().FromDate_Input("01/01/2000"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().ToDate_Input("03/31/2000"); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().AutoFill_btn(); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 0); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 1); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 2); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 3); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 4); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 5); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_RSIPaid_Input("10", 6); GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Submit_ClickBtn(); _msg_ = GetInstance <ApprenticeReadyTo_Report_Hours_Page>().Table_ErrorMessageInfo_Status_Check_Txt(); for (int i = 0; i < _msg_.Count; i++) { string[] txt_0 = _msg_[i].Split(':'); string temp = txt_0[0].Substring(txt_0[0].IndexOf(' ')); string txt_1 = temp.Substring(temp.IndexOf(' ') + 1); ExtentReportLog(txt_1, "From Date should not be earlier than begin date for apprentice", "CHECK", Name); } //Validating page navigation functionality int n = 0; while (n != 4) { Thread.Sleep(3000); int Count = ((GetInstance <ActionItems_ProbationNearingCompletion_Page>().PageNavigationBtn).Count) - 2; GetInstance <ActionItems_ProbationNearingCompletion_Page>().PageNavigation_Btn(Count); ExtentReportLog( Selenium.Driver.GetAttribute( GetInstance <ActionItems_ProbationNearingCompletion_Page>().PageNavigationBtn[3], "disabled", "PageNavigation_Btn[3]"), "true", "Validating page navigation functionality", Name ); Thread.Sleep(2000); n++; } }