Please see the issue code:
<%DateTime fromDate = MonatSession.HistoryFromDate;
DateTime toDate = MonatSession.HistoryToDate;
string dateTimeFormat = "{0:" + MonatSession.CurrentCustomer.Preferences["Date Format"].ToString() + " H:mm:ss}";
string dateFormat = MonatSession.CurrentCustomer.Preferences["Date Format"].ToString().ToUpper();
string[] prefArray = MonatSession.CurrentCustomer.Preferences.Values.ToArray();
string prefDate = prefArray[0].ToLower();
string prefTime = prefArray[1];
if (prefTime.Contains("tt"))
prefTime = prefTime.Replace("tt", "A");
if (prefTime.Contains("mm"))
prefTime = prefTime.Replace("mm", "ii");
%>
Instead above code, it should access the preferences dictionary by key
I am trying to do this dictionary date format and time by key in C# as I change the code below:
MonatSession.CurrentCustomer.Preferences.Values.ToArray();
string prefDate = MonatSession.CurrentCustomer.Preferences["Date Format"].ToLower();
string prefTime = MonatSession.CurrentCustomer.Preferences["Time Format"];
if (prefTime.Contains("tt"))
prefTime = prefTime.Replace("tt", "A");
if (prefTime.Contains("mm"))
prefTime = prefTime.Replace("mm", "ii");
How to create a code for access the preferences dictionary by key.
Your help is much appreciated. Thank you.