DoboWiki
Top
>
自由区
>
Webサービス紹介
>
Amazon E-Commerce Service
>
Code
>
CS
> Help
自由区/Webサービス紹介/Amazon E-Commerce Service/Code/CS/Help の編集
*Helpのサンプルコード(C#) [#sd4427b8] ここで紹介しているコードは[[こちらのプロキシクラス>../../../ProxyClass]]を使用しています。 ECSで使用できるオペレーションやResponseGroupの情報を表示するサンプルです。 #code(csharp){{ <%@ Page Language="C#" %> <%@ Import Namespace="Amazon.jp.v20060913" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { HelpRequest req = new HelpRequest(); //何についてのHelpを取得するかを指定 if (HelpTypeList.SelectedValue == "Operation") req.HelpType = HelpRequestHelpType.Operation; else if (HelpTypeList.SelectedValue == "ResponseGroup") req.HelpType = HelpRequestHelpType.ResponseGroup; req.HelpTypeSpecified = true; req.About = AboutList.SelectedValue; Help hlp = new Help(); //あなたのAccess Key ID hlp.AWSAccessKeyId = "(あなたのAccessKeyID)"; //あなたのAssociate ID hlp.AssociateTag = "dobonnet-22"; hlp.Request = new HelpRequest[] { req }; AWSECommerceService aws = new AWSECommerceService(); HelpResponse res; try { //Helpオペレーションを実行し、結果を取得 res = aws.Help(hlp); } catch (Exception ex) { Label1.Text = "エラー:" + ex.Message; return; } if (res == null || res.Information == null) { Label1.Text = "結果を取得できませんでした。"; return; } if (res.Information[0].Request.Errors != null) { Label1.Text = "エラー:" + res.Information[0].Request.Errors[0].Message; return; } //結果を表示 Label1.Text = ""; Information info = res.Information[0]; if (info.OperationInformation != null) { //OperationのHelp情報を表示 Label1.Text = "<ul>\n"; foreach (OperationInformation i in info.OperationInformation) { Label1.Text += "<li><strong>" + i.Name + "</strong>\n"; Label1.Text += "<li>説明 : " + i.Description + "\n"; Label1.Text += "<li>必須パラメーター :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.RequiredParameters) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>オプションパラメーター :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.AvailableParameters) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>デフォルトのResponseGroup :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.DefaultResponseGroups) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>指定可能なResponseGroup :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.AvailableResponseGroups) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; } Label1.Text += "</ul>\n"; } else if (info.ResponseGroupInformation != null) { //ResponseGroupのHelp情報を表示 Label1.Text = "<ul>\n"; foreach (ResponseGroupInformation i in info.ResponseGroupInformation) { Label1.Text += "<li><strong>" + i.Name + "</strong>\n"; Label1.Text += "<li>作成日 : " + i.CreationDate + "\n"; Label1.Text += "<li>Operation :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.ValidOperations) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>Element :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.Elements) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; } Label1.Text += "</ul>\n"; } else { Label1.Text += "表示する内容がありません。"; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) SetAboutList(); } protected void HelpTypeList_SelectedIndexChanged( object sender, EventArgs e) { SetAboutList(); } protected void SetAboutList() { //Aboutに設定できる値をDropDownListに設定する AboutList.Items.Clear(); if (HelpTypeList.SelectedValue == "Operation") { AboutList.Items.Add("CartAdd"); AboutList.Items.Add("CartClear"); AboutList.Items.Add("CartCreate"); AboutList.Items.Add("CartModify"); AboutList.Items.Add("CustomerContentLookup"); AboutList.Items.Add("CustomerContentSearch"); AboutList.Items.Add("Help"); AboutList.Items.Add("ItemLookup"); AboutList.Items.Add("ItemSearch"); AboutList.Items.Add("ListLookup"); AboutList.Items.Add("ListSearch"); AboutList.Items.Add("SellerListingLookup"); AboutList.Items.Add("SellerListingSearch"); AboutList.Items.Add("SellerLookup"); AboutList.Items.Add("SimilarityLookup"); AboutList.Items.Add("TransactionLookup"); } else if (HelpTypeList.SelectedValue == "ResponseGroup") { AboutList.Items.Add("Accessories"); AboutList.Items.Add("BrowseNodes"); AboutList.Items.Add("Cart"); AboutList.Items.Add("CartSimilarities"); AboutList.Items.Add("CustomerFull"); AboutList.Items.Add("CustomerInfo"); AboutList.Items.Add("CustomerLists"); AboutList.Items.Add("CustomerReviews"); AboutList.Items.Add("EditorialReview"); AboutList.Items.Add("Help"); AboutList.Items.Add("Images"); AboutList.Items.Add("ItemAttributes"); AboutList.Items.Add("ItemIds"); AboutList.Items.Add("Large"); AboutList.Items.Add("ListFull"); AboutList.Items.Add("ListInfo"); AboutList.Items.Add("ListItems"); AboutList.Items.Add("ListMinimum"); AboutList.Items.Add("ListmaniaLists"); AboutList.Items.Add("Medium"); AboutList.Items.Add("OfferFull"); AboutList.Items.Add("OfferSummary"); AboutList.Items.Add("Offers"); AboutList.Items.Add("Request"); AboutList.Items.Add("Reviews"); AboutList.Items.Add("Salesrank"); AboutList.Items.Add("Seller"); AboutList.Items.Add("SellerListing"); AboutList.Items.Add("Similarities"); AboutList.Items.Add("Small"); AboutList.Items.Add("Tracks"); AboutList.Items.Add("TransactionDetails"); AboutList.Items.Add("VariationMinimum"); AboutList.Items.Add("VariationSummary"); AboutList.Items.Add("Variations"); } } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Helpのサンプル</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="HelpTypeList" runat="server" OnSelectedIndexChanged="HelpTypeList_SelectedIndexChanged" AutoPostBack="True"> <asp:ListItem>Operation</asp:ListItem> <asp:ListItem>ResponseGroup</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="AboutList" runat="server"> </asp:DropDownList> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="送信" /> <br /> </div> </form> <br /> <asp:Label ID="Label1" runat="server" EnableViewState="False"> </asp:Label> </body> </html> }} //これより下は編集しないでください #pageinfo([[:Category/.NET]] [[:Category/ASP.NET]],2006-10-20 (金) 01:31:24,DOBON!,2006-10-20 (金) 02:13:41,DOBON!)
タイムスタンプを変更しない
*Helpのサンプルコード(C#) [#sd4427b8] ここで紹介しているコードは[[こちらのプロキシクラス>../../../ProxyClass]]を使用しています。 ECSで使用できるオペレーションやResponseGroupの情報を表示するサンプルです。 #code(csharp){{ <%@ Page Language="C#" %> <%@ Import Namespace="Amazon.jp.v20060913" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { HelpRequest req = new HelpRequest(); //何についてのHelpを取得するかを指定 if (HelpTypeList.SelectedValue == "Operation") req.HelpType = HelpRequestHelpType.Operation; else if (HelpTypeList.SelectedValue == "ResponseGroup") req.HelpType = HelpRequestHelpType.ResponseGroup; req.HelpTypeSpecified = true; req.About = AboutList.SelectedValue; Help hlp = new Help(); //あなたのAccess Key ID hlp.AWSAccessKeyId = "(あなたのAccessKeyID)"; //あなたのAssociate ID hlp.AssociateTag = "dobonnet-22"; hlp.Request = new HelpRequest[] { req }; AWSECommerceService aws = new AWSECommerceService(); HelpResponse res; try { //Helpオペレーションを実行し、結果を取得 res = aws.Help(hlp); } catch (Exception ex) { Label1.Text = "エラー:" + ex.Message; return; } if (res == null || res.Information == null) { Label1.Text = "結果を取得できませんでした。"; return; } if (res.Information[0].Request.Errors != null) { Label1.Text = "エラー:" + res.Information[0].Request.Errors[0].Message; return; } //結果を表示 Label1.Text = ""; Information info = res.Information[0]; if (info.OperationInformation != null) { //OperationのHelp情報を表示 Label1.Text = "<ul>\n"; foreach (OperationInformation i in info.OperationInformation) { Label1.Text += "<li><strong>" + i.Name + "</strong>\n"; Label1.Text += "<li>説明 : " + i.Description + "\n"; Label1.Text += "<li>必須パラメーター :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.RequiredParameters) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>オプションパラメーター :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.AvailableParameters) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>デフォルトのResponseGroup :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.DefaultResponseGroups) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>指定可能なResponseGroup :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.AvailableResponseGroups) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; } Label1.Text += "</ul>\n"; } else if (info.ResponseGroupInformation != null) { //ResponseGroupのHelp情報を表示 Label1.Text = "<ul>\n"; foreach (ResponseGroupInformation i in info.ResponseGroupInformation) { Label1.Text += "<li><strong>" + i.Name + "</strong>\n"; Label1.Text += "<li>作成日 : " + i.CreationDate + "\n"; Label1.Text += "<li>Operation :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.ValidOperations) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; Label1.Text += "<li>Element :\n"; Label1.Text += "<ul>\n"; foreach (string s in i.Elements) { Label1.Text += "<li>" + s + "\n"; } Label1.Text += "</ul>\n"; } Label1.Text += "</ul>\n"; } else { Label1.Text += "表示する内容がありません。"; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) SetAboutList(); } protected void HelpTypeList_SelectedIndexChanged( object sender, EventArgs e) { SetAboutList(); } protected void SetAboutList() { //Aboutに設定できる値をDropDownListに設定する AboutList.Items.Clear(); if (HelpTypeList.SelectedValue == "Operation") { AboutList.Items.Add("CartAdd"); AboutList.Items.Add("CartClear"); AboutList.Items.Add("CartCreate"); AboutList.Items.Add("CartModify"); AboutList.Items.Add("CustomerContentLookup"); AboutList.Items.Add("CustomerContentSearch"); AboutList.Items.Add("Help"); AboutList.Items.Add("ItemLookup"); AboutList.Items.Add("ItemSearch"); AboutList.Items.Add("ListLookup"); AboutList.Items.Add("ListSearch"); AboutList.Items.Add("SellerListingLookup"); AboutList.Items.Add("SellerListingSearch"); AboutList.Items.Add("SellerLookup"); AboutList.Items.Add("SimilarityLookup"); AboutList.Items.Add("TransactionLookup"); } else if (HelpTypeList.SelectedValue == "ResponseGroup") { AboutList.Items.Add("Accessories"); AboutList.Items.Add("BrowseNodes"); AboutList.Items.Add("Cart"); AboutList.Items.Add("CartSimilarities"); AboutList.Items.Add("CustomerFull"); AboutList.Items.Add("CustomerInfo"); AboutList.Items.Add("CustomerLists"); AboutList.Items.Add("CustomerReviews"); AboutList.Items.Add("EditorialReview"); AboutList.Items.Add("Help"); AboutList.Items.Add("Images"); AboutList.Items.Add("ItemAttributes"); AboutList.Items.Add("ItemIds"); AboutList.Items.Add("Large"); AboutList.Items.Add("ListFull"); AboutList.Items.Add("ListInfo"); AboutList.Items.Add("ListItems"); AboutList.Items.Add("ListMinimum"); AboutList.Items.Add("ListmaniaLists"); AboutList.Items.Add("Medium"); AboutList.Items.Add("OfferFull"); AboutList.Items.Add("OfferSummary"); AboutList.Items.Add("Offers"); AboutList.Items.Add("Request"); AboutList.Items.Add("Reviews"); AboutList.Items.Add("Salesrank"); AboutList.Items.Add("Seller"); AboutList.Items.Add("SellerListing"); AboutList.Items.Add("Similarities"); AboutList.Items.Add("Small"); AboutList.Items.Add("Tracks"); AboutList.Items.Add("TransactionDetails"); AboutList.Items.Add("VariationMinimum"); AboutList.Items.Add("VariationSummary"); AboutList.Items.Add("Variations"); } } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Helpのサンプル</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="HelpTypeList" runat="server" OnSelectedIndexChanged="HelpTypeList_SelectedIndexChanged" AutoPostBack="True"> <asp:ListItem>Operation</asp:ListItem> <asp:ListItem>ResponseGroup</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="AboutList" runat="server"> </asp:DropDownList> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="送信" /> <br /> </div> </form> <br /> <asp:Label ID="Label1" runat="server" EnableViewState="False"> </asp:Label> </body> </html> }} //これより下は編集しないでください #pageinfo([[:Category/.NET]] [[:Category/ASP.NET]],2006-10-20 (金) 01:31:24,DOBON!,2006-10-20 (金) 02:13:41,DOBON!)
テキスト整形のルールを表示する
▲
▼
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
複製
|
名前変更
|
リロード
] [
新規
|
子ページ作成
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]