/// <summary> /// Creates an activity event where no priority or user name is applicable to the activity. /// </summary> /// <param name="set">The set of tickets to which to add this comment.</param> /// <param name="eventByUserId">The userId.</param> /// <param name="activity">The activity.</param> /// <param name="comment">The comment content.</param> /// <returns>TicketEvent.</returns> public static TicketEvent AddActivityEvent(this ICollection<TicketEvent> set, string eventByUserId, TicketActivity activity, string comment) { return AddActivityEvent(set, eventByUserId, activity, comment, null, null); }
public async Task<ActionResult> LoadActivity(TicketActivity activity, int ticketId, Guid? tempId) { var ticket = await Context.Tickets.FindAsync(ticketId); Context.TicketActions.IsTicketActivityValid(ticket, activity); ViewBag.CommentRequired = activity.IsCommentRequired(); ViewBag.Activity = activity; ViewBag.TempId = tempId ?? Guid.NewGuid(); ViewBag.IsEditorDefaultHtml = Context.TicketDeskSettings.ClientSettings.GetDefaultTextEditorType() == "summernote"; if (activity == TicketActivity.EditTicketInfo) { await SetProjectInfoForModel(ticket); } return PartialView("_ActivityForm", ticket); }
/// <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> /// Creates the activity comment including a change in priority or a user name is applcable to the comment. /// </summary> /// <param name="set">The set of tickets to which to add this comment.</param> /// <param name="eventByUserId">The userId.</param> /// <param name="activity">The activity.</param> /// <param name="comment">The comment.</param> /// <param name="newPriority">The new priority.</param> /// <param name="userName">Name of the user.</param> /// <returns>TicketEvent.</returns> public static TicketEvent AddActivityEvent(this ICollection<TicketEvent> set, string eventByUserId, TicketActivity activity, string comment, string newPriority, string userName) { var tc = TicketEvent.CreateActivityEvent( eventByUserId, activity, comment, newPriority, userName ); set.Add(tc); return tc; }
/// <summary> /// Creates the activity event. /// </summary> /// <param name="eventByUserId">The event by user identifier.</param> /// <param name="activity">The activity.</param> /// <param name="comment">The comment.</param> /// <param name="newPriority">The new priority.</param> /// <param name="userName">Name of the user.</param> /// <returns>TicketEvent.</returns> public static TicketEvent CreateActivityEvent( string eventByUserId, TicketActivity activity, string comment, string newPriority, string userName) { var tc = new TicketEvent { Comment = comment, EventBy = eventByUserId, EventDate = DateTime.Now, EventDescription = TicketTextUtility.GetTicketEventDescription(activity, newPriority, userName), IsHtml = false }; return tc; }
/// <summary> /// Gets the comment event text. /// </summary> /// <param name="ticketEvent">The ticket event of which to fetch the comment event.</param> /// <param name="newPriority">The new priority, leave null if priority change isn't applicable for the activity.</param> /// <param name="userName">Name of the user, leave null if a user name isn't applicable for the actiity</param> /// <returns>System.String.</returns> /// <exception cref="System.NullReferenceException"></exception> public static string GetTicketEventDescription(TicketActivity ticketEvent, string newPriority, string userName) { //no real perf advantage to a stringbuilder here var n = Enum.GetName(typeof(TicketActivity), ticketEvent); var val = TicketDeskDomainText.ResourceManager.GetString("TicketActivity" + n); var pval = TicketDeskDomainText.ResourceManager.GetString("TicketActivityPriority"); if (string.IsNullOrEmpty(val) || string.IsNullOrEmpty(pval)) { throw new NullReferenceException(); } if (!string.IsNullOrEmpty(userName)) { val = string.Format(val, userName); } if (!string.IsNullOrEmpty(newPriority)) { val += string.Format(pval, newPriority); } return val; }
/// <summary> /// Determines whether the ticket activity is valid for the specified ticket. /// </summary> /// <remarks> /// This is a convienience method to provide a more natual api for the client. /// It just calls the equivalent method from the security provider. /// </remarks> /// <param name="ticket">The ticket.</param> /// <param name="activity">The activity.</param> /// <returns><c>true</c> if the ticket activity valid for the specified ticket; otherwise, <c>false</c>.</returns> public bool IsTicketActivityValid(Ticket ticket, TicketActivity activity) { return(SecurityProvider.IsTicketActivityValid(ticket, activity)); }
/// <summary> /// Checks the security for ticket activity for the specified user. /// </summary> /// <param name="ticket">The ticket, or null if checking an operation that isn't reliant on any specific ticket's state (such as NoChange, GetTicketInfo, etc).</param> /// <param name="activity">The activity.</param> /// <param name="userName">Name of the user to check.</param> /// <returns></returns> public bool CheckSecurityForTicketActivity(Ticket ticket, TicketActivity activity, string userName) { bool isAllowed = false; if (Security.IsInValidTdUserRole()) //short-cut whole thing if not a valid TD user role { if (ticket == null) //some ops might supply no ticket, so we can create a dummy ticket instead { ticket = new Ticket(); } bool isAssigned = (!string.IsNullOrEmpty(ticket.AssignedTo)); bool isOpen = (ticket.CurrentStatus != "Resolved" && ticket.CurrentStatus != "Closed"); bool isAssignedToMe = (!string.IsNullOrEmpty(ticket.AssignedTo) && ticket.AssignedTo == userName); bool isOwnedByMe = (ticket.Owner == userName); bool isMoreInfo = (ticket.CurrentStatus == "More Info"); bool isResolved = (ticket.CurrentStatus == "Resolved"); switch (activity) { case TicketActivity.NoChange: isAllowed = true; break; case TicketActivity.GetTicketInfo: isAllowed = true; break; case TicketActivity.Create: isAllowed = true; break; case TicketActivity.CreateOnBehalfOf: isAllowed = true; break; case TicketActivity.ModifyAttachments: isAllowed = isOpen; break; case TicketActivity.EditTicketInfo: isAllowed = isOpen && (Security.IsTdStaff() || isOwnedByMe); break; case TicketActivity.AddComment: isAllowed = isOpen && !isMoreInfo; break; case TicketActivity.SupplyMoreInfo: isAllowed = isMoreInfo; break; case TicketActivity.Resolve: isAllowed = isOpen && !isMoreInfo && isAssignedToMe; break; case TicketActivity.RequestMoreInfo: isAllowed = isOpen && !isMoreInfo && isAssignedToMe; break; case TicketActivity.CancelMoreInfo: isAllowed = isMoreInfo && isAssignedToMe; break; case TicketActivity.Close: isAllowed = isResolved && isOwnedByMe; break; case TicketActivity.ReOpen: isAllowed = !isOpen; break; case TicketActivity.TakeOver: isAllowed = (isOpen || isResolved) && !isAssignedToMe && Security.IsTdStaff(); break; case TicketActivity.TakeOverWithPriority: isAllowed = (isOpen || isResolved) && !isAssignedToMe && Security.IsTdStaff(); break; case TicketActivity.Assign: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && !isAssigned; break; case TicketActivity.AssignWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && !isAssigned; break; case TicketActivity.ReAssign: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssigned && !isAssignedToMe;; break; case TicketActivity.ReAssignWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssigned && !isAssignedToMe;; break; case TicketActivity.Pass: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssignedToMe; break; case TicketActivity.PassWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssignedToMe; break; case TicketActivity.GiveUp: isAllowed = (isOpen || isResolved) && isAssignedToMe; break; case TicketActivity.ForceClose: isAllowed = (isOpen || isResolved) && (isAssignedToMe || isOwnedByMe) && !(isResolved && isOwnedByMe); break; } } return(isAllowed); }
/// <summary> /// Gets the activity comment. Infers a comment flag. /// </summary> /// <param name="activity">The activity.</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, string comment, string assignedTo, string[] notificationSubscribers, params string[] args) { var cFlag = (string.IsNullOrEmpty(comment)) ? TicketCommentFlag.CommentNotSupplied : TicketCommentFlag.CommentSupplied; return(GetActivityComment(activity, cFlag, comment, assignedTo, notificationSubscribers, args)); }
/// <summary> /// Determines whether the ticket activity is valid for the specified ticket. /// </summary> /// <remarks> /// This is a convienience method to provide a more natual api for the client. /// It just calls the equivalent method from the security provider. /// </remarks> /// <param name="ticket">The ticket.</param> /// <param name="activity">The activity.</param> /// <returns><c>true</c> if the ticket activity valid for the specified ticket; otherwise, <c>false</c>.</returns> public bool IsTicketActivityValid(Ticket ticket, TicketActivity activity) { return SecurityProvider.IsTicketActivityValid(ticket, activity); }
/// <summary> /// Checks the security for ticket activity for the current user. /// </summary> /// <param name="ticket">The ticket.</param> /// <param name="activity">The activity.</param> /// <returns></returns> public bool CheckSecurityForTicketActivity(Ticket ticket, TicketActivity activity) { return(CheckSecurityForTicketActivity(ticket, activity, Security.CurrentUserName)); }
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(Strings.Changes_Title); 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> " + Strings.Changes_From_To + "</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> " + Strings.Changes_From_To + "</dd>", PropertyUtility.GetPropertyDisplayString <Ticket>(p => p.Priority), ticket.Priority, priority)); ticket.Priority = priority; } if (ticket.TicketType != ticketType) { sb.AppendLine(string.Format("<dd> " + Strings.Changes_From_To + "</dd>", PropertyUtility.GetPropertyDisplayString <Ticket>(p => p.TicketType), ticket.TicketType, ticketType)); ticket.TicketType = ticketType; } if (ticket.Category != category) { sb.AppendLine(string.Format("<dd> " + Strings.Changes_From_To + "</dd>", PropertyUtility.GetPropertyDisplayString <Ticket>(p => p.Category), ticket.Category, category)); ticket.Category = category; } if (SecurityProvider.IsTdHelpDeskUser && ticket.Owner != owner) { sb.AppendLine(string.Format("<dd> " + Strings.Changes_From_To + "</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); } }); }
public void UpdateActivity(TicketActivity activity) { context.Set <TicketActivity>().AddOrUpdate(activity); }
/// <summary> /// Checks the security for ticket activity for the specified user. /// </summary> /// <param name="ticket">The ticket, or null if checking an operation that isn't reliant on any specific ticket's state (such as NoChange, GetTicketInfo, etc).</param> /// <param name="activity">The activity.</param> /// <param name="userName">Name of the user to check.</param> /// <returns></returns> public bool CheckSecurityForTicketActivity(Ticket ticket, TicketActivity activity, string userName) { bool isAllowed = false; if (Security.IsInValidTdUserRole())//short-cut whole thing if not a valid TD user role { if (ticket == null)//some ops might supply no ticket, so we can create a dummy ticket instead { ticket = new Ticket(); } bool isAssigned = (!string.IsNullOrEmpty(ticket.AssignedTo)); bool isOpen = (ticket.CurrentStatus != "Resolved" && ticket.CurrentStatus != "Closed"); bool isAssignedToMe = (!string.IsNullOrEmpty(ticket.AssignedTo) && ticket.AssignedTo == userName); bool isOwnedByMe = (ticket.Owner == userName); bool isMoreInfo = (ticket.CurrentStatus == "More Info"); bool isResolved = (ticket.CurrentStatus == "Resolved"); switch (activity) { case TicketActivity.NoChange: isAllowed = true; break; case TicketActivity.GetTicketInfo: isAllowed = true; break; case TicketActivity.Create: isAllowed = true; break; case TicketActivity.CreateOnBehalfOf: isAllowed = true; break; case TicketActivity.ModifyAttachments: isAllowed = isOpen; break; case TicketActivity.EditTicketInfo: isAllowed = isOpen && (Security.IsTdStaff() || isOwnedByMe); break; case TicketActivity.AddComment: isAllowed = isOpen && !isMoreInfo; break; case TicketActivity.SupplyMoreInfo: isAllowed = isMoreInfo; break; case TicketActivity.Resolve: isAllowed = isOpen && !isMoreInfo && isAssignedToMe; break; case TicketActivity.RequestMoreInfo: isAllowed = isOpen && !isMoreInfo && isAssignedToMe; break; case TicketActivity.CancelMoreInfo: isAllowed = isMoreInfo && isAssignedToMe; break; case TicketActivity.Close: isAllowed = isResolved && isOwnedByMe; break; case TicketActivity.ReOpen: isAllowed = !isOpen; break; case TicketActivity.TakeOver: isAllowed = (isOpen || isResolved) && !isAssignedToMe && Security.IsTdStaff(); break; case TicketActivity.TakeOverWithPriority: isAllowed = (isOpen || isResolved) && !isAssignedToMe && Security.IsTdStaff(); break; case TicketActivity.Assign: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && !isAssigned; break; case TicketActivity.AssignWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && !isAssigned; break; case TicketActivity.ReAssign: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssigned && !isAssignedToMe; ; break; case TicketActivity.ReAssignWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssigned && !isAssignedToMe; ; break; case TicketActivity.Pass: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssignedToMe; break; case TicketActivity.PassWithPriority: isAllowed = (isOpen || isResolved) && Security.IsTdStaff() && isAssignedToMe; break; case TicketActivity.GiveUp: isAllowed = (isOpen || isResolved) && isAssignedToMe; break; case TicketActivity.ForceClose: isAllowed = (isOpen || isResolved) && (isAssignedToMe || isOwnedByMe) && !(isResolved && isOwnedByMe); break; } } return isAllowed; }
public bool IsTicketActivityValid(Ticket ticket, TicketActivity activity) { return GetValidTicketActivities(ticket).HasFlag(activity); }
public bool IsTicketActivityValid(Ticket ticket, TicketActivity activity) { return(GetValidTicketActivities(ticket).HasFlag(activity)); }
/// <summary> /// Checks the security for ticket activity for the current user. /// </summary> /// <param name="ticket">The ticket.</param> /// <param name="activity">The activity.</param> /// <returns></returns> public bool CheckSecurityForTicketActivity(Ticket ticket, TicketActivity activity) { return CheckSecurityForTicketActivity(ticket, activity, Security.CurrentUserName); }
public void onActivityCreation(TicketActivity activity, AbstractTicketParam tkParam) { return; }
public ActionResult Create(DateTime date, TimeSpan time, string activity) { try { var user = UserManager.FindById(User.Identity.GetUserId()); var ticketActivity = new TicketActivity { Date = date, Time = time, Activity = activity, idTicket = IDTicket, User = user.Email }; using (var context = new PlusBContext()) { context.TicketActivities.Add(ticketActivity); context.SaveChanges(); this.AddToastMessage("Incident", "Activity added to the incident number " + ticketActivity.idTicket, ToastType.Success); } if (User.IsInRole("Consultant")) { var customerEmail = db.Tickets .Where(x => x.Id == IDTicket) .Select(x => x.Creator) .FirstOrDefault(); emailToSend = customerEmail; activityToSend = activity; //Code to call Store Procedure... SqlConnection connection = new SqlConnection("Data Source=KEIDY-LPT\\SQLEXPRESS;Initial Catalog=PlusBContext;Integrated Security=True;"); var command = new SqlCommand("getNotificationFlag", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@emailUser", emailToSend); connection.Open(); int queryResult = (int)command.ExecuteScalar(); connection.Close(); if (queryResult == 1) { SendEmail(); // send notification } } else { var consultantEmail = db.Tickets .Where(x => x.Id == IDTicket) .Select(x => x.Id_Consultant) .FirstOrDefault(); var consultant_Email = db.Consultants .Where(y => y.ID == consultantEmail) .Select(y => y.Email) .FirstOrDefault(); emailToSend = consultant_Email; activityToSend = activity; //Code to call Store Procedure... SqlConnection connection = new SqlConnection("Data Source=KEIDY-LPT\\SQLEXPRESS;Initial Catalog=PlusBContext;Integrated Security=True;"); var command = new SqlCommand("getNotificationFlag", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@emailUser", emailToSend); connection.Open(); int queryResult = (int)command.ExecuteScalar(); connection.Close(); if (queryResult == 1) { SendEmail(); // send notification } } } catch (Exception ex) { logger.Error(ex.ToString()); } if (User.IsInRole("Consultant")) { return(RedirectToAction("Assigned", "Tickets", new { id = IDTicket })); } else { return(RedirectToAction("incidentCreated", "Tickets", new { id = IDTicket })); } }
protected void onActivityHandler(TicketActivity ticketActivity, AbstractTicketParam tkParam) { actMssgHandlers.ForEach(t => t.onActivityCreation(ticketActivity, tkParam)); }
private bool CheckSecurity(Ticket ticket, TicketActivity activity) { if (!IsTicketActivityValid(ticket, activity)) { throw new SecurityException("User is not authorized to perform this activity."); } return true; }
public void DeleteActivity(int activityId) { TicketActivity activity = context.TicketActivities.Find(activityId); context.TicketActivities.Remove(activity); }
private Action<Ticket> ChangeAssignment(string comment, string assignTo, string priority, TicketActivity activity) { return ticket => { if (SecurityProvider.CurrentUserId == assignTo) //attempting to assign/reassign to self { TakeOver(comment, priority)(ticket); } else { if (CheckSecurity(ticket, activity)) { ticket.AssignedTo = assignTo; if (!string.IsNullOrEmpty(priority)) { if (ticket.Priority == priority) { priority = null; } else { ticket.Priority = priority; } } ticket.TicketEvents.AddActivityEvent(SecurityProvider.CurrentUserId, activity, comment, priority, SecurityProvider.GetUserDisplayName(assignTo)); } } }; }
public void onActivityCreation(TicketActivity activity, AbstractTicketParam tkParam) { activityIds.Add(activity.Id); }
private Action <Ticket> ChangeAssignment(string comment, string assignTo, string priority, TicketActivity activity) { return(ticket => { if (SecurityProvider.CurrentUserId == assignTo) //attempting to assign/reassign to self { TakeOver(comment, priority)(ticket); } else { if (CheckSecurity(ticket, activity)) { ticket.AssignedTo = assignTo; if (!string.IsNullOrEmpty(priority)) { if (ticket.Priority == priority) { priority = null; } else { ticket.Priority = priority; } } ticket.TicketEvents.AddActivityEvent(SecurityProvider.CurrentUserId, activity, comment, priority, SecurityProvider.GetUserDisplayName(assignTo)); } } }); }
private async Task <ActionResult> PerformTicketAction(int ticketId, Action <Ticket> activityFn, TicketActivity activity) { var ticket = await Context.Tickets.FindAsync(ticketId); TryValidateModel(ticket); if (ModelState.IsValid) { try { ticket.PerformAction(activityFn); } catch (SecurityException ex) { ModelState.AddModelError("Security", ex); } var result = await Context.SaveChangesAsync(); //save changes catches lastupdatedby and date automatically if (result > 0) { return(new EmptyResult());//standard success case } } //fail case, return the view and let the client/view sort out the errors ViewBag.CommentRequired = activity.IsCommentRequired(); ViewBag.Activity = activity; ViewBag.IsEditorDefaultHtml = Context.TicketDeskSettings.ClientSettings.GetDefaultTextEditorType() == "summernote"; return(PartialView("_ActivityForm", ticket)); }
/// <summary> /// Gets the activity comment. Infers a comment flag. /// </summary> /// <param name="activity">The activity.</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, string comment, string assignedTo, string[] notificationSubscribers, params string[] args) { var cFlag = (string.IsNullOrEmpty(comment)) ? TicketCommentFlag.CommentNotSupplied : TicketCommentFlag.CommentSupplied; return GetActivityComment(activity, cFlag, comment, assignedTo, notificationSubscribers, args); }
private async Task<ActionResult> PerformTicketAction(int ticketId, Action<Ticket> activityFn, TicketActivity activity) { var ticket = await Context.Tickets.FindAsync(ticketId); TryValidateModel(ticket); if (ModelState.IsValid) { try { ticket.PerformAction(activityFn); } catch (SecurityException ex) { ModelState.AddModelError("Security", ex); } var result = await Context.SaveChangesAsync(); //save changes catches lastupdatedby and date automatically if (result > 0) { return new EmptyResult();//standard success case } } //fail case, return the view and let the client/view sort out the errors ViewBag.CommentRequired = activity.IsCommentRequired(); ViewBag.Activity = activity; ViewBag.IsEditorDefaultHtml = Context.TicketDeskSettings.ClientSettings.GetDefaultTextEditorType() == "summernote"; return PartialView("_ActivityForm", ticket); }
/// <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; }
public void InsertActivity(TicketActivity activity) { context.TicketActivities.Add(activity); }