Ejemplo n.º 1
0
        public static IEnumerable GetDataList(MyDataService.DataSetData data)
        {
            if (data.Tables.Count == 0)
                return null;

            MyDataService.DataTableInfo tableInfo = data.Tables[0];

            System.Type dataType = BuildDataObjectType(tableInfo.Columns, "MyDataObject");

            //ObservableCollection<DataObject> l = new ObservableCollection<DataObject>();

            var listType = typeof(ObservableCollection<>).MakeGenericType(new[] { dataType });
            var list = Activator.CreateInstance(listType);

            XDocument xd = XDocument.Parse(data.DataXML);
            var table = from row in xd.Descendants(tableInfo.TableName)
                        select row.Elements().ToDictionary(r => r.Name, r => r.Value);

            foreach (var r in table)
            {
                var rowData = Activator.CreateInstance(dataType) as DataObject;
                if (rowData != null)
                {
                    foreach (MyDataService.DataColumnInfo col in tableInfo.Columns)
                    {
                        if (r.ContainsKey(col.ColumnName) && col.DataTypeName != typeof(System.Byte[]).FullName && col.DataTypeName != typeof(System.Guid).FullName)
                            rowData.SetFieldValue(col.ColumnName, r[col.ColumnName], true);
                    }
                }
                listType.GetMethod("Add").Invoke(list, new[] { rowData });
            }
            ObservableCollection<DataObject> l = list as ObservableCollection<DataObject>;
            return list as IEnumerable;
        }
Ejemplo n.º 2
0
        public IActionResult About()
        {
            var misDatos = new MyDataService();
            var model    = misDatos.ObtenerDatos();

            return(View(model));
        }
Ejemplo n.º 3
0
        public void WhereLikeTest()
        {
            var service = new MyDataService();

            var options = new QueryOptions
            {
            };

            var data = service.GetCustAddrCountListLike(options, "FirstName", "%ja%");

            Assert.Equal(2, data.Count);
        }
Ejemplo n.º 4
0
        public void PagingTest()
        {
            var service = new MyDataService();

            var options = new QueryOptions
            {
                ApplyPagination = true,
                PageSize        = 5
            };

            var data = service.GetCustAddrCountList(options);

            Assert.Equal(5, data.Count);
            Assert.True(options.PageReturnTotalCount > 0);
        }
Ejemplo n.º 5
0
    public IEnumerable <IVm> Get(VmKind vmKind)
    {
        var dataService = new MyDataService();

        return(dataService.Get(vmKind));
    }
Ejemplo n.º 6
0
        void ws_GetDataSetDataCompleted(object sender, MyDataService.GetDataSetDataCompletedEventArgs e)
        {
            if (e.Error != null)
                return;
            else if (e.ServiceError != null)
                return;

            IEnumerable list = DynamicDataBuilder.GetDataList(e.Result);
            theGrid.Columns.Clear();
            theGrid.ItemsSource = DynamicDataBuilder.GetDataList(e.Result);
            theGrid.HorizontalContentAlignment = HorizontalAlignment.Center;
        }
Ejemplo n.º 7
0
        void ws_GetDataSetDataCompleted(object sender, MyDataService.GetDataSetDataCompletedEventArgs e)
        {
            if (e.Error != null)
                return;
            else if (e.ServiceError != null)
                return;
            //添加Seri
            var _ColumnSeri = new ColumnSeries();
            _ColumnSeri.ItemsSource = DynamicDataBuilder.GetDataList(e.Result);
            _ColumnSeri.Title = _BarName;
            if (e.Result.Tables.Count > 0)
            {
                int Number = 0;
                if (e.Result.Tables[0].Columns.Count >= 2)
                {
                    foreach (MyDataService.DataColumnInfo column in e.Result.Tables[0].Columns)
                    {
                        if (Number == 0)
                            _ColumnSeri.IndependentValuePath = column.ColumnName;
                        else if (Number == 1)
                        {
                            if (column.DataTypeName == "System.String")
                            {
                                return;
                            }
                            _ColumnSeri.DependentValuePath = column.ColumnName;
                        }
                        Number++;
                    }
                }
            }

            _Chart.Title = _TitleName;
            _Chart.Series.Clear();
            _Chart.Axes.Clear();
            _Chart.Axes.Add(new CategoryAxis() { Title=_XaxisName, Orientation= AxisOrientation.X });
            _Chart.Axes.Add(new LinearAxis(){Title = _YaxisName,Orientation = AxisOrientation.Y });
            _Chart.Series.Add(_ColumnSeri);
        }