private static void ExportARowTitle(DataItems.DataEnum item, int row, int col, X.Worksheet ws) { string title = item.FullTitle; ws.Cells[row, col] = title; }
private static void ConfigItem(DataItems.DataEnum i, string title1, string title2, EFieldSource source, RevisionDataDisplay display) { i.Source = source; i.Display = display; ConfigItem((DataItems.RootEnum)i, title1, title2); }
private static List <List <string> > AggregateData(RevisionData selected, RevOrderMgr om, DataItems.DataEnum field) { // rows x columns List <List <string> > rawTableData = FormatTableData(selected, om); List <List <string> > finalTableData = new List <List <string> >(); int newRow = 0; int maxRawRows = rawTableData.Count; finalTableData.Add(rawTableData[0].Clone()); for (int i = 1; i < rawTableData.Count; i++) { bool result = true; foreach (DataItems.DataEnum item in om.SortOrder.Columns) { if (item.Equals(field)) { continue; } if (!rawTableData[i - 1][item.DataIdx]. Equals(rawTableData[i][item.DataIdx])) { finalTableData.Add(rawTableData[i].Clone()); newRow++; result = false; break; } } if (result) { if (!finalTableData[newRow][field.DataIdx] .Equals(rawTableData[i][field.DataIdx])) { finalTableData[newRow][field.DataIdx] += nl + rawTableData[i][field.DataIdx]; } } } Console.WriteLine("raw table data"); ListTableData(rawTableData); Console.Write(nl); Console.WriteLine("final table data"); ListTableData(finalTableData); return(finalTableData); }
// public static bool SortSelected(params ISortable[] d) // { // if (_selected.Count == 0) return false; // // foreach (RevisionDataFields rdf in _selected) // { // string key = GetKey(rdf, d); // // rdf.SortKey = key; // } // // _selected.Sort(); // // return true; // } public static string GetKey(RevisionDataFields items, RevOrderMgr om) { string key = null; int i = 0; foreach (DataItems.ISortable so in om.SortOrder.Iterate()) { DataItems.DataEnum d = ((DataItems.DataEnum)so); key += RevisionFormat.FormatForKey(items[d.DataIdx], d.Display); if (++i != om.SortOrder.Count) { key += "|"; } } return(key); }
// has two purposes: // translate the data read to the correct format // basically nothing for most // put the data in the correct order // [i] = is the order from the above // [j] = the correct order in the array private static RevisionDataFields MakeRevDataItem(dynamic[] items) { RevisionDataFields df = new RevisionDataFields(); df.Order = count++; for (int i = 0; i < items.Length; i++) { DataItems.DataEnum d = xlate[i]; int j = d.DataIdx; switch (i) { // selected case 0: { df[j] = bool.Parse(items[i]); break; } // rev order code case 2: { RevOrderCode rc = new RevOrderCode(); rc.AltId = items[i++]; REV_SUB_ALTID.Display.DataWidth = rc.AltId.Length; rc.TypeCode = items[i++]; REV_SUB_TYPE_CODE.Display.DataWidth = rc.TypeCode.Length; rc.DisciplineCode = items[i]; REV_SUB_DISCIPLINE_CODE.Display.DataWidth = rc.DisciplineCode.Length; df[j] = rc; items[i] = rc; break; } // sequence case 1: // tag elem id case 13: // cloud elem id case 14: { df[j] = Int32.Parse(items[i]); break; } // visibility case 7: { df[j] = Enum.Parse(typeof(RevisionVisibility), items[i]); break; } // date case 10: { df[j] = DateTime.Parse(items[i]); break; } default: // all else - string { df[j] = items[i]; break; } } d.Display.DataWidth = (items[i]?.ToString() ?? "").Length; } // "fix" the type code and the disc code df = UpdateCodes(df); // CompareCodes(df); return(df); }