本文整理汇总了C#中BaseColumn类的典型用法代码示例。如果您正苦于以下问题:C# BaseColumn类的具体用法?C# BaseColumn怎么用?C# BaseColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseColumn类属于命名空间,在下文中一共展示了BaseColumn类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UOMExportExcelButton_Click
// Event handler for ImageButton .
public virtual void UOMExportExcelButton_Click(object sender, ImageClickEventArgs args)
{
try {
// Enclose all database retrieval/update code within a Transaction boundary
DbUtils.StartTransaction();
// To customize the columns or the format, override this function in Section 1 of the page
// and modify it to your liking.
// Build the where clause based on the current filter and search criteria
// Create the Order By clause based on the user's current sorting preference.
WhereClause wc = null;
wc = CreateWhereClause();
OrderBy orderBy = null;
orderBy = CreateOrderBy();
bool done = false;
string val = "";
CompoundFilter join = CreateCompoundJoinFilter();
// Read pageSize records at a time and write out the Excel file.
int totalRowsReturned = 0;
this.TotalRecords = UOMTable.GetRecordCount(join, wc);
if (this.TotalRecords > 10000)
{
// Add each of the columns in order of export.
BaseColumn[] columns = new BaseColumn[] {
UOMTable.UOMName,
UOMTable.UOMDescription,
UOMTable.Status,
null};
ExportDataToCSV exportData = new ExportDataToCSV(UOMTable.Instance,wc,orderBy,columns);
exportData.StartExport(this.Page.Response, true);
DataForExport dataForCSV = new DataForExport(UOMTable.Instance, wc, orderBy, columns,join);
// Read pageSize records at a time and write out the CSV file.
while (!done)
{
ArrayList recList = dataForCSV.GetRows(exportData.pageSize);
if (recList == null)
break; //we are done
totalRowsReturned = recList.Count;
foreach (BaseRecord rec in recList)
{
foreach (BaseColumn col in dataForCSV.ColumnList)
{
if (col == null)
continue;
if (!dataForCSV.IncludeInExport(col))
continue;
val = rec.GetValue(col).ToString();
exportData.WriteColumnData(val, dataForCSV.IsString(col));
}
exportData.WriteNewRow();
}
// If we already are below the pageSize, then we are done.
if (totalRowsReturned < exportData.pageSize)
{
done = true;
}
}
exportData.FinishExport(this.Page.Response);
}
else
{
// Create an instance of the ExportDataToExcel class with the table class, where clause and order by.
ExportDataToExcel excelReport = new ExportDataToExcel(UOMTable.Instance, wc, orderBy);
// Add each of the columns in order of export.
// To customize the data type, change the second parameter of the new ExcelColumn to be
// a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00"
if (this.Page.Response == null)
return;
excelReport.CreateExcelBook();
int width = 0;
int columnCounter = 0;
DataForExport data = new DataForExport(UOMTable.Instance, wc, orderBy, null,join);
data.ColumnList.Add(new ExcelColumn(UOMTable.UOMName, "Default"));
data.ColumnList.Add(new ExcelColumn(UOMTable.UOMDescription, "Default"));
data.ColumnList.Add(new ExcelColumn(UOMTable.Status, "Default"));
// First write out the Column Headers
foreach (ExcelColumn col in data.ColumnList)
{
width = excelReport.GetExcelCellWidth(col);
if (data.IncludeInExport(col))
{
excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col));
//.........这里部分代码省略.........
示例2: GetSum
public static string GetSum(
BaseColumn col,
BaseFilter join,
WhereClause where,
OrderBy orderBy,
int pageIndex,
int pageSize)
{
SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);
return UsersTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), null, orderBy, pageIndex, pageSize);
}
示例3: GetValues
public static String[] GetValues(
BaseColumn col,
BaseFilter join,
WhereClause where,
OrderBy orderBy,
int maxItems)
{
// Create the filter list.
SqlBuilderColumnSelection retCol = new SqlBuilderColumnSelection(false, true);
retCol.AddColumn(col);
return UsersTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), null, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems);
}
示例4: GetDFKA
/// <summary>
/// This method takes a record and a Column and returns an evaluated value of DFKA formula.
/// </summary>
public static string GetDFKA(BaseRecord rec, BaseColumn col)
{
ForeignKey fkColumn = UsersTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col);
if (fkColumn == null)
return null;
String _DFKA = fkColumn.PrimaryKeyDisplayColumns;
if (_DFKA.Trim().StartsWith("="))
{
// if the formula is in the format of "= <Primary table>.<Field name>, then pull out the data from the rec object instead of doing formula evaluation
string tableCodeName = fkColumn.PrimaryKeyTableDefinition.TableCodeName;
string column = _DFKA.Trim('=').Trim();
if (column.StartsWith(tableCodeName + ".", StringComparison.InvariantCultureIgnoreCase))
{
column = column.Substring(tableCodeName.Length + 1);
}
foreach (BaseColumn c in fkColumn.PrimaryKeyTableDefinition.Columns)
{
if (column == c.CodeName)
{
return rec.Format(c);
}
}
String tableName = fkColumn.PrimaryKeyTableDefinition.TableCodeName;
return EvaluateFormula(_DFKA, rec, null, tableName);
}
else
return null;
}
示例5: ExportData
public ExportData(BaseTable tbl, WhereClause wc, OrderBy orderBy, BaseColumn[] columns)
{
_exportDataToCSV = new ExportDataToCSV(tbl, wc, orderBy, columns);
}
示例6: GetCount
public static string GetCount(
BaseColumn col,
WhereClause where,
OrderBy orderBy,
int pageIndex,
int pageSize)
{
SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count);
return EstimateTable.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize);
}
示例7: GetDataForExport
public string GetDataForExport(BaseColumn col, BaseRecord rec)
{
String val = "";
if (col.TableDefinition.IsExpandableNonCompositeForeignKey(col))
{
// Foreign Key column, so we will use DFKA and String type.
val = rec.Format(col);
}
else
{
switch (col.ColumnType)
{
case BaseColumn.ColumnTypes.Binary:
case BaseColumn.ColumnTypes.Image:
break;
case BaseColumn.ColumnTypes.Currency:
case BaseColumn.ColumnTypes.Number:
case BaseColumn.ColumnTypes.Percentage:
val = rec.Format(col);
break;
default:
val = rec.Format(col);
break;
}
}
return val;
}
示例8: ExcelColumn
/// <summary>
/// Cretes new ExcelColumn
/// </summary>
/// <param name="col">BaseColumn</param>
/// <param name="format">a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00"</param>
public ExcelColumn(BaseColumn col, string format)
{
DisplayColumn = col;
DisplayFormat = format;
}
示例9: ExportDataToCSV
public ExportDataToCSV(BaseTable tbl, WhereClause wc, OrderBy orderBy, BaseColumn[] columns, String header)
: base(header)
{
data = new DataForExport(tbl, wc, orderBy, columns);
}
示例10: IsString
public bool IsString(BaseColumn col)
{
if (col == null)
return false;
switch (col.ColumnType)
{
case BaseColumn.ColumnTypes.Binary:
case BaseColumn.ColumnTypes.Image:
case BaseColumn.ColumnTypes.Currency:
case BaseColumn.ColumnTypes.Number:
case BaseColumn.ColumnTypes.Percentage:
return false;
}
return true;
}
示例11: IncludeInExport
public bool IncludeInExport(BaseColumn col)
{
if (col == null)
return false;
switch (col.ColumnType)
{
case BaseColumn.ColumnTypes.Binary:
case BaseColumn.ColumnTypes.Image:
// Skip - do nothing for these columns
return false;
}
return true;
}
示例12: DataForExport
public DataForExport(BaseTable tbl, WhereClause wc, OrderBy orderBy, BaseColumn[] columns, BaseFilter join)
{
this.DBTable = tbl;
this.SelectWhereClause = wc;
this.SelectOrderBy = orderBy;
this.SelectJoin = join;
if (columns != null)
ColumnList.AddRange(columns);
}
示例13: GetSum
public static string GetSum(
BaseColumn col,
WhereClause where,
OrderBy orderBy,
int pageIndex,
int pageSize)
{
SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);
return VwPropSBondBudgetView.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize);
}