private void OnMenuClick(object sender, EventArgs e) { //Event handler for mneu item clicked try { ToolStripDropDownItem menu = (ToolStripDropDownItem)sender; switch (menu.Text) { case MNU_NEW: Issue.Action action = this.mIssue.Item(0); dlgAction dlgNA = new dlgAction(action); dlgNA.Font = this.Font; if (dlgNA.ShowDialog(this) == DialogResult.OK) { //Add the action to the issue this.mIssue.Add(action); } break; case MNU_PRINT: WinPrinter2 wp = new WinPrinter2("", this.txtAction.Font); Issue i = this.mIssue; string doc = "Issue Type: \t" + i.Type + "\r\nSubject: \t\t" + i.Subject + "\r\nContact: \t\t" + i.Contact + "\r\n" + "\r\nCompany: \t" + i.Company + "\r\nStore#: \t\t" + i.StoreNumber.ToString() + "\r\nAgent#: \t" + i.AgentNumber + "\r\nZone: \t\t" + i.Zone; doc += "\r\n\r\n\r\n" + i.GetAllActionComments(); wp.Print(i.Subject, doc, true); break; case MNU_REFRESH: this.mIssue.Refresh(); break; case MNU_ARRANGEBYDATE: break; } } catch (Exception ex) { reportError(new ControlException("Unexpected error setting IssueInspector menu services.", ex)); } }
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)); } }