public void combineXML(string[] filenames) { // create a temporary dataset DataSetCollection multiSetXml = new DataSetCollection(); // load the xml files into the dataset for (int i = 0; i < filenames.Length;i++ ) { DataSet tempDS = new DataSet(); tempDS.ReadXml(filenames[i]); multiSetXml.Add(tempDS); } // combine the tables into one big table currentDataSet = combineDataSets(multiSetXml); // display that table in the main window for review form.setDataSource(currentDataSet); }
public void printReport3() { if (currentDataSet != null) { currentDataSet.AcceptChanges(); string containsNull = validateRows(currentDataSet); if (containsNull != null) { // don't categorizeRows without filling in info. MessageBox.Show(form, "Check that the Company and Account fields in the highlighted row are accurate." , "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); form.highlightRow(containsNull); } else { //TODO: What is this for? //currentDataSet.Tables[0].Columns["Company"].DataType = Type.GetType("System.String"); //DataRow[] rowsCopy = new DataRow[currentDataSet.Tables[0].Rows.Count]; //currentDataSet.Tables[0].Rows.CopyTo(rowsCopy, 0); // resolve Split transactions into their splits DataSet tempDS = resolveSplits(currentDataSet); //tempdataset = //// create a temporary dataset // DataSetCollection dataSetArray = new DataSetCollection(); DataSetCollection dsColl = new DataSetCollection(); dsColl.Add(createAudit("Company", tempDS)); dsColl.Add(createAudit("Cardholder Name", tempDS)); //initDataSet(tempDataSet); // create a viewer window, populate the data, and display it. ReportPrinter rp = new ReportPrinter(this, dsColl, "Trillium_CC_Allocation.report3.xsl", "Trillium_CC_Allocation.report3a.xsl", chartOfAccounts.Tables["Companies"], 3); rp.ShowDialog(form); } } else { MessageBox.Show(form, "Combine XML files before trying to print.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private DataSetCollection categorizeRows(string sortColumn1, string sortColumn2, string sortColumn3, DataSet dataSet) { // Create the query. var transaction = from DataRow row in dataSet.Tables["Allocation"].Rows orderby row[sortColumn1] ascending, row[sortColumn2] ascending, row[sortColumn3] ascending group row by row[sortColumn1] into newGroup orderby newGroup.Key select newGroup; // create a temporary dataset DataSetCollection dataSetArray = new DataSetCollection(); foreach (var rowGroup in transaction) { DataSet tempDS = dataSet.Clone(); tempDS.ExtendedProperties["user"] = rowGroup.Key.ToString(); foreach (var row in rowGroup) { tempDS.Tables["Allocation"].ImportRow(row); foreach(DataRow sRow in dataSet.Tables["Split"].Rows) { //TODO: Does this actually do anything? if(sRow["ChargeID"] == ((DataRow)row)["ChargeID"]) { tempDS.Tables["Split"].ImportRow(sRow); } } } dataSetArray.Add(tempDS); } return dataSetArray; }
public void printDataGrid() { if (currentDataSet != null) { currentDataSet.AcceptChanges(); string containsNull = validateRows(currentDataSet); if (containsNull != null) { // Warn about empty rows MessageBox.Show(form, "Not all Company and Account fields are accurate.\r\n\r\nCheck that the Company and Account fields in the \r\nhighlighted row are accurate before submitting." , "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); form.highlightRow(containsNull); } DataSetCollection dsColl = new DataSetCollection(); dsColl.Add(currentDataSet); // create a viewer window, populate the data, and display it. ReportPrinter rp = new ReportPrinter(this, dsColl, "Trillium_CC_Allocation.report1.xsl", null, 1); rp.ShowDialog(form); } else { MessageBox.Show(form, "Open a file before trying to print.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }