Beispiel #1
0
        public async Task <DataTable> GetViewDataAsync(PpsDataQuery arguments)
        {
            var dt = new DataTable();

            using (var e = (await Task.Run(() => GetViewData(arguments))).GetEnumerator())
            {
                while (await Task.Run(new Func <bool>(e.MoveNext)))
                {
                    if (dt.Columns.Count == 0)
                    {
                        for (var i = 0; i < e.Current.Columns.Count; i++)
                        {
                            var col = e.Current.Columns[i];
                            dt.Columns.Add(new DataColumn(col.Name, col.DataType));
                        }
                    }

                    var r = dt.NewRow();
                    for (var i = 0; i < dt.Columns.Count; i++)
                    {
                        r[i] = e.Current[i] ?? DBNull.Value;
                    }

                    dt.Rows.Add(r);
                }
            }
            return(dt.Columns.Count == 0 ? null : dt);
        }         // func GetViewDataAsync
Beispiel #2
0
 /// <summary>Request a list from the shell client.</summary>
 /// <param name="arguments"></param>
 /// <returns></returns>
 public abstract IEnumerable <IDataRow> GetViewData(PpsDataQuery arguments);
Beispiel #3
0
 public override IEnumerable <IDataRow> GetViewData(PpsDataQuery arguments)
 => request.CreateViewDataReader(arguments.ToQuery());