public static MultiSelectList GetDefaultNewUserRolesList(this ApplicationSetting settings) { var roleManager = DependencyResolver.Current.GetService <TicketDeskRoleManager>(); return(roleManager.Roles.ToMultiSelectList( r => r.Name, r => r.DisplayName, settings.SecuritySettings.DefaultNewUserRoles.ToArray(), false)); }
public ActionResult Index( ApplicationSetting settings, [ModelBinder(typeof(CommaSeparatedModelBinder))] string[] categories, [ModelBinder(typeof(CommaSeparatedModelBinder))] string[] tickettypes, [ModelBinder(typeof(CommaSeparatedModelBinder))] string[] priorities, List<string> defaultroles, string defaultTextEditorType ) { var dbSetting = Context.TicketDeskSettings; if (ModelState.IsValid && TryUpdateModel(dbSetting)) { dbSetting.SelectLists.CategoryList = categories.ToList(); dbSetting.SelectLists.PriorityList = priorities.ToList(); dbSetting.SelectLists.TicketTypesList = tickettypes.ToList(); dbSetting.SecuritySettings.DefaultNewUserRoles = defaultroles; dbSetting.ClientSettings.Settings["DefaultTextEditorType"] = defaultTextEditorType; Context.SaveChanges(); } ViewBag.IsAzureSearchEnabled = IsAzureSearchDetected; return View(dbSetting); }
public static string GetCategories(this ApplicationSetting settings) { return(string.Join(",", settings.SelectLists.CategoryList)); }
public static string GetTicketTypes(this ApplicationSetting settings) { return(string.Join(",", settings.SelectLists.TicketTypesList)); }
public static string GetPriorities(this ApplicationSetting settings) { return(string.Join(",", settings.SelectLists.PriorityList)); }
public static SelectList GetTicketTypeList(this ApplicationSetting settings, bool includeEmpty, string selectedType) { return(settings.SelectLists.TicketTypesList.ToSelectList(p => p, p => p, selectedType, includeEmpty)); }
public static SelectList GetCategoryList(this ApplicationSetting settings, bool includeEmpty, string selectedCategory) { return(settings.SelectLists.CategoryList.ToSelectList(p => p, p => p, selectedCategory, includeEmpty)); }
public static SelectList GetPriorityList(this ApplicationSetting settings, bool includeEmpty, string selectedPriority) { return(settings.SelectLists.PriorityList.ToSelectList(p => p, p => p, selectedPriority, includeEmpty)); }
public Action<Ticket> EditTicketInfo( string comment, int projectId, string projectName, string title, string details, string priority, string ticketType, string category, string owner, string tagList, ApplicationSetting settings) { const TicketActivity activity = TicketActivity.EditTicketInfo; return ticket => { if (CheckSecurity(ticket, activity)) { var sb = new StringBuilder(comment); sb.AppendLine(); sb.AppendLine("<dl><dt>"); sb.AppendLine("Changes:"); sb.AppendLine("</dt>"); //TODO: resource these strings! if (ticket.Title != title) { sb.AppendLine(string.Format("<dd> {0}</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.Title))); ticket.Title = title; } if (ticket.ProjectId != projectId) { sb.AppendLine(string.Format("<dd> {0}: from \"{1}\" to \"{2}\"</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.ProjectId), ticket.Project.ProjectName, projectName)); ticket.ProjectId = projectId; } if (ticket.Details != details) { sb.AppendLine(string.Format("<dd> {0}</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.Details))); ticket.Details = details; } if ((SecurityProvider.IsTdHelpDeskUser || settings.Permissions.AllowInternalUsersToEditTags ) && ticket.TagList != tagList) { sb.AppendLine(string.Format("<dd> {0}</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.TagList))); ticket.TagList = tagList; } if ((SecurityProvider.IsTdHelpDeskUser || settings.Permissions.AllowInternalUsersToEditPriority) && ticket.Priority != priority) { sb.AppendLine(string.Format("<dd> {0}: from \"{1}\" to \"{2}\"</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.Priority), ticket.Priority, priority)); ticket.Priority = priority; } if (ticket.TicketType != ticketType) { sb.AppendLine(string.Format("<dd> {0}: from \"{1}\" to \"{2}\"</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.TicketType), ticket.TicketType, ticketType)); ticket.TicketType = ticketType; } if (ticket.Category != category) { sb.AppendLine(string.Format("<dd> {0}: from \"{1}\" to \"{2}\"</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.Category), ticket.Category, category)); ticket.Category = category; } if (SecurityProvider.IsTdHelpDeskUser && ticket.Owner != owner) { sb.AppendLine(string.Format("<dd> {0}: from \"{1}\" to \"{2}\"</dd>", PropertyUtility.GetPropertyDisplayString<Ticket>(p => p.Owner), SecurityProvider.GetUserDisplayName(ticket.Owner), SecurityProvider.GetUserDisplayName(owner))); ticket.Owner = owner; } sb.AppendLine("</dl>"); comment = sb.ToString(); ticket.TicketEvents.AddActivityEvent(SecurityProvider.CurrentUserId, activity, comment); } }; }