コード例 #1
0
        public void Populate(string linkUrl)
        {
            if (TicketToDisplay != null)
            {
                TicketAttachmentsDataSource.WhereParameters["TicketId"].DefaultValue = TicketToDisplay.TicketId.ToString();
                AttachmentsRepeater.DataSourceID = "TicketAttachmentsDataSource";
                AttachmentsRepeater.DataBind();
                TicketId.Text           = TicketToDisplay.TicketId.ToString();
                TicketId.NavigateUrl    = linkUrl;
                TicketTitle.Text        = TicketToDisplay.Title;
                TicketTitle.NavigateUrl = linkUrl;
                if (TicketToDisplay.IsHtml)
                {
                    Details.Text = TicketToDisplay.Details;
                }
                else
                {
                    var md = new Markdown();
                    Details.Text = md.Transform(TicketToDisplay.Details, true);
                }
                Category.Text = TicketToDisplay.Category;
                //Category.NavigateUrl = string.Format("~/TicketCenter.aspx?View=tagsandcategories&Category={0}", TicketToDisplay.Category);
                TicketType.Text        = TicketToDisplay.Type;
                TicketType.NavigateUrl = linkUrl;
                CreatedBy.Text         = SecurityManager.GetUserDisplayName(TicketToDisplay.CreatedBy);
                CreatedDate.Text       = TicketToDisplay.CreatedDate.ToString("g");
                Owner.Text             = SecurityManager.GetUserDisplayName(TicketToDisplay.Owner);
                AssignedTo.Text        = SecurityManager.GetUserDisplayName(TicketToDisplay.AssignedTo);
                //AssignedTo.NavigateUrl = string.Format("~/TicketCenter.aspx?View=assigned&User={0}", TicketToDisplay.AssignedTo);
                CurrentStatus.Text = TicketToDisplay.CurrentStatus;
                //CurrentStatus.NavigateUrl = string.Format("~/TicketCenter.aspx?View=status&Status={0}", TicketToDisplay.CurrentStatus.Replace(" ", string.Empty).ToLowerInvariant());
                CurrentStatusBy.Text   = SecurityManager.GetUserDisplayName(TicketToDisplay.CurrentStatusSetBy);
                CurrentStatusDate.Text = TicketToDisplay.CurrentStatusDate.ToString("g");
                LastUpdateBy.Text      = SecurityManager.GetUserDisplayName(TicketToDisplay.LastUpdateBy);
                LastUpdateDate.Text    = TicketToDisplay.LastUpdateDate.ToString("g");
                Priority.Text          = TicketToDisplay.Priority;

                AffectsCustomer.Text = (TicketToDisplay.AffectsCustomer) ? "Yes" : "No";
                PublishedToKb.Text   = (TicketToDisplay.PublishedToKb) ? "Yes" : "No";

                var Tags = from t in TicketToDisplay.TicketTags
                           select new
                {
                    //Url = string.Format("~/TicketCenter.aspx?View=tagsandcategories&TagName={0}", t.TagName),
                    TagName = t.TagName
                };
                TagRepeater.DataSource = Tags;
                TagRepeater.DataBind();

                CommentLogRepeater.DataSource = TicketToDisplay.TicketComments.OrderByDescending(tc => tc.CommentedDate);
                CommentLogRepeater.DataBind();
            }
        }
コード例 #2
0
 internal void Refresh()
 {
     AttachmentsRepeater.DataBind();
 }
コード例 #3
0
        private void SetupForActivity()
        {
            CommentPanel.Visible     = true;
            CommitButton.Visible     = true;
            AssignPanel.Visible      = false;
            NoChangesPanel.Visible   = false;
            AttachmentsPanel.Visible = false;

            RequiredCommentLabel.Visible    = false;
            SupplyMoreInfoPanel.Visible     = false;
            AddCommentPanel.Visible         = false;
            ReopenStaffPanel.Visible        = false;
            ActivityNotAllowedPanel.Visible = false;
            CancelButton.Text = "Nevermind";
            if (!CheckIsActivityAllowed())
            {
                Activity = "Invalid";
            }

            switch (Activity)
            {
            case "NoChanges":
                NoChangesPanel.Visible = true;
                CommentPanel.Visible   = false;
                CommitButton.Visible   = false;
                CancelButton.Text      = "Continue";

                break;

            case "Invalid":
                ActivityNotAllowedPanel.Visible = true;
                CommentPanel.Visible            = false;
                CommitButton.Visible            = false;
                CancelButton.Text = "Refresh";
                ActivityFailed();
                break;

            case "EditTicket":
                ActivityLabel.Text       = "Edit Ticket";
                CommitButton.Text        = "Save Changes";
                CommentFieldLabel.Text   = "Notes & Comments:";
                ActivityDescription.Text = "Make changes to a ticket's details, title, or other fields.";
                break;

            case "AddAttachments":
                AttachmentsPanel.Visible = true;
                CommitButton.Text        = "Update";
                ActivityLabel.Text       = "Manage Attachments";
                ActivityDescription.Text = "Upload new attachments, change file descriptions or remove attachments.";

                ScriptManager.GetCurrent(Page).RegisterPostBackControl(CommitButton);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append(@"var multi_selector = new MultiSelector(document.getElementById('files_list'), 3);");
                sb.Append(@"multi_selector.addElement(document.getElementById('my_file_element'));");
                sb.Append(@"</script>");

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "AttachmentsJSScript", sb.ToString(), false);
                AttachmentsRepeater.DataBind();
                break;

            case "AddComment":
                ActivityLabel.Text                = "Add a Comment";
                CommitButton.Text                 = "Add Comment";
                CommentFieldLabel.Text            = "Comments:";
                ActivityDescription.Text          = "Add a comment to the ticket.";
                AddCommentPanel.Visible           = true;
                ResolveCheckBox.Checked           = false;
                ResolvedCheckBoxContainer.Visible = (TicketToDisplay.AssignedTo == Page.User.Identity.GetFormattedUserName());
                break;

            case "SupplyInfo":
                ActivityLabel.Text          = "Provide Additional Information";
                CommitButton.Text           = "Provide Info";
                CommentFieldLabel.Text      = "Additional Information & Comments:";
                SupplyMoreInfoPanel.Visible = true;
                SupplyInfoActivateTicketCheckBox.Checked = true;
                ActivityDescription.Text = "Supply additional information as requested by the TicketDesk staff and (optionally) mark the ticket active again.";
                break;

            case "Resolve":
                ActivityLabel.Text       = "Resolve Ticket";
                CommitButton.Text        = "Resolve";
                CommentFieldLabel.Text   = "Resolution:";
                ActivityDescription.Text = "Mark the ticket resolved.";
                break;

            case "RequestMoreInfo":
                ActivityLabel.Text       = "Request More Information";
                CommitButton.Text        = "Request Info";
                CommentFieldLabel.Text   = "Describe the information required:";
                ActivityDescription.Text = "Request more information from the ticket's owner.";
                break;

            case "CancelMoreInfo":
                ActivityLabel.Text       = "Cancel Request for More Information";
                CommitButton.Text        = "Cancel Request";
                CommentFieldLabel.Text   = "Comments:";
                ActivityDescription.Text = "Cancel the request for more information and mark the ticket active again.";
                break;

            case "CloseTicket":
                ActivityLabel.Text       = "Close Ticket";
                CommitButton.Text        = "Close Ticket";
                CommentFieldLabel.Text   = "Comments:";
                ActivityDescription.Text = "Close the ticket.";
                break;

            case "ReopenTicket":
                ActivityLabel.Text       = "Re-Open Ticket";
                CommitButton.Text        = "Re-Open";
                CommentFieldLabel.Text   = "Reason for reactivation:";
                ActivityDescription.Text = "Mark ticket as active again.";
                if (SecurityManager.IsStaff)
                {
                    ReopenStaffPanel.Visible = true;
                    ReopenAssignToMe.Checked = true;
                    ReopenOwnedByMe.Checked  = false;
                }
                break;

            case "TakeOver":
                ActivityLabel.Text       = "Take Over Ticket";
                CommitButton.Text        = "Take Over";
                CommentFieldLabel.Text   = "Comments";
                ActivityDescription.Text = "Assign the ticket to yourself.";
                break;

            case "Assign":
                if (string.IsNullOrEmpty(TicketToDisplay.AssignedTo))
                {
                    ActivityLabel.Text = "Assign Ticket";
                    CommitButton.Text  = "Assign";
                }
                else
                {
                    ActivityLabel.Text = "Reassign Ticket";
                    CommitButton.Text  = "Reassign";
                }
                CommentFieldLabel.Text   = "Comments:";
                ActivityDescription.Text = "Assign the ticket to another member of the TicketDesk staff.";
                AssignPanel.Visible      = true;

                BuildPriorityList();
                BuildAssignedUserList();

                break;

            case "GiveUp":
                ActivityLabel.Text       = "Give Up!";
                CommitButton.Text        = "Give Up";
                CommentFieldLabel.Text   = "Reason for giving up:";
                ActivityDescription.Text = "Mark the ticket as unassigned so it can be taken over or re-assigned to another member of the TicketDesk staff";
                break;

            case "ForceClose":
                ActivityLabel.Text       = "Close Ticket by Force";
                CommitButton.Text        = "Close";
                CommentFieldLabel.Text   = "Reason for force closing:";
                ActivityDescription.Text = "Marks the ticket as closed immediatly, bypassing the normal resolved state.";
                break;
            }
        }