コード例 #1
0
        public string GenerateTicketLink(string txt)
        {
            Regex           regx     = new Regex(@"&ticket\d+", RegexOptions.IgnoreCase);
            MatchCollection mactches = regx.Matches(txt);
            int             ticketnum;
            Tickets         tix = new Tickets(BaseCollection.LoginUser);

            foreach (Match match in mactches)
            {
                ticketnum = Convert.ToInt32(Regex.Replace(match.Value, "[^0-9]+", string.Empty));
                tix.LoadByTicketNumber(BaseCollection.LoginUser.OrganizationID, ticketnum);
                if (!tix.IsEmpty)
                {
                    if (tix[0].OrganizationID == BaseCollection.LoginUser.OrganizationID)
                    {
                        txt = txt.Replace(match.Value, "<a class='ts-link ui-state-default' href='#' onclick='top.Ts.MainPage.openTicket(" + ticketnum + "); return false;'>ticket " + ticketnum + "</a>");
                    }
                }
            }

            return(txt);
        }
コード例 #2
0
        public AgentRatingProxy GetProxy()
        {
            AgentRatingProxy result = new AgentRatingProxy();

            result.TicketID       = this.TicketID;
            result.Comment        = this.Comment;
            result.Rating         = this.Rating;
            result.ContactID      = this.ContactID;
            result.CompanyID      = this.CompanyID;
            result.OrganizationID = this.OrganizationID;
            result.AgentRatingID  = this.AgentRatingID;

            result.DateCreated = DateTime.SpecifyKind(this.DateCreatedUtc, DateTimeKind.Utc);

            Tickets t = new Tickets(BaseCollection.LoginUser);

            t.LoadByTicketID(this.TicketID);

            result.TicketNumber = t[0].TicketNumber;

            AgentRatingsOptions options = new AgentRatingsOptions(BaseCollection.LoginUser);

            options.LoadByOrganizationID(this.OrganizationID);

            switch (this.Rating)
            {
            case -1:
                if (!options.IsEmpty)
                {
                    if (options[0].NegativeImage == null)
                    {
                        result.RatingText = "<img class='imgsm' src='../Images/face-negative.png' alt='negative' />";
                    }
                    else
                    {
                        result.RatingText = "<img style='width:20px;height:20px' src='" + options[0].NegativeImage + "' />";
                    }
                }
                else
                {
                    result.RatingText = "<img class='imgsm' src='../Images/face-negative.png' alt='negative' />";
                }

                break;

            case 0:
                if (!options.IsEmpty)
                {
                    if (options[0].NeutralImage == null)
                    {
                        result.RatingText = "<img class='imgsm' src='../Images/face-neutral.png' alt='neutral' />";
                    }
                    else
                    {
                        result.RatingText = "<img style='width:20px;height:20px' src='" + options[0].NeutralImage + "' />";
                    }
                }
                else
                {
                    result.RatingText = "<img class='imgsm' src='../Images/face-neutral.png' alt='neutral' />";
                }

                break;

            case 1:
                if (!options.IsEmpty)
                {
                    if (options[0].PositiveImage == null)
                    {
                        result.RatingText = "<img class='imgsm' src='../Images/face-positive.png' alt='positive' />";
                    }
                    else
                    {
                        result.RatingText = "<img style='width:20px;height:20px' src='" + options[0].PositiveImage + "' />";
                    }
                }
                else
                {
                    result.RatingText = "<img class='imgsm' src='../Images/face-positive.png' alt='positive' />";
                }
                break;
            }
            return(result);
        }
コード例 #3
0
        partial void AfterRowInsert(Action action)
        {
            string description = string.Format("Added {0} action ", action.IsVisibleOnPortal ? "public" : "private");

            if (_actionLogInstantMessage != null)
            {
                description = _actionLogInstantMessage;
            }
            ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Tickets, action.TicketID, description + action.Name + " to " + Tickets.GetTicketLink(LoginUser, action.TicketID));
            if (_updateChildTickets)
            {
                AddChildActions(action);
            }
        }
コード例 #4
0
        public WatercoolerAttachmentProxy GetProxy()
        {
            WatercoolerAttachmentProxy result = new WatercoolerAttachmentProxy();

            result.CreatorID    = this.CreatorID;
            result.RefType      = this.RefType;
            result.AttachmentID = this.AttachmentID;
            result.MessageID    = this.MessageID;

            result.DateCreated = DateTime.SpecifyKind(this.DateCreatedUtc, DateTimeKind.Utc);

            result.CreatorName = Users.GetUserFullName(BaseCollection.LoginUser, this.CreatorID);

            if (this.RefType == WaterCoolerAttachmentType.Group)
            {
                var group = Groups.GetGroup(BaseCollection.LoginUser, this.AttachmentID);
                if (group != null)
                {
                    result.GroupName = group.Name;
                }
                else
                {
                    return(null);
                }
            }

            if (this.RefType == WaterCoolerAttachmentType.Ticket)
            {
                var ticket = Tickets.GetTicketByNumber(BaseCollection.LoginUser, this.AttachmentID);
                if (ticket != null)
                {
                    result.TicketName = ticket.Name;
                }
                else
                {
                    return(null);
                }
            }

            if (this.RefType == WaterCoolerAttachmentType.Product)
            {
                var product = Products.GetProduct(BaseCollection.LoginUser, this.AttachmentID);
                if (product != null)
                {
                    result.ProductName = product.Name;
                }
                else
                {
                    return(null);
                }
            }

            if (this.RefType == WaterCoolerAttachmentType.Company)
            {
                var organization = Organizations.GetOrganization(BaseCollection.LoginUser, this.AttachmentID);
                if (organization != null)
                {
                    result.CompanyName = organization.Name;
                }
                else
                {
                    return(null);
                }
            }

            if (this.RefType == WaterCoolerAttachmentType.User)
            {
                var user = Users.GetUserFullName(BaseCollection.LoginUser, this.AttachmentID);
                if (user != null)
                {
                    result.UserName = user;
                }
                else
                {
                    return(null);
                }
            }

            if (this.RefType == WaterCoolerAttachmentType.Activities)
            {
                var activity = Notes.GetNote(BaseCollection.LoginUser, this.AttachmentID);
                if (activity != null)
                {
                    result.ActivityRefType = activity.RefType;
                    result.ActivityTitle   = activity.Title;
                    result.ActivityRefID   = activity.RefID;
                }
                else
                {
                    return(null);
                }
            }

            return(result);
        }
コード例 #5
0
        public static string GetTicketProperties(LoginUser loginUser, int ticketID)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItem(loginUser, ticketID);

            if (ticket == null)
            {
                return("");
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(@"<div style=""background-color: #EDF0F5; color: #004394; margin-bottom:10px; padding-left:5px; border: solid 1px #9FB0CF; font-size: 18px; font-weight: bold;"" class=""ui-corner-all"">Ticket Properties</div>");
            builder.Append(@"<table width=""100%"" cellpadding=""0"" cellspacing=""5"" border=""0"">");

            builder.Append("<tr>");
            builder.Append(GetColumn("Opened By", ticket.CreatorName));
            builder.Append(GetColumn("Opened On", ticket.DateCreated.ToString("g", loginUser.CultureInfo)));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Last Modified By", ticket.ModifierName));
            builder.Append(GetColumn("Last Modified On", ticket.DateModified.ToString("g", loginUser.CultureInfo)));

            builder.Append("</tr>");

            builder.Append("<tr>");
            if (ticket.IsClosed)
            {
                builder.Append(GetColumn("Days Closed", ticket.DaysClosed.ToString()));
            }
            else
            {
                builder.Append(GetColumn("Days Opened", ticket.DaysOpened.ToString()));
            }

            builder.Append(GetColumn("Total Time Spent", DataUtils.MinutesToDisplayTime(Tickets.GetTicketActionTime(ticket.Collection.LoginUser, ticket.TicketID))));
            builder.Append("</tr>");


            if (ticket.IsClosed && ticket.DateClosed != null)
            {
                builder.Append("<tr>");
                if (ticket.CloserID != null)
                {
                    builder.Append(GetColumn("Closed By", ticket.CloserName));
                }
                builder.Append(GetColumn("Closed On", ((DateTime)ticket.DateClosed).ToString("g", loginUser.CultureInfo)));
                builder.Append("</tr>");
            }


            builder.Append("<tr>");
            builder.Append(GetColumn("Ticket Type", ticket.TicketTypeName));
            builder.Append(GetColumn("Assigned Group", ticket.GroupName));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Status", ticket.Status));
            builder.Append(GetColumn("Product", ticket.ProductName));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Severity", ticket.Severity));
            builder.Append(GetColumn("Reported Version", ticket.ReportedVersion));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Assigned To", ticket.UserName));
            builder.Append(GetColumn("Resolved Version", ticket.SolvedVersion));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Visible On Portal", ticket.IsVisibleOnPortal.ToString()));
            builder.Append(GetColumn("Knowledge Base", ticket.IsKnowledgeBase.ToString()));
            builder.Append("</tr>");

            CustomFields fields = new CustomFields(ticket.Collection.LoginUser);

            fields.LoadByTicketTypeID(ticket.OrganizationID, ticket.TicketTypeID);

            bool flag = false;

            foreach (CustomField field in fields)
            {
                flag = !flag;
                if (flag)
                {
                    builder.Append("<tr>");
                }

                CustomValue value;
                value = CustomValues.GetValue(ticket.Collection.LoginUser, field.CustomFieldID, ticket.TicketID);
                builder.Append(GetColumn(field.Name + "", value.Value));
                if (!flag)
                {
                    builder.Append("</tr>");
                }
            }
            if (flag)
            {
                builder.Append("</tr>");
            }
            builder.Append("</table>");

            return(builder.ToString());
        }