using System; using System.Collections.Generic; using System.Linq; using System.Text; using DevExpress.XtraGrid.Views.Grid; namespace WMS.Ctrl { /// /// 列信息 /// public class ColumnsList { /// /// 构造函数 /// public ColumnsList() { Check = false; IsSum = false; } /// /// 选择 /// public bool Check { get; set; } /// /// 字段名称 /// public string FieldName { get; set; } /// /// 列标题 /// public string Caption { get; set; } /// /// 是否汇总 /// public bool IsSum { get; set; } /// /// 列排序 /// public int VisibleIndex { get; set; } /// /// 列排序 /// public string ColumnType { get; set; } /// /// 加载列信息 /// /// public List LoadQueryColumn(GridView gv) { List mycolList = new List(); 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) || gv.Columns[col].ColumnType == typeof(System.Nullable)) { item.IsSum = true; item.ColumnType = "Decimal"; } mycolList.Add(item); } } return mycolList; } } }