public ActionResult AttachExperts(AttachViewModel model) { if (!isLoggedIn()) { return(RedirectToAction("Oops")); } if (!getUser().ActiveStatus) { return(View("Deactivated")); } Ticket ticket = _dbContext.Ticket.Find(model.TicketID); ApplicationUser user = _dbContext.Users.Find(model.UserID); AttachedUsers users = new AttachedUsers(); users.User = user; users.Ticket = ticket; _dbContext.AttachedUsers.Add(users); _dbContext.SaveChanges(); return(RedirectToAction("ViewTicket", ticket)); }
private void ShowAttachedUser(string ParentUserID) { try{ AttachedUsers.mParentUserId = ParentUserID.ToString(); AttachedUsers.AssignuserId(ParentUserID.ToString()); AttachedUsers.RetrieveAttachedUsers(); AttachedUsers.Visible = true; UnAttachedUsers.Visible = false; } catch { throw; } finally { } }
public ActionResult PostResponse(TicketContentsViewModel model) { if (!isLoggedIn()) { return(RedirectToAction("Oops")); } if (!getUser().ActiveStatus) { return(View("Deactivated")); } Ticket ticket = _dbContext.Ticket.Find(model.TicketID); Message message = new Message(); message.BodyText = model.MessageToPost; message.Date = System.DateTime.Now; message.User = getUser(); message.Ticket = ticket; if (model.Deactivate) { message.BodyText = "Expert " + getUser().Name + " has removed themselves from this ticket. Reason: \n" + message.BodyText; _dbContext.Messages.Add(message); _dbContext.SaveChanges(); AttachedUsers attached = _dbContext.AttachedUsers.Find(getUser().Id, ticket.ID); _dbContext.AttachedUsers.Remove(attached); _dbContext.SaveChanges(); return(RedirectToAction("Index")); } _dbContext.Messages.Add(message); _dbContext.SaveChanges(); return(RedirectToAction("ViewTicket", ticket)); }
protected void btnChange_Click(object sender, EventArgs e) { if (txtuser.Value != "" && txtuser.Value != "press F2 to search users") { if (IsValiddate() == true) { if (AttachedUsers.Changemanager(txtmanagerdate.Text, hdnManagerId.Value.ToString()) == true) { TreHierarchy.SelectedNode.ChildNodes.Clear(); RetrieveAttachedUsers(TreHierarchy.SelectedNode); ShowAttachedUser(TreHierarchy.SelectedNode.Value.ToString()); txtuser.Value = ""; txtmanagerdate.Text = ""; hdnManagerId.Value = ""; } } } else { this.alertError.Style["display"] = "block"; this.alertError.InnerHtml = "Select the manager"; } }