public SEDataTable(DefaultColumns defaultColumns) { switch (defaultColumns) { case DefaultColumns.TextValue: AddColumns("Text", "Value"); break; } }
protected void Page_Load(object sender, EventArgs e) { List <string> Columns = DefaultColumns.ToList <string>(); Columns.Insert(0, "ID"); Session["ToDelete"] = Request.Form["ID"]; Session["UserDelTable"] = GetTable( SELECTAll($"ID={Session["ToDelete"]}"), Columns.ToArray(), new string[] { "admin" }); }
protected override IEnumerable <IRow> Produce() { var inputRows = InputGenerator.Invoke(this); if (Columns != null) { var initialValues = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); if (CopyOnlySpecifiedColumns) { foreach (var inputRow in inputRows) { if (Context.IsTerminating) { yield break; } foreach (var columnKvp in Columns) { var value = columnKvp.Value.Process(this, inputRow[columnKvp.Value.SourceColumn ?? columnKvp.Key]); initialValues[columnKvp.Key] = value; } var newRow = Context.CreateRow(this, initialValues); newRow.Tag = inputRow.Tag; yield return(newRow); initialValues.Clear(); } } else { var columnMap = Columns != null ? new Dictionary <string, ReaderColumn>(Columns, StringComparer.InvariantCultureIgnoreCase) : null; foreach (var inputRow in inputRows) { if (Context.IsTerminating) { yield break; } foreach (var columnKvp in Columns) { var value = columnKvp.Value.Process(this, inputRow[columnKvp.Value.SourceColumn ?? columnKvp.Key]); initialValues[columnKvp.Key] = value; } foreach (var valueKvp in inputRow.Values) { if (!columnMap.ContainsKey(valueKvp.Key.ToUpperInvariant())) { if (DefaultColumns != null) { var value = DefaultColumns.Process(this, valueKvp.Value); initialValues[valueKvp.Key] = value; } else { initialValues[valueKvp.Key] = valueKvp.Value; } } } var newRow = Context.CreateRow(this, initialValues); newRow.Tag = inputRow.Tag; yield return(newRow); initialValues.Clear(); } } } else { foreach (var row in inputRows) { if (Context.IsTerminating) { yield break; } yield return(Context.CreateRow(this, row)); } } }