Ejemplo 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)); }
        }