public void Put(string domainName, string itemName, bool isPublic, AmazonSimpleDBClient sdbClient)
{
if (String.IsNullOrEmpty(domainName) ||
String.IsNullOrEmpty(itemName))
{
return;
}
DomainHelper.CheckForDomain(domainName, sdbClient);
PutAttributesRequest putAttrRequest = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemName);
putAttrRequest.WithAttribute(
new ReplaceableAttribute { Name = "Public", Value = isPublic.ToString(), Replace = true },
new ReplaceableAttribute { Name = "PhotoThumbUrl", Value = !String.IsNullOrEmpty(this.PhotoThumbUrl) ? this.PhotoThumbUrl : String.Empty, Replace = true },
new ReplaceableAttribute { Name = "Name", Value = this.Name, Replace = true },
new ReplaceableAttribute { Name = "Type", Value = this.Type, Replace = true },
new ReplaceableAttribute { Name = "Breed", Value = this.Breed, Replace = true },
new ReplaceableAttribute { Name = "Sex", Value = this.Sex, Replace = true },
new ReplaceableAttribute { Name = "Birthdate", Value = this.Birthdate, Replace = true },
new ReplaceableAttribute { Name = "Likes", Value = this.Likes, Replace = true },
new ReplaceableAttribute { Name = "Dislikes", Value = this.Dislikes, Replace = true }
);
sdbClient.PutAttributes(putAttrRequest);
if (isPublic)
{
DomainHelper.CheckForDomain(Settings.Default.PetBoardPublicDomainName, sdbClient);
putAttrRequest.DomainName = Settings.Default.PetBoardPublicDomainName;
sdbClient.PutAttributes(putAttrRequest);
}
else
{
DeleteAttributesRequest deleteAttributeRequest = new DeleteAttributesRequest().WithDomainName(Settings.Default.PetBoardPublicDomainName).WithItemName(itemName);
sdbClient.DeleteAttributes(deleteAttributeRequest);
}
}