Exemplo n.º 1
0
        /// <summary>
        /// Creates a products data source.
        /// </summary>
        public static NDataSource CreateProductsDataSource()
        {
            NMemoryDataTable dataTable = new NMemoryDataTable(new NFieldInfo[] {
                new NFieldInfo("Id", typeof(Int32)),
                new NFieldInfo("Name", typeof(String)),
                new NFieldInfo("Price", typeof(Double))
            });

            for (int i = 0; i < ProductInfos.Length; i++)
            {
                NProductInfo productInfo = ProductInfos[i];
                dataTable.AddRow(i, productInfo.Name, productInfo.Price);
            }

            return(new NDataSource(dataTable));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a persons order data source.
        /// </summary>
        public static NDataSource CreatePersonsOrdersDataSource()
        {
            // FIX: Remove

            NMemoryDataTable dataTable = new NMemoryDataTable(new NFieldInfo[] {
                new NFieldInfo("PersonId", typeof(Int32)),
                new NFieldInfo("Product Name", typeof(String)),
                new NFieldInfo("Product Name1", typeof(String)),
                new NFieldInfo("Ship To Country", typeof(ENCountry)),
                new NFieldInfo("Ship To Country1", typeof(ENCountry)),
                new NFieldInfo("Ship To City", typeof(String)),
                new NFieldInfo("Ship To City1", typeof(String)),
                new NFieldInfo("Ship To Address", typeof(String)),
                new NFieldInfo("Ship To Address1", typeof(String)),
                new NFieldInfo("Price", typeof(Double)),
                new NFieldInfo("Price1", typeof(Double)),
                new NFieldInfo("Quantity", typeof(Int32))
            });

            for (int i = 0; i < 10000; i++)
            {
                NAddressInfo addressInfo = RandomAddressInfo();
                NProductInfo productInfo = RandomProductInfo();

                dataTable.AddRow(
                    RandomPersonIndex(),    // person id
                    productInfo.Name,       // product name
                    productInfo.Name,       // product name
                    addressInfo.Country,    // ship to country
                    addressInfo.Country,    // ship to country
                    addressInfo.City,       // ship to city
                    addressInfo.City,       // ship to city
                    addressInfo.Address,    // ship to address
                    addressInfo.Address,    // ship to address
                    productInfo.Price,      // price
                    productInfo.Price,      // price
                    Random.Next(5) + 1      // quantity

                    );
            }

            return(new NDataSource(dataTable));
        }