Esempio n. 1
0
        public static UserSetting GetDefaultSettingsForUser(string userId, bool isHelpDeskUser)
        {
            var collection = new UserTicketListSettingsCollection
            {
                UserTicketListSetting.GetDefaultListSettings(userId, isHelpDeskUser)
            };

            return(new UserSetting {
                UserId = userId, ListSettings = collection
            });
        }
        public static IHtmlString SortableColumnHeader(this AjaxHelper helper, HtmlHelper htmlHelper,
            UserTicketListSetting currentDisplayPreferences,int currentPage, string action, string listName, string sortColumn,
            string linkText, AjaxOptions ajaxOptions)
        {
            var imgContent = string.Empty;
            var linkContent = linkText;
            var indexContent = string.Empty;
            var sortColumns = currentDisplayPreferences.SortColumns;
            var cColumn = sortColumns.SingleOrDefault(sc => sc.ColumnName == sortColumn);
            if (cColumn != null)
            {
                var uh = new UrlHelper(helper.ViewContext.RequestContext);
                var imgSrc =
                    uh.Content((cColumn.SortDirection == ColumnSortDirection.Ascending)
                        ? "~/Content/Images/arrow_top.png"
                        : "~/Content/Images/arrow_down.png");
                imgContent = string.Format("<img src='{0}' alt='{1}' />", imgSrc, cColumn.SortDirection.ToString());

                var idx = sortColumns.IndexOf(cColumn) + 1;
                indexContent = string.Format("<sup>[{0}]</sup>", idx);
            }

            var sb = new StringBuilder();
            sb.AppendLine("<span style='white-space:nowrap;'>");
            var lLine =
                // ReSharper disable once Mvc.ActionNotResolved
                helper.ActionLink(linkContent, "SortList", new {page = currentPage,  ListName = listName, ColumnName = sortColumn },
                    ajaxOptions,
                    new
                    {
                        OnMouseDown = "ticketCenter.sorts.setShiftStatus(event);",
                        Title = "[shift+click] to add or remove columns from the sort"
                    }).ToString();


            sb.AppendLine(lLine + indexContent);
            sb.AppendLine(imgContent);
            sb.AppendLine("</span>");
            return MvcHtmlString.Create(sb.ToString());
        }
Esempio n. 3
0
 public FilterBarViewModel(UserTicketListSetting currentListSetting)
 {
     CurrentListSetting = currentListSetting;
     RoleManager = DependencyResolver.Current.GetService<TicketDeskRoleManager>();
     UserManager = DependencyResolver.Current.GetService<TicketDeskUserManager>();
 }