internal void RefreshInstances() { instanceDataGridView.SelectionChanged -= instanceDataGridView_SelectionChanged; try { var instance = GetSelectedProcessInstance(); var instances = K2Client.Instance.WorkflowManager.GetProcessInstances(this.ProcSet.ProcSetID); var bindingSource = new BindingSource(); bindingSource.DataSource = DataTableCreator.GetDataTable(instances); instanceBindingNavigator.BindingSource = bindingSource; instanceDataGridView.DataSource = bindingSource; instanceDataGridView.Tag = instances; if (instance != null) { var rowToSelect = (from r in instanceDataGridView.Rows.Cast <DataGridViewRow>() where Convert.ToInt32(r.Cells[Constants.DataTable.Instance.Id].Value).Equals(instance.ID) select r).FirstOrDefault(); if (rowToSelect != null) { rowToSelect.Selected = true; } } ProcessInstanceSelected(); } finally { instanceDataGridView.SelectionChanged += instanceDataGridView_SelectionChanged; } }
public void GenerateDataAccordingToLastButtonPressed() { int buttonPressed = GetLastButtonPressed(); if (buttonPressed >= 10) { buttonPressed = buttonPressed - 10; ItemsToFetch itemsToFetch = (ItemsToFetch)buttonPressed; int orderId = GetSelectedOrderIdFromSession(); var data = _factory.FetchOrderItemData(itemsToFetch, orderId); _dataTable = DataTableCreator.ToDataTable(data.Cast <ITEM>().ToList()); } else { OrdersToFetch ordersToFetch = (OrdersToFetch)buttonPressed; var data = _factory.FetchDataForAdmin(ordersToFetch); _dataTable = DataTableCreator.ToDataTable(data.Cast <ORDERS>().ToList()); } }
public DataSet ReadOrderFile(FileInfo file, CsvReaderConfiguration config) { var csvHelperConfig = new CsvHelper.Configuration.CsvConfiguration { SkipEmptyRecords = config.SkipEmptyRecords, ThrowOnBadData = true }; var result = DataTableCreator.CreateDataSetForConfig(config); using (var parser = new CsvParser(file.OpenText(), csvHelperConfig)) { while (true) { if (config.SkipHeader) { SkipFirstHeaderLine(parser); } var row = parser.Read(); if (row == null) { break; } var recordType = recordSelector.SelectRecordForRow(config.CsvRecords, config, row); var table = result.Tables[recordType.TableName]; var newRow = table.NewRow(); CsvFieldMapper.Mapfields(row, recordType, newRow); table.Rows.Add(newRow); } } return(result); }
/// <summary> /// Creates a DataTable from an IEnumerable /// </summary> /// <typeparam name="TSource">The Generic type of the Collection</typeparam> /// <param name="Collection"></param> /// <returns>DataTable</returns> public static DataTable AsDataTable <TSource>(this IEnumerable <TSource> Collection) { DataTable dt = DataTableCreator <TSource> .GetDataTable(); Func <TSource, object[]> Map = DataRowMapperCache <TSource> .GetDataRowMapper(dt); foreach (TSource item in Collection) { dt.Rows.Add(Map(item)); } return(dt); }
private void RefreshActivities() { var instance = GetSelectedProcessInstance(); var activities = K2Client.Instance.WorkflowManager.GetProcActivities(instance?.ProcID); var bindingSource = new BindingSource(); bindingSource.DataSource = DataTableCreator.GetDataTable(activities); activitiesBindingNavigator.BindingSource = bindingSource; activitiesDataGridView.DataSource = bindingSource; activitiesDataGridView.Tag = activities; }
internal Capability[] CreateCapabilities() { if (anchetypeTable == null) { anchetypeTable = DataTableCreator.Create(csvFile, "ArchetypeTable"); } List <Capability> list = new List <Capability>(4); DataRow row = anchetypeTable.Select("ID = '" + id + "'")[0]; int columnCount = anchetypeTable.Columns.Count; for (int i = 1; i < columnCount; i++) { string columnName = anchetypeTable.Columns[i].ColumnName; var capability = creators[columnName](row, ref i); if (capability != null) { list.Add(capability); } } return(list.ToArray()); }
private Attachment CreatePDF(List <ITEM> items) { DataTable table = DataTableCreator.ToDataTable(items); MemoryStream memoryStream = new MemoryStream(); Document document = new Document(PageSize.A4, 10f, 10f, 10f, 10f); PdfWriter writer = PdfWriter.GetInstance(document, memoryStream); //PdfWriter writer2 = PdfWriter.GetInstance(document, new FileStream(Path.GetTempPath() + "/myFile2.pdf", FileMode.OpenOrCreate)); PdfPTable pdfTable = new PdfPTable(5); pdfTable = AddHeaders(pdfTable, table); pdfTable = AddRowData(pdfTable, table); int totalPrice = CalculateTotalPrice(table); document = FormatInvoice(document, pdfTable, totalPrice); //string path = Path.Combine(Path.GetTempPath(), "myFile.pdf"); //StreamWriter sWriter = new StreamWriter(path); //sWriter.Write(memoryStream); //sWriter.Close(); writer.CloseStream = false; //writer2.CloseStream = false; document.Close(); memoryStream.Position = 0; Attachment attachment = new Attachment(memoryStream, "festo-invoice.pdf"); return(attachment); }
public DataSet ReadOrderFile(FileInfo file, FlatFileReaderConfiguration configuration) { var dataset = DataTableCreator.CreateDataSetForConfig(configuration); //using (var parser = new FlatFileParser(file.OpenText())) //{ // while (true) // { // var row = parser.Read(); // if (row == null) // { // break; // } // var recordType = recordSelector.SelectRecordForRow(config.CsvRecords, config, row); // var table = result.Tables[recordType.TableName]; // var newRow = table.NewRow(); // CsvFieldMapper.Mapfields(row, recordType, newRow); // table.Rows.Add(newRow); // } //} //return result; return(dataset); }
private void SetupSut() { _sut = new DataTableCreator(_tableName, _columnOptions); }
private void Awake() { spawnTable = DataTableCreator.Create(csvFile, "SpawnTable"); }