protected void Save_Click(object sender, EventArgs e) { Tags tags=new Tags(); tags.TagId = Guid.NewGuid(); tags.TagName = txtTagName.Text; tags.Country = ddlCountry.SelectedValue; NewsEngine.SaveTags(tags, Settings.Default.TagTable); lblRsults.Text = "Saved Successully"; }
public static List<Tags> GetTags(string domainName, AmazonSimpleDBClient sdbClient) { List<Tags> tagses = new List<Tags>(); Tags tags; String selectExpression = "Select TagId,TagName,Country From " + domainName; SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectExpression); SelectResponse selectResponse = sdbClient.Select(selectRequestAction); if (selectResponse.IsSetSelectResult()) { SelectResult selectResult = selectResponse.SelectResult; foreach (Item item in selectResult.Item) { tags = new Tags(); ; if (item.IsSetName()) { } int i = 0; foreach (Amazon.SimpleDB.Model.Attribute attribute in item.Attribute) { if (attribute.IsSetName()) { string name = attribute.Name; } if (attribute.IsSetValue()) { switch (attribute.Name) { case "TagId": tags.TagId = Guid.Parse(attribute.Value); break; case "TagName": tags.TagName = attribute.Value; break; case "Country": tags.Country = attribute.Value; break; } i++; } } tagses.Add(tags); } } return tagses; }
public static void SaveTagNames(string domainName, Tags tags, AmazonSimpleDBClient sdbClient) { PutAttributesRequest putTagRequest = new PutAttributesRequest() .WithDomainName(domainName) .WithItemName(Convert.ToString(tags.TagId)); putTagRequest.WithAttribute( new ReplaceableAttribute { Name = "TagId", Value = Convert.ToString(tags.TagId), Replace = false }, new ReplaceableAttribute { Name = "TagName", Value = tags.TagName, Replace = false } , new ReplaceableAttribute { Name = "Country", Value = tags.Country, Replace = false }); sdbClient.PutAttributes(putTagRequest); }
public static void SaveTags(Tags tags, string domainName) { NewsMethods.SaveTagNames(domainName, tags, sdbClient); }