/// <summary> /// Gets the comment event text. /// </summary> /// <param name="ticketEvent">The ticket event of which to fetch the comment event.</param> /// <param name="replacements">Any replacements values that should be passed to the string.</param> /// <returns></returns> public static string GetCommentText(TicketActivity ticketEvent, TicketCommentFlag commentFlag, params string[] replacements) { string n = Enum.GetName(typeof(TicketActivity), ticketEvent); Type t = typeof(TicketTextUtility); System.Reflection.FieldInfo field = t.GetField(n, BindingFlags.Public | BindingFlags.Static); string val = (string)field.GetValue(null); string appendCommentText = (commentFlag == TicketCommentFlag.CommentNotSupplied) ? " without comment" : string.Empty; if (replacements.Length > 0) { val = string.Format(val, replacements); } return val + appendCommentText; }
/// <summary> /// Gets the activity comment. /// </summary> /// <param name="activity">The activity.</param> /// <param name="commentFlag">The comment flag.</param> /// <param name="commentBy">The user making the comment.</param> /// <param name="comment">The comment content.</param> /// <param name="args">Optional arguments to use as replacement values in the comment text.</param> /// <returns></returns> private TicketComment GetActivityComment(TicketActivity activity, TicketCommentFlag commentFlag, string comment, string assignedTo, string[] notificationSubscribers, params string[] args) { TicketComment c = new TicketComment(); c.Comment = comment; c.CommentedBy = Security.CurrentUserName; c.CommentedDate = DateTime.Now; c.CommentEvent = TicketTextUtility.GetCommentText(activity, commentFlag, args); c.IsHtml = false; var isNewOrGiveUp = (assignedTo == null) && (activity == TicketActivity.GiveUp || activity == TicketActivity.Create || activity == TicketActivity.CreateOnBehalfOf); Notification.AddTicketEventNotifications(c, isNewOrGiveUp, notificationSubscribers); return c; }
/// <summary> /// Gets the comment event text. /// </summary> /// <param name="ticketEvent">The ticket event of which to fetch the comment event.</param> /// <param name="replacements">Any replacements values that should be passed to the string.</param> /// <returns></returns> public static string GetCommentText(TicketActivity ticketEvent, TicketCommentFlag commentFlag, params string[] replacements) { string n = Enum.GetName(typeof(TicketActivity), ticketEvent); Type t = typeof(TicketTextUtility); System.Reflection.FieldInfo field = t.GetField(n, BindingFlags.Public | BindingFlags.Static); string val = (string)field.GetValue(null); string appendCommentText = (commentFlag == TicketCommentFlag.CommentNotSupplied) ? " without comment" : string.Empty; if (replacements.Length > 0) { val = string.Format(val, replacements); } return(val + appendCommentText); }