製品をチェック

無償トライアル:

無償トライアルへ

製品の情報と無償トライアルへ:

Magento ADO.NET Provider

Magento データ連携のパワフルな.NET アプリケーションを素早く作成して配布。

データ連携でお困りですか?

お問い合わせ

Magento データをDevExpress Data Grid にデータバインドする。


Magento 用の CData ADO.NET プロバイダーをDevExpress Windows Forms とWeb コントロールとともに使用し、Magento をチャートに入力します。


magento ロゴ画像
ado ロゴ画像

ADO.NET

DevExpress ロゴ画像

Magento 用の CData ADO.NET プロバイダーはサードパーティーコントロールで使うことのできる通常のADO.NET データベースアクセスコンポーネントを実装しています。データバインドするための通常のADO.NET プロセスに従うことで、UI コントロールから実データへの双方向アクセスを可能にします。 この記事では、CData を使ってDevExpress Windows Forms とウェブコントロールにデータバインドする方法を説明します。ここでは、最新のデータを表示するチャートにデータバインドします。

Magento はOAuth 1 認証標準を使用します。Magento REST API に接続するには、Magento システムにアプリを登録してOAuthClientId、OAuthClientSecret、およびCallbackURL 接続プロパティの値を取得する必要があります。 OAuth 値を取得して接続するには、ヘルプドキュメントの「はじめに」を参照してください。

また、Magento システムへのURL を提供する必要があります。URL は、Magento REST API を顧客として使用しているか管理者として使用しているかによって異なります。

  • Customer: Magento を顧客として使用するには、事前にMagento のホームページで顧客アカウントを作成します。これを行うには、「アカウント」->「登録」をクリックします。それからURL 接続プロパティをMagento システムのエンドポイントに設定します。

  • Administrator: Magento を管理者として使用するには、代わりにCustomAdminPath を設定します。この値は、「Admin」メニューの「Advanced」設定で取得できます。「System」->「Configuration」->「Advanced」->「Admin」->「Admin Base URL」を選択することでアクセスできます。

    このページ上の「Use Custom Admin Path」設定がYES に設定されている場合、値は「Custom Admin Path」テキストボックス内にあります。それ以外の場合は、CustomAdminPath 接続プロパティをデフォルト値の"admin" に設定します。

Windows Forms コントロール

下のコードでは、Magento でDevExpress のチャートに追加する方法を説明します。MagentoDataAdapter はチャートコントロールのSeries プロパティにバインドします。コントロールのDiagram プロパティはx 軸とy 軸をカラム名として定義します。

using (MagentoConnection connection = new MagentoConnection( "OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://127.0.0.1:33333;Url=https://mymagentohost.com;")) { MagentoDataAdapter dataAdapter = new MagentoDataAdapter( "SELECT Name, Price FROM Products", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series(); chartControl1.Series.Add(series); DataTable table = new DataTable(); series.ValueDataMembers.AddRange(new string[] { "Price" }); series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative; series.ArgumentDataMember = "Name"; series.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical; chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; } The complete code example and the resulting chart.

Web コントロール

下のコードではMagento でDevExpress Web を操作するための設定方法を説明します。MagentoDataAdapter はチャートのSeries プロパティにバインドします。Diagram プロパティはx 軸とy 軸をカラム名として定義します。 using DevExpress.XtraCharts; using (MagentoConnection connection = new MagentoConnection( "OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://127.0.0.1:33333;Url=https://mymagentohost.com;")) { MagentoDataAdapter MagentoDataAdapter1 = new MagentoDataAdapter("SELECT Name, Price FROM Products", connection); DataTable table = new DataTable(); MagentoDataAdapter1.Fill(table); DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar); WebChartControl1.Series.Add(series); DataTable table = new DataTable(); series.ValueDataMembers.AddRange(new string[] { "Price" }); series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "Name"; series.ValueScaleType = ScaleType.Numerical; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; } An ASP.NET application created with the ADO.NET Provider and the DevExpress Web Forms control.(Salesforce is shown.)