コード例 #1
0
        private static object GetCellData(AnalyticsDataCell cell, DataQuery query)
        {
            object raw;
            object value;

            switch (cell.Column.DataType)
            {
            case "dINTEGER":
                raw   = cell.GetInt32();
                value = cell.GetInt32().ToString("N0", query.Context.Culture);
                break;

            case "dDOUBLE":
                raw   = cell.GetDouble();
                value = cell.GetDouble().ToString("N2", query.Context.Culture);
                break;

            default:
                raw   = cell.GetString();
                value = cell.GetString() + " (" + cell.Column.ColumnType + ")";
                break;
            }

            return(new {
                raw, value
            });
        }
コード例 #2
0
        internal object FormatCell(AnalyticsDataCell cell)
        {
            string key = cell.Column.Name.Substring(3);

            string text = cell.Value;

            switch (cell.Column.Name)
            {
            case "ga:date": {
                DateTime date = DateTime.ParseExact(text, "yyyyMMdd", null);
                if (Context.Culture.TwoLetterISOLanguageName == "en")
                {
                    text = date.Day + GetDaySuffix(date.Day) + " of " + date.ToString("MMM");
                }
                else
                {
                    text = DateTime.ParseExact(text, "yyyyMMdd", null).ToString("d. MMM", Context.Culture);
                }
                break;
            }

            case "ga:yearWeek": text = Context.Translate("analytics_week_x", text.Substring(4)); break;
            }

            return(new OmgDataRow {
                Alias = key,
                Label = Context.Translate(cell.Column.Name),
                Value = new { raw = cell.Value, text }
            });
        }
コード例 #3
0
        internal object FormatCell(AnalyticsDataCell cell) {

            string key = cell.Column.Name.Substring(3);

            string text = cell.Value;

            switch (cell.Column.Name) {
                case "ga:date": {
                    DateTime date = DateTime.ParseExact(text, "yyyyMMdd", null);
                    if (Context.Culture.TwoLetterISOLanguageName == "en") {
                        text = date.Day + GetDaySuffix(date.Day) + " of " + date.ToString("MMM");
                    } else {
                        text = DateTime.ParseExact(text, "yyyyMMdd", null).ToString("d. MMM", Context.Culture);
                    }
                    break;
                }
                case "ga:yearWeek": text = Context.Translate("analytics_week_x", text.Substring(4)); break;
            }

            return new OmgDataRow {
                Alias = key,
                Label = Context.Translate(cell.Column.Name),
                Value = new { raw = cell.Value, text }
            };

        }
コード例 #4
0
        private static object GetCellData(AnalyticsDataCell cell, DataQuery query) {

            object raw;
            object value;

            switch (cell.Column.DataType) {
                case "dINTEGER":
                    raw = cell.GetInt32();
                    value = cell.GetInt32().ToString("N0", query.Context.Culture);
                    break;
                case "dDOUBLE":
                    raw = cell.GetDouble();
                    value = cell.GetDouble().ToString("N2", query.Context.Culture);
                    break;
                default:
                    raw = cell.GetString();
                    value = cell.GetString() + " (" + cell.Column.ColumnType + ")";
                    break;
            }

            return new {
                raw, value
            };

        }