예제 #1
0
        private static IList<GridColumn> GetDefaultLayout(ILayoutList<ILayoutInfo> layoutList)
        {
            var mobileLayout = layoutList.FirstOrDefault(l => l.Name.ToUpperInvariant().Contains("MOBILE"));
            if(mobileLayout != null)
                return JsonConvert.DeserializeObject<IList<GridColumn>>(mobileLayout.LayoutDefinition);

            var defaultLayout = layoutList.FirstOrDefault(l => (l.IsDefault ?? false) && (l.AccountId == Utils.CurrentUserAccountId || (l.AccountId == 0 && Utils.CurrentUserAccountId == -1)));
            if (defaultLayout != null)
                return JsonConvert.DeserializeObject<IList<GridColumn>>(defaultLayout.LayoutDefinition);

            if (layoutList.Any(l => l.IsAdminDefault ?? false)) {
                return JsonConvert.DeserializeObject <IList<GridColumn>>(layoutList.First(l => l.IsAdminDefault ?? false).LayoutDefinition);
            }

            return JsonConvert.DeserializeObject<IList<GridColumn>>(layoutList.First().LayoutDefinition);
        }