Esempio n. 1
0
        private void OnMenuClick(object sender, EventArgs e)
        {
            //Event handler for mneu item clicked
            try {
                ToolStripDropDownItem menu = (ToolStripDropDownItem)sender;
                switch (menu.Text)
                {
                case MNU_NEW:
                    Action action = new Action();
                    action.IssueID     = this.mIssue.ID;
                    action.TypeID      = 0;
                    action.UserID      = Environment.UserName;
                    action.Created     = DateTime.Now;
                    action.Comment     = "";
                    action.Attachments = 0;
                    dlgAction dlgNA = new dlgAction(action, this.mIssue);
                    dlgNA.Font = this.Font;
                    if (dlgNA.ShowDialog(this) == DialogResult.OK)
                    {
                        //Add the action to the issue
                        CustomerProxy.CreateIssueAction(action.TypeID, action.IssueID, action.UserID, action.Comment);
                        if (this.IssueChanged != null)
                        {
                            this.IssueChanged(this.mIssue, EventArgs.Empty);
                        }
                        loadActions();
                    }
                    break;

                case MNU_PRINT:
                    WinPrinter2 wp  = new WinPrinter2("", this.txtAction.Font);
                    string      doc = "Issue Type: \t" + this.mIssue.Type + "\r\nSubject: \t\t" + this.mIssue.Subject + "\r\nContact: \t\t" + this.mIssue.ContactName + "\r\n" + "\r\nCompany: \t" + this.mIssue.CompanyName + "\r\nStore#: \t\t" + this.mIssue.StoreNumber.ToString() + "\r\nAgent#: \t" + this.mIssue.AgentNumber + "\r\nZone: \t\t" + this.mIssue.Zone;
                    doc += "\r\n\r\n\r\n";
                    Action[] actions = CustomerProxy.GetIssueActions(this.mIssue.ID);
                    for (int i = 0; i < actions.Length; i++)
                    {
                        doc += actions[i].Created.ToString("f") + "     " + actions[i].UserID + ", " + actions[i].TypeName;
                        doc += "\r\n\r\n";
                        doc += actions[i].Comment;
                        doc += "\r\n";
                        doc += "".PadRight(75, '-');
                        doc += "\r\n";
                    }
                    wp.Print(this.mIssue.Subject, doc, true);
                    break;

                case MNU_REFRESH:       Refresh(); break;

                case MNU_ARRANGEBYDATE: break;
                }
            }
            catch (Exception ex) { reportError(new ControlException("Unexpected error setting IssueInspector menu services.", ex)); }
        }
Esempio n. 2
0
        private string getAllActionComments()
        {
            //Get a running comment for this action
            string comments = "";

            Action[] actions = CustomerProxy.GetIssueActions(this.mIssue.ID);
            for (int i = 0; i < actions.Length; i++)
            {
                Action action = actions[i];
                if (i > 0)
                {
                    comments += "\r\n\r\n";
                    comments += "".PadRight(75, '-');
                    comments += "\r\n";
                }
                comments += action.Created.ToString("f") + ", " + action.UserID + ", " + action.TypeName;
                comments += "\r\n\r\n";
                comments += action.Comment;
            }
            return(comments);
        }
Esempio n. 3
0
        private void loadActions()
        {
            //Event handler for change in actions collection
            //Load actions for this issue
            this.lsvActions.Groups.Clear();
            this.lsvActions.Items.Clear();
            if (this.mIssue != null)
            {
                //Create action listitems sorted by date/time
                Action[] actions = CustomerProxy.GetIssueActions(this.mIssue.ID);
                this.mActions = actions;
                for (int i = 0; i < actions.Length; i++)
                {
                    //Add attachment symbol as required
                    //Tag is used to enable attachement to newest action only
                    Action       action = actions[i];
                    ListViewItem item   = this.lsvActions.Items.Add(action.ID.ToString(), action.UserID, (action.Attachments > 0 ? 0 : -1));
                    item.Tag = i.ToString();

                    //Assign to listitem group
                    DateTime created      = action.Created;
                    bool     useYesterday = DateTime.Today.DayOfWeek != DayOfWeek.Monday;
                    if (created.CompareTo(DateTime.Today) >= 0)
                    {
                        this.lsvActions.Groups.Add("Today", "Today");
                        item.SubItems.Add(created.ToString("ddd HH:mm"));
                        item.Group = this.lsvActions.Groups["Today"];
                    }
                    else if (useYesterday && created.CompareTo(DateTime.Today.AddDays(-1)) >= 0)
                    {
                        this.lsvActions.Groups.Add("Yesterday", "Yesterday");
                        item.SubItems.Add(created.ToString("ddd HH:mm"));
                        item.Group = this.lsvActions.Groups["Yesterday"];
                    }
                    else if (created.CompareTo(DateTime.Today.AddDays(0 - DateTime.Today.DayOfWeek)) >= 0)
                    {
                        this.lsvActions.Groups.Add("This Week", "This Week");
                        item.SubItems.Add(created.ToString("ddd HH:mm"));
                        item.Group = this.lsvActions.Groups["This Week"];
                    }
                    else if (created.CompareTo(DateTime.Today.AddDays(0 - DateTime.Today.DayOfWeek - 7)) >= 0)
                    {
                        this.lsvActions.Groups.Add("Last Week", "Last Week");
                        item.SubItems.Add(created.ToString("ddd MM/dd HH:mm"));
                        item.Group = this.lsvActions.Groups["Last Week"];
                    }
                    else
                    {
                        this.lsvActions.Groups.Add("Other", "Other");
                        item.SubItems.Add(created.ToString("ddd MM/dd/yyyy HH:mm"));
                        item.Group = this.lsvActions.Groups["Other"];
                    }
                }
            }
            if (this.lsvActions.Items.Count > 0)
            {
                this.lsvActions.Items[0].Selected = true;
            }
            else
            {
                OnActionSelected(null, EventArgs.Empty);
            }
        }