示例#1
0
        public static string GetTagLink(RestCommand command, int tagLinkID)
        {
            TagLink tagLink = TagLinks.GetTagLink(command.LoginUser, tagLinkID);

            if (tagLink.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(tagLink.GetXml("TagLink", true));
        }
示例#2
0
        public void AddTicketTag(int tagID, int ticketID)
        {
            Tag    tag    = Tags.GetTag(UserSession.LoginUser, tagID);
            Ticket ticket = Tickets.GetTicket(UserSession.LoginUser, ticketID);

            if (tag.OrganizationID != UserSession.LoginUser.OrganizationID || ticket.OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return;
            }
            TagLink link = TagLinks.GetTagLink(UserSession.LoginUser, ReferenceType.Tickets, ticketID, tagID);

            if (link == null)
            {
                TagLinks links = new TagLinks(UserSession.LoginUser);
                link         = links.AddNewTagLink();
                link.RefType = ReferenceType.Tickets;
                link.RefID   = ticketID;
                link.TagID   = tagID;
                links.Save();
            }
        }