Beispiel #1
0
        private void RectangularCorrectionWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            RectangularCorrectionWindow rectangularCorrectionWindow = (RectangularCorrectionWindow)sender;

            int i;
            for (i = result.columns - 1; i > rectangularCorrectionWindow.SelectedColumn; --i)
            {
                Data.Columns.RemoveAt(i);
            }

            if (rectangularCorrectionWindow.ShorterRecords == 1 || rectangularCorrectionWindow.LongerRecords == 1)
            {
                for (i = Data.Rows.Count - 1; i >= 0; --i)
                {
                    int length = result.recordsLength[i];
                    if (rectangularCorrectionWindow.LongerRecords == 1 && length > rectangularCorrectionWindow.SelectedColumn + 1)
                    {
                        Data.Rows[i].Delete();
                    }
                    else if (rectangularCorrectionWindow.ShorterRecords == 1 && length < rectangularCorrectionWindow.SelectedColumn + 1)
                    {
                        Data.Rows[i].Delete();
                    }
                }
            }

            ColumnsSelectWindow columnsSelectWindow = new ColumnsSelectWindow(Data.Columns.Cast<DataColumn>().Select(y => y.ColumnName).ToArray());
            columnsSelectWindow.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ColumnsSelectWindow_FormClosing);
            columnsSelectWindow.Show();
        }
Beispiel #2
0
        private void ImportCsvWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            ImportCsvWindow importWindow = (ImportCsvWindow)sender;
            result = importWindow.Data;
            Data = (DataTable)result;

            if (result != null)
            {
                if (result.IsPartial())
                {
                    throw new GeneralException();
                }

                if (!result.IsValid())
                {
                    RectangularCorrectionWindow rectangularCorrectionWindow = new RectangularCorrectionWindow(result.columnNames, result.GetMostFrequentRecordLength()-1);
                    rectangularCorrectionWindow.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RectangularCorrectionWindow_FormClosing);
                    rectangularCorrectionWindow.Show();
                }
                else
                {
                    ColumnsSelectWindow columnsSelectWindow = new ColumnsSelectWindow(Data.Columns.Cast<DataColumn>().Select(y => y.ColumnName).ToArray());
                    columnsSelectWindow.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ColumnsSelectWindow_FormClosing);
                    columnsSelectWindow.Show();
                }
            }
        }