List <FormReportColumSetting> ParseListView(ListView.ListViewItemCollection rows) { var result = new List <FormReportColumSetting>(); foreach (ListViewItem row in rows) { var item = row.SubItems; var obj = new FormReportColumSetting(); obj.GUID = item[0].Text.TrimString(); obj.Sequence = int.Parse(item[1].Text.TrimString()); obj.ColumName = item[2].Text.TrimString(); obj.ColumNote = item[3].Text.TrimString() + //防止列明重复 (rows.Cast <ListViewItem>().Count(a => a.SubItems[2].Text == row.SubItems[2].Text) > 1 ? "" : ""); obj.TableName = item[4].Text.TrimString(); obj.IsHidden = bool.Parse(item[5].Text.TrimString()); obj.IsPrimaryKey = bool.Parse(item[6].Text.TrimString()); obj.Type = item[7].Text.TrimString();; obj.Length = item[8].Text.TrimString();; obj.CanNull = bool.Parse(item[9].Text.TrimString()); obj.DefaultValue = item[10].Text.TrimString(); obj.ForeignKey = item[11].Text.TrimString(); obj.ForeignTable = item[12].Text.TrimString(); obj.ControlType = item[13].Text.TrimString().ToControlType(); obj.Regex = item[14].Text.TrimString(); obj.QuerType = item[15].Text.TrimString().ToQueryType(); obj.IsSelectItem = bool.Parse(item[16].Text.TrimString()); result.Add(obj); } return(result); }
private void lv_colums_SelectedIndexChanged(object sender, EventArgs e) { var item = GetSelectedRow(lv_colums); if (item.Any()) { /* * * GUID 列名 说明 表 不显示 主键 字段类型 长度 * 0 1 2 3 4 5 6 7 * 允许空 默认值 外键列明 外键表名 * 8 9 10 11 * */ { #region 赋值 var obj = new FormReportColumSetting(); obj.GUID = item[0]; obj.Sequence = int.Parse(item[1]); obj.ColumName = item[2]; obj.ColumNote = item[3]; obj.TableName = item[4]; obj.IsHidden = bool.Parse(item[5]); obj.IsPrimaryKey = bool.Parse(item[6]); obj.Type = item[7]; obj.Length = item[8]; obj.CanNull = bool.Parse(item[9]); obj.DefaultValue = item[10]; obj.ForeignKey = item[11]; obj.ForeignTable = item[12]; obj.ControlType = item[13].ToControlType(); obj.Regex = item[14]; obj.QuerType = QueryTypeEnum.None; pg_colum.SelectedObject = obj; #endregion } } }