AccountDataDictionary
AccountDataDictionary
so i have:
protected PaymentCollection getPaymentInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
return order.Payments;
}
which shows me the credit card holders info for each order.
I need it to go one more step, how do I apply AccountDataDictionry to the above code?
protected PaymentCollection getPaymentInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
return order.Payments;
}
which shows me the credit card holders info for each order.
I need it to go one more step, how do I apply AccountDataDictionry to the above code?
Re: AccountDataDictionary
It would be something like
Code: Select all
Order order = OrderDataSource.Load(orderId);
PaymentCollection payments = order.Payments;
foreach (Payment payment in payments)
{
AccountDataDictionary add = new AccountDataDictionary(payment.AccountData);
//use account data dictionary here
}
Re: AccountDataDictionary
what am I missing?
I know I am still very new to C# and ASP.NET
protected PaymentCollection payInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
PaymentCollection payments = order.Payments;
foreach (Payment payment in payments)
{
AccountDataDictionary accDict = new AccountDataDictionary(payment.AccountData);
}
return payments;
}
_______________________________________________________________________
<asp:formview runat="server" HorizontalAlign="left" id="Formview1"
DataSource='<%#payInfo(Convert.ToInt32(Eval("OrderId")))%>' >
<ItemTemplate>
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Payment Info 002:" SkinID="FieldHeader"></asp:Label><br />
<asp:Label ID="lbl_PaymentType" runat="server" Text='<%#Eval("EncryptedAccountData")%>'></asp:Label>
</ItemTemplate>
</asp:formview>
I know I am still very new to C# and ASP.NET
protected PaymentCollection payInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
PaymentCollection payments = order.Payments;
foreach (Payment payment in payments)
{
AccountDataDictionary accDict = new AccountDataDictionary(payment.AccountData);
}
return payments;
}
_______________________________________________________________________
<asp:formview runat="server" HorizontalAlign="left" id="Formview1"
DataSource='<%#payInfo(Convert.ToInt32(Eval("OrderId")))%>' >
<ItemTemplate>
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Payment Info 002:" SkinID="FieldHeader"></asp:Label><br />
<asp:Label ID="lbl_PaymentType" runat="server" Text='<%#Eval("EncryptedAccountData")%>'></asp:Label>
</ItemTemplate>
</asp:formview>
Re: AccountDataDictionary
try following
Code: Select all
<%@ Control Language="C#" ClassName="Sample" %>
<script runat="server">
protected PaymentCollection payInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
return order.payments;
}
</script>
_______________________________________________________________________
<asp:formview runat="server" HorizontalAlign="left" id="Formview1"
DataSource='<%#payInfo(Convert.ToInt32(Eval("OrderId")))%>' >
<ItemTemplate>
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Payment Info 002:" SkinID="FieldHeader"></asp:Label><br />
<asp:Label ID="lbl_PaymentType" runat="server" Text='<%#Eval("EncryptedAccountData")%>'></asp:Label>
</ItemTemplate>
</asp:formview>
Re: AccountDataDictionary
In order to format it nicely you need to output it by formatting through some dynamic HTML code for example see the GetAccountData function below where a line break is appended
Code: Select all
<script runat="server">
protected PaymentCollection payInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
return order.payments;
}
public string GetAccountData(string data)
{
AccountDataDictionary accountData = new AccountDataDictionary(data);
StringBuilder sb = new StringBuilder();
foreach (string key in accountData.Keys)
{
sb.Append(key + ":" + accountData[key]);
sb.Append("<br />"); // New Line
}
return sb.ToString();
}
</script>
_______________________________________________________________________
<asp:formview runat="server" HorizontalAlign="left" id="Formview1"
DataSource='<%#payInfo(Convert.ToInt32(Eval("OrderId")))%>' >
<ItemTemplate>
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Payment Info 002:" SkinID="FieldHeader"></asp:Label><br />
<asp:Label ID="lbl_PaymentType" runat="server" Text='<%#GetAccountData(Eval("EncryptedAccountData"))%>'></asp:Label>
</ItemTemplate>
</asp:formview>
Re: AccountDataDictionary
Getting an error:
GetAccountData(string)' has some invalid arguments
GetAccountData(string)' has some invalid arguments
Re: AccountDataDictionary
Sorry was a small mistake in code, fixed code is here
Code: Select all
<script runat="server">
protected PaymentCollection payInfo(int orderId)
{
Order order = OrderDataSource.Load(orderId);
return order.payments;
}
public string GetAccountData(Object data)
{
AccountDataDictionary accountData = new AccountDataDictionary((string)data);[list=][/list]
StringBuilder sb = new StringBuilder();
foreach (string key in accountData.Keys)
{
sb.Append(key + ":" + accountData[key]);
sb.Append("<br />"); // New Line
}
return sb.ToString();
}
</script>
<asp:formview runat="server" HorizontalAlign="left" id="Formview1"
DataSource='<%#payInfo(Convert.ToInt32(Eval("OrderId")))%>' >
<ItemTemplate>
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Payment Info 002:" SkinID="FieldHeader"></asp:Label><br />
<asp:Label ID="lbl_PaymentType" runat="server" Text='<%#GetAccountData(Eval("EncryptedAccountData"))%>'></asp:Label>
</ItemTemplate>
</asp:formview>