86 lines
2.3 KiB
C#
86 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
|
|
namespace WMS.Ctrl
|
|
{
|
|
/// <summary>
|
|
/// 列信息
|
|
/// </summary>
|
|
public class ColumnsList
|
|
{
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
public ColumnsList()
|
|
{
|
|
Check = false;
|
|
IsSum = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 选择
|
|
/// </summary>
|
|
public bool Check { get; set; }
|
|
|
|
/// <summary>
|
|
/// 字段名称
|
|
/// </summary>
|
|
public string FieldName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 列标题
|
|
/// </summary>
|
|
public string Caption { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否汇总
|
|
/// </summary>
|
|
public bool IsSum { get; set; }
|
|
|
|
/// <summary>
|
|
/// 列排序
|
|
/// </summary>
|
|
public int VisibleIndex { get; set; }
|
|
|
|
/// <summary>
|
|
/// 列排序
|
|
/// </summary>
|
|
public string ColumnType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 加载列信息
|
|
/// </summary>
|
|
/// <param name="gv"></param>
|
|
public List<ColumnsList> LoadQueryColumn(GridView gv)
|
|
{
|
|
List<ColumnsList> mycolList = new List<ColumnsList>();
|
|
|
|
for (int col = 0; col < gv.Columns.Count; col++)
|
|
{
|
|
if (gv.Columns[col].Visible == true)
|
|
{
|
|
ColumnsList item = new ColumnsList();
|
|
item.FieldName = gv.Columns[col].FieldName;
|
|
item.Caption = gv.Columns[col].GetTextCaption();
|
|
item.VisibleIndex = gv.Columns[col].VisibleIndex;
|
|
item.ColumnType = "string";
|
|
if (gv.Columns[col].ColumnType == typeof(int)
|
|
|| gv.Columns[col].ColumnType == typeof(Decimal)
|
|
|| gv.Columns[col].ColumnType == typeof(System.Nullable<int>)
|
|
|| gv.Columns[col].ColumnType == typeof(System.Nullable<System.Decimal>))
|
|
{
|
|
item.IsSum = true;
|
|
item.ColumnType = "Decimal";
|
|
}
|
|
mycolList.Add(item);
|
|
}
|
|
}
|
|
|
|
return mycolList;
|
|
}
|
|
}
|
|
}
|