public static async Task LoadData()

in dotnetv3/dynamodb/LowLevelLocalSecondaryIndexExample/LowLevelLocalSecondaryIndexExample.cs [238:705]


        public static async Task<bool> LoadData(AmazonDynamoDBClient client)
        {
            Console.WriteLine("Loading data into table " + _tableName + "...");

            Dictionary<string, AttributeValue> item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "alice@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "1"
            };

            item["IsOpen"] = new AttributeValue
            {
                N = "1"
            };

            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130101"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Book"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "The Great Outdoors"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "PACKING ITEMS"
            };

            /* no ShipmentTrackingId attribute */
            PutItemRequest putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };
            
            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "alice@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "2"
            };

            item["IsOpen"] = new AttributeValue
            {
                N = "1"
            };

            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130221"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Bike"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "Super Mountain"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "ORDER RECEIVED"
            };

            /* no ShipmentTrackingId attribute */
            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };
            
            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "alice@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "3"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130304"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Music"
            };
            item["ProductName"] = new AttributeValue
            {
                S = "A Quiet Interlude"
            };
            item["OrderStatus"] = new AttributeValue
            {
                S = "IN TRANSIT"
            };
            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "176493"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };
            
            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "1"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130111"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Movie"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "Calm Before The Storm"
            };
            item["OrderStatus"] = new AttributeValue
            {
                S = "SHIPPING DELAY"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "859323"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };

            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "2"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130124"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Music"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "E-Z Listening"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "DELIVERED"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "756943"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };

            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "3"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130221"
            };


            item["ProductCategory"] = new AttributeValue
            {
                S = "Music"
            };
            item["ProductName"] = new AttributeValue
            {
                S = "Symphony 9"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "DELIVERED"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "645193"
            };
            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };

            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "4"
            };

            item["IsOpen"] = new AttributeValue
            {
                N = "1"
            };

            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130222"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Hardware"
            };
            item["ProductName"] = new AttributeValue
            {
                S = "Extra Heavy Hammer"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "PACKING ITEMS"
            };

            /* no ShipmentTrackingId attribute */
            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };

            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "5"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130309"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Book"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "How To Cook"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "IN TRANSIT"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "440185"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };
            
            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "6"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130318"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Luggage"
            };
            item["ProductName"] = new AttributeValue
            {
                S = "Really Big Suitcase"
            };
            item["OrderStatus"] = new AttributeValue
            {
                S = "DELIVERED"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "893927"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };

            await client.PutItemAsync(putItemRequest);

            item = new Dictionary<string, AttributeValue>();

            item["CustomerId"] = new AttributeValue
            {
                S = "bob@example.com"
            };

            item["OrderId"] = new AttributeValue
            {
                N = "7"
            };

            /* no IsOpen attribute */
            item["OrderCreationDate"] = new AttributeValue
            {
                N = "20130324"
            };

            item["ProductCategory"] = new AttributeValue
            {
                S = "Golf"
            };

            item["ProductName"] = new AttributeValue
            {
                S = "PGA Pro II"
            };

            item["OrderStatus"] = new AttributeValue
            {
                S = "OUT FOR DELIVERY"
            };

            item["ShipmentTrackingId"] = new AttributeValue
            {
                S = "383283"
            };

            putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item = item,
                ReturnItemCollectionMetrics = "SIZE"
            };
            
            await client.PutItemAsync(putItemRequest);

            return true;
        }