public GetAttributes ( GetAttributesRequest request ) : GetAttributesResponse | ||
request | GetAttributesRequest | Container for the necessary parameters to execute the GetAttributes service method. |
return | GetAttributesResponse |
public static NewsComponents GetNewsItem(string domainName, string itemName, AmazonSimpleDBClient sdbClient) { NewsComponents newsItem = new NewsComponents(); GetAttributesRequest getAttributeRequest = new GetAttributesRequest() .WithDomainName(domainName) .WithItemName(itemName); GetAttributesResponse getAttributeResponse = sdbClient.GetAttributes(getAttributeRequest); List<Amazon.SimpleDB.Model.Attribute> attrs = null; if (getAttributeResponse.IsSetGetAttributesResult()) { attrs = getAttributeResponse.GetAttributesResult.Attribute; int i = 0; foreach (Amazon.SimpleDB.Model.Attribute attribute in attrs) { if (attribute.IsSetName()) { string name = attribute.Name; } if (attribute.IsSetValue()) { switch (i) { case 0: newsItem.NewsID = Guid.Parse(attribute.Value); break; case 1: newsItem.Source = attribute.Value; break; case 2: newsItem.Section = attribute.Value; break; case 3: newsItem.NewsItem = attribute.Value; break; case 4: newsItem.NewsHeadline = attribute.Value; break; case 5: newsItem.NewsAdded = Convert.ToDateTime(attribute.Value); break; case 7: newsItem.Summary = attribute.Value; break; case 8: newsItem.Category = attribute.Value; break; } i++; } } } return newsItem; }