public XRow GetHeader() { var headerRow = new XRow() { Cells = new List <XCell>() }; headerRow.Cells.Add(new XCell() { Data = "First Name" }); headerRow.Cells.Add(new XCell() { Data = "Last Name" }); headerRow.Cells.Add(new XCell() { Data = "Position" }); headerRow.Cells.Add(new XCell() { Data = "Email" }); headerRow.Cells.Add(new XCell() { Data = "Geo" }); headerRow.Cells.Add(new XCell() { Data = "Org" }); return(headerRow); }
public XTable GetData() { var table = new XTable() { Rows = new List <XRow>() }; var headerRow = new XRow() { Cells = new List <XCell>() }; foreach (var col in Input.Columns) { if (col.Name == "TotalMarketSales") { headerRow.Cells.Add(new XCell() { Data = "Total Market Sales" }); } else if (col.Name == "RBSales") { headerRow.Cells.Add(new XCell() { Data = "Reckitt Benckiser Sales" }); } else { headerRow.Cells.Add(new XCell() { Data = col.Name }); } } table.Rows.Add(headerRow); foreach (var r in Input.Rows) { var row = new XRow() { Cells = new List <XCell>() }; foreach (string t in r.Values) { row.Cells.Add(new XCell() { Data = t }); } table.Rows.Add(row); } return(table); }
public void XRowShouldCompareProperlyCase7() { // arrange var text1 = "1.Apple"; var text2 = "1.AppleA"; // act var result = new XRow(text1).CompareTo(text2); // assert Assert.AreEqual(-1, result); }
public void GetBodyRow(XTable table) { if (Input != null && Input.Any()) { XRow bodyRow; foreach (var item in Input) { bodyRow = new XRow() { Cells = new List <XCell>() }; bodyRow.Cells.Add(new XCell() { Data = item.UserName }); bodyRow.Cells.Add(new XCell() { Data = item.FirstName }); bodyRow.Cells.Add(new XCell() { Data = item.LastName }); bodyRow.Cells.Add(new XCell() { Data = item.Position }); bodyRow.Cells.Add(new XCell() { Data = item.Email }); bodyRow.Cells.Add(new XCell() { Data = item.Role }); bodyRow.Cells.Add(new XCell() { Data = item.GeoCode }); bodyRow.Cells.Add(new XCell() { Data = item.Org }); bodyRow.Cells.Add(new XCell() { Data = item.ReceiveEmailAlert }); table.Rows.Add(bodyRow); } } }
public XMLIntegration(Integrator iIn) { rowCount = iIn.rowCount; blockCount = iIn.blockCount; indexCount = iIn.blockTypes.Length; types = System.Convert.ToBase64String(Serializer.serialize(iIn.blockTypes)); rows = new XRow[iIn.rowCount]; for (int i = 0; i < iIn.rowCount; i++) { var tr = new List <List <IElement> >(); for (int j = 0; j < iIn.blockCount; j++) { tr.Add(new List <IElement>(iIn.get_block(j, i))); } rows[i] = new XRow(tr); } }
public void GetBodyRow(XTable table) { if (Input == null || !Input.Any()) { return; } foreach (var item in Input) { var bodyRow = new XRow() { Cells = new List <XCell>() }; bodyRow.Cells.Add(new XCell() { Data = item.FirstName }); bodyRow.Cells.Add(new XCell() { Data = item.LastName }); bodyRow.Cells.Add(new XCell() { Data = item.Position }); bodyRow.Cells.Add(new XCell() { Data = item.Email }); bodyRow.Cells.Add(new XCell() { Data = item.GeoCode }); bodyRow.Cells.Add(new XCell() { Data = item.Org }); table.Rows.Add(bodyRow); } }
public XTable GetData() { var table = new XTable() { Rows = new List <XRow>() }; foreach (var r in Input.Rows) { var row = new XRow() { Cells = new List <XCell>() }; foreach (string t in r.Values) { row.Cells.Add(new XCell() { Data = t }); } table.Rows.Add(row); } return(table); }
public void SortShouldCreateSortedFile() { // arrange const string FileName = "TestFile4.txt"; const string DestinationFile = "SortedFile4.txt"; var options = new XFileGenerationOptions { FileName = FileName, Strings = Strings, MinNumber = MinNumber, MaxNumber = MaxNumber, FileSize = FileSize }; var xFile = new XFile(); xFile.Generate(options); // act xFile.Sort(FileName, DestinationFile); // assert using (var destinationFile = File.OpenText(DestinationFile)) { var str = String.Empty; XRow cur = null; XRow prev = null; while ((str = destinationFile.ReadLine()) != null) { cur = new XRow(str); if (prev != null) { Assert.IsTrue(prev.CompareTo(cur) <= 0); } prev = cur; } } }
public XTable GetData() { var table = new XTable() { Rows = new List <XRow>() }; var headerRow = new XRow() { Cells = new List <XCell>() }; Input.Columns.Where(x => x.Name != "IS_MERCK" || x.Name != "Ranking").ForEach(x => headerRow.Cells.Add(new XCell() { Data = x.Name })); table.Rows.Add(headerRow); var columnCount = Input.Rows[1].Values.Count; var columnIndexValuesWithEarliestYearForTop = new List <string>() { "6", "8", "10", "12", "14", "16", "17" }; var columnIndexValuesWithEarliestYearForBottom = new List <string>() { "2", "6", "8", "10", "12", "14", "16", "17" }; var columnIndexValuesWithoutEarliestYearForTop = new List <string>() { "4", "6", "8", "10", "12", "14", "15" }; var columnIndexValuesWithoutEarliestYearForBottom = new List <string>() { "2", "4", "6", "8", "10", "12", "14", "15" }; if (IsTopTable) { var rowcount = Input.Rows.Count; Input.Rows.RemoveRange(6, rowcount - 6); var indicesAvoidedList = columnCount == 16 ? columnIndexValuesWithoutEarliestYearForTop : columnIndexValuesWithEarliestYearForTop; foreach (var r in Input.Rows) { var row = new XRow() { Cells = new List <XCell>() }; for (int i = 0; i < r.Values.Count; i++) { if (indicesAvoidedList.Any(s => s.Equals(i.ToString()))) { continue; } else { row.Cells.Add(new XCell() { Data = GetFormattedValue(r.Values[i], AbsoluteThousandValue) }); } } table.Rows.Add(row); } } else { var indicesAvoidedList = columnCount == 16 ? columnIndexValuesWithoutEarliestYearForBottom : columnIndexValuesWithEarliestYearForBottom; foreach (var r in Input.Rows) { var row = new XRow() { Cells = new List <XCell>() }; for (int i = 0; i < r.Values.Count; i++) { if (indicesAvoidedList.Any(s => s.Equals(i.ToString()))) { continue; } else { row.Cells.Add(new XCell() { Data = GetFormattedValue(r.Values[i], AbsoluteThousandValue) }); } } //if (!UncheckedItems.Contains(r.Values[0])) //{ table.Rows.Add(row); //} } } return(table); }
public XTable GetData() { var table = new XTable() { Rows = new List <XRow>() }; var headerRow = new XRow() { Cells = new List <XCell>() }; foreach (var col in Input.Columns) { if (col.Name == "IS_Merck" || col.Name == "GeoLevel") { SkipColumns.Add(col.Position); continue; } if (col.Name == "Ranking") { headerRow.Cells.Add(new XCell() { Data = "Rank" }); continue; } if (col.Name == "Name" || col.Name == "Company/Brand") { headerRow.Cells.Add(new XCell() { Data = NameColumnValue }); continue; } if (col.Name == "Total Units Sales") { headerRow.Cells.Add(new XCell() { Data = MeasureText + " Sales" }); continue; } headerRow.Cells.Add(new XCell() { Data = col.Name }); } table.Rows.Add(headerRow); Input = GetProperRanking(Input); foreach (var r in Input.Rows) { var row = new XRow() { Cells = new List <XCell>() }; for (int i = 0; i < r.Values.Count; i++) { string spaces = ""; if (SkipColumns.Contains(i)) { continue; } if (r.Level == 1) { spaces = " "; } else if (r.Level == 2) { spaces = " "; } else if (r.Level == 3) { spaces = " "; } else if (r.Level == 4) { spaces = " "; } row.Cells.Add(new XCell() { Data = spaces + r.Values[i] }); } if (NameColumnValue == "Market/Region") { if (r.Level == 1 || r.Level == 2 || r.Level == 3) { row.Cells.Add(new XCell() { Data = "GREEN" }); } else { row.Cells.Add(new XCell() { Data = "NONE" }); } } else if (NameColumnValue == "Market/Company") { if (r.Level == 1 || r.Level == 2) { row.Cells.Add(new XCell() { Data = "GREEN" }); } else { row.Cells.Add(new XCell() { Data = "NONE" }); } } else if (NameColumnValue == "Market/Brand") { if (r.Level == 1 || r.Level == 2) { row.Cells.Add(new XCell() { Data = "GREEN" }); } else { row.Cells.Add(new XCell() { Data = "NONE" }); } } else if (NameColumnValue == "Locations by Market") { if (r.Level == 1 && (r.Values.Last() == "1" || r.Values.Last() == "2" || r.Values.Last() == "3")) { row.Cells.Add(new XCell() { Data = "GREEN" }); } else { row.Cells.Add(new XCell() { Data = "NONE" }); } } table.Rows.Add(row); } return(table); }