Exemplo n.º 1
0
        public IList <CTableRow> Convert(KView kView)
        {
            var rows = new List <CTableRow>();

            var sl = OpenSpreadsheet(kView);
            //var sl = new SLDocument((kView.SampleDataExcelFile);
            //sl.SelectWorksheet("");

            var colPrimaryKey      = kView.GeneratedView.Column.First(c => c.IsPrimaryKey);
            var colPrimaryKeyIndex = GetColumnIndex(sl, colPrimaryKey.ColumnName);

            var currentRow = 2;

            while (!string.IsNullOrEmpty(sl.GetCellValueAsString(currentRow, colPrimaryKeyIndex)))
            {
                var row = new CTableRow();
                foreach (var viewCol in kView.GeneratedView.Column)
                {
                    var col = GetColumnIndex(sl, viewCol.ColumnName);
                    if (col < 1)
                    {
                        continue;
                    }
                    var value = sl.GetCellValueAsString(currentRow, col);
                    row.RowData.Add(new CTableRowData {
                        Column = viewCol, Value = value
                    });
                }
                currentRow++;
                rows.Add(row);
            }


            return(rows);
        }
Exemplo n.º 2
0
        public CTable Convert(KView view)
        {
            var table = new CTable(DataStoreTypes.Unknown);

            table.Schema    = view.Schema;
            table.Column    = new List <CColumn>();
            table.TableName = view.ViewName;
            foreach (var col in view.Column)
            {
                var tableColumn = new CColumn(table)
                {
                    IsPrimaryKey    = col.IsPrimaryKey,
                    IsIdentity      = col.IsIdentity,
                    IsNullable      = col.IsNullable,
                    IsIndexed       = col.IsIndexed,
                    IsUnique        = col.IsUnique,
                    ColumnName      = col.ColumnName,
                    ColumnType      = col.ColumnType,
                    ColumnSqlDbType = col.ColumnSqlDbType,
                    ColumnTypeRaw   = col.ColumnTypeRaw,
                    ColumnLength    = col.ColumnLength
                };

                if (col.ForeignKeyColumn != null)
                {
                    foreach (var fk in col.ForeignKeyColumn)
                    {
                        tableColumn.ForeignKeyColumn.Add(
                            new CColumn(new CTable(DataStoreTypes.Unknown)
                        {
                            Schema = new CSchema {
                                SchemaName = fk.View.Schema.SchemaName
                            },
                            TableName = fk.View.ViewName
                        })
                        {
                            ColumnName      = fk.ColumnName,
                            ColumnType      = fk.ColumnType,
                            ColumnSqlDbType = fk.ColumnSqlDbType,
                            ColumnLength    = fk.ColumnLength,
                            ColumnTypeRaw   = fk.ColumnTypeRaw
                        }
                            );
                    }
                }
                table.Column.Add(tableColumn);
            }
            foreach (var row in view.Row)
            {
                var tableRow = new CTableRow();
                foreach (var rowData in row.RowData)
                {
                    var tableRowData = new CTableRowData
                    {
                        Column = table.Column.FirstOrDefault(c => c.ColumnName == rowData.Column.ColumnName),
                        Value  = rowData.Value
                    };
                    tableRow.RowData.Add(tableRowData);
                }
                table.Row.Add(tableRow);
            }
            return(table);
        }
Exemplo n.º 3
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public void DeleteEmptyTableCells(CTableRow TableRow, Boolean SetColumnSpan)
 {
 }
Exemplo n.º 4
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public Integer Add(CTableRow Row)
 {
     return null;
 }
Exemplo n.º 5
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public CControlTableCell Select(CTableRow Row, Integer ColumnIndex, Integer Len)
 {
     return null;
 }
Exemplo n.º 6
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public CControlTableCell Select(CTableRow Row)
 {
     return null;
 }
Exemplo n.º 7
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public void Merge(CTableRow Row, Integer StartCellInex, Integer LenX)
 {
 }
Exemplo n.º 8
0
Arquivo: CTable.cs Projeto: TheJP/Stne
 public void Merge(CTableRow Row)
 {
 }