Esempio n. 1
0
        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);
        }
 /// <summary>
 /// Provides the ability to remove selected rows in detail view.
 /// </summary>
 /// <param name="sender"></param>
 /// <returns></returns>
 public static List <ListViewItem> SelectedRows(this ListView.ListViewItemCollection sender)
 {
     return(sender.Cast <ListViewItem>()
            .Where(listViewItem => listViewItem.Selected)
            .Select(listViewItem => listViewItem)
            .ToList());
 }
Esempio n. 3
0
        List <ReportColumSetting> ParseListView(ListView.ListViewItemCollection rows)
        {
            var result = new List <ReportColumSetting>();

            foreach (ListViewItem row in rows)
            {
                var obj = new ReportColumSetting();
                obj.GUID      = row.SubItems[0].Text.TrimString();
                obj.ColumName = row.SubItems[1].Text.TrimString();
                obj.ColumNote = row.SubItems[2].Text.TrimString() + //防止列明重复
                                (rows.Cast <ListViewItem>().Count(a => a.SubItems[2].Text == row.SubItems[2].Text) > 1
                                    ? DateTime.Now.Random(2)
                                    : "");
                obj.TableName    = row.SubItems[3].Text.TrimString();
                obj.IsHidden     = bool.Parse(row.SubItems[4].Text.TrimString());
                obj.Sequence     = int.Parse(row.SubItems[5].Text.TrimString());
                obj.ForeignKey   = row.SubItems[6].Text.TrimString();
                obj.ForeignTable = row.SubItems[7].Text.TrimString();
                obj.QuerType     = row.SubItems[8].Text.TrimString().ToQueryType();
                result.Add(obj);
            }
            return(result);
        }
Esempio n. 4
0
        List <FormColumSetting> ParseListView(ListView.ListViewItemCollection rows, bool hasPre)
        {
            var result = new List <FormColumSetting>();

            foreach (ListViewItem row in rows)
            {
                var item = row.SubItems;
                var obj  = new FormColumSetting();
                obj.GUID      = item[0].Text.TrimString();
                obj.Sequence  = int.Parse(item[1].Text.TrimString());
                obj.TableName = item[4].Text.TrimString(); obj.AddTable(obj.TableName); obj.HasPre = hasPre;
                obj.ColumName = item[2].Text.TrimString();
                obj.ColumName = hasPre ? obj.TableName + "-" + obj.ColumName : obj.ColumName; //加前缀
                obj.ColumNote = item[3].Text.TrimString() +                                   //防止列明重复
                                (rows.Cast <ListViewItem>().Count(a => a.SubItems[2].Text == row.SubItems[2].Text) > 1
                                    ? ""
                                    : "");
                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  = obj.IsHidden?
                                   (obj.Type.ToLower().Contains("datetime") ? FormControlType.HideTime:FormControlType.Hide):
                                   item[13].Text.TrimString().ToControlType();
                obj.Regex           = item[14].Text.TrimString();
                obj.ShowControlType = item[15].Text.TrimString().ToControlType();

                result.Add(obj);
            }

            return(result);
        }
 public IEnumerator <ListViewItem> GetEnumerator()
 {
     return(_collection.Cast <ListViewItem>().GetEnumerator());
 }
Esempio n. 6
0
 public static ListViewItem FirstOrDefault <ListViewItem>(this ListView.ListViewItemCollection e, Func <ListViewItem, bool> func)
 {
     return(e.Cast <ListViewItem>().FirstOrDefault(func));
 }
Esempio n. 7
0
 public static IEnumerable <ListViewItem> Where <ListViewItem>(this ListView.ListViewItemCollection e, Func <ListViewItem, bool> func)
 {
     return(e.Cast <ListViewItem>().Where(func));
 }
Esempio n. 8
0
 private static bool IsContains(ListView.ListViewItemCollection checkedListViewItemCollection, string name)
 {
     return(checkedListViewItemCollection.Cast <ListViewItem>().Any(item => item.Text == name));
 }
Esempio n. 9
0
 public static IEnumerable <ListViewItem> ToEnumerable(this ListView.ListViewItemCollection viewItemCollection)
 {
     return(viewItemCollection.Cast <ListViewItem>());
 }
Esempio n. 10
0
 public IEnumerator <GenericListViewItem <T> > GetEnumerator()
 {
     return(_items.Cast <GenericListViewItem <T> >().GetEnumerator());
 }
Esempio n. 11
0
 private ListViewItem GetExisting(ListView.ListViewItemCollection items, Node node)
 {
     return(items.Cast <ListViewItem>().FirstOrDefault(item => (Guid)item.Tag == node.Id));
 }