private void button2_Click(object sender, EventArgs e) { PrintDialog pd = new PrintDialog(); PrinterSettings ps = new PrinterSettings(); pd.PrinterSettings = ps; DialogResult dr = pd.ShowDialog(); if (dr == DialogResult.OK) { PCPrint printer = new PCPrint(); printer.PrinterSettings.PrinterName = pd.PrinterSettings.PrinterName; printer.PrinterFont = new Font("Verdana", 10); printer.TextToPrint = txtWallet.Text; printer.Print(); } }
private void button4_Click(object sender, EventArgs e) { //data holders string creator = ""; string DC = ""; string stat = ""; string priority = ""; string Device = ""; string type = ""; string notes = ""; string adnotes = ""; //people who have handled string fp = ""; string sp = ""; string tp = ""; string ep = ""; //dates of when handled string fd = ""; string sd = ""; string td = ""; string ed = ""; //escalation status string es = ""; //reason why returning string reason = ""; //Phone Number string phone = ""; //Assignee name string assigned = ""; //load Data EquipReDataContext db = new EquipReDataContext(); var r = from p in db.EquipmentReturns where p.IDText.Contains(RID) select p; foreach (var x in r) { creator = x.Ticketor; DC = x.DateCreated.ToString(); stat = "" + x.TicketStatus; if (stat == "F") { stat = "Follow-Up"; } if (stat == "C") { stat = "Closed"; } if (stat == "P") { stat = "Pending"; } if (stat == "O") { stat = "Open"; } priority = x.Priority + ""; if (priority == "L") { priority = "Low"; } if (priority == "M") { priority = "Medium"; } if (priority == "H") { priority = "High"; } phone = x.Phone_Number; Device = x.TagID; type = "Return"; notes = x.Notes; adnotes = x.AdditionalNotes; //contact people fp = x.FirstContactPerson; sp = x.SecondContactPerson; tp = x.ThirdContactperson; ep = x.EscalationAgent; assigned = x.Assignee; //contact dates if (x.FirstContactDate.ToString() != "01/01/1990 12:00:00 AM") { fp = x.FirstContactPerson; fd = x.FirstContactDate.ToString(); } else { fp = ""; fd = "No contact"; } if (x.SecondContactDate.ToString() != "01/01/1990 12:00:00 AM") { sp = x.SecondContactPerson; sd = x.SecondContactDate.ToString(); } else { sp = ""; sd = "No contact"; } if (x.ThirdContactDate.ToString() != "01/01/1990 12:00:00 AM") { tp = x.ThirdContactperson; td = x.ThirdContactDate.ToString(); } else { tp = ""; td = "No contact"; } reason = x.Reason; //escalation status if (x.EscalationStatus == true) { es = "Escalated"; ep = x.EscalationAgent; ed = x.EscalationDate.ToString(); } else { es = "Not Escalated"; ep = ""; ed = "No Contact"; } } //get a new class for printing PCPrint printer = new PCPrint(); //sent font printer.PrinterFont = new Font("Arial", 10); //set text printer.TextToPrint = " " + "CNS" + spacer(100, ' ') + "Ticket ID: " + RID + "\r\nIT Ticketing System" + "\r\n\r\n\r\n"; printer.TextToPrint += "Creator of ticket: " + creator + "\r\n"; printer.TextToPrint += "Date Created: " + DC + "\r\n"; printer.TextToPrint += "Status: " + stat + "\r\n"; printer.TextToPrint += "Priority: " + priority + "\r\n"; printer.TextToPrint += "Device ID: " + Device + "\r\n"; printer.TextToPrint += "Issue Type: " + type + "\r\n"; printer.TextToPrint += "Reason: " + reason + "\r\n"; printer.TextToPrint += "Device Assigned to: " + assigned + "\r\n"; printer.TextToPrint += "Phone Number Called: " + phone + "\r\n"; printer.TextToPrint += "First contact: " + fp + " (" + fd + ")\r\n"; printer.TextToPrint += "Second contact: " + sp + " (" + sd + ")\r\n"; printer.TextToPrint += "Third contact: " + tp + " (" + td + ")\r\n"; printer.TextToPrint += es + "\r\n"; printer.TextToPrint += "Escalation information: " + ep + " (" + ed + ")\r\n\r\n"; printer.TextToPrint += spacer(65, ' ') + "Notes:\r\n" + spacer(125, '-') + "\r\n" + notes + "\r\n" + spacer(125, '-') + "\r\n\r\n"; printer.TextToPrint += spacer(65, ' ') + "Additional Notes:\r\n" + spacer(125, '-') + "\r\n" + adnotes + "\r\n" + spacer(125, '-') + "\r\n\r\n"; //print printer.Print(); }
//print private void button1_Click(object sender, EventArgs e) { //data holders string creator = ""; string cemail = ""; string cphone = ""; string DC = ""; string stat = ""; string priority = ""; string Device = ""; string type = ""; string resolver = ""; string daresolv = ""; string eresolv = ""; string presolv = ""; string issue = ""; string notes = ""; string resolution = ""; string supported = ""; string Assigned = ""; //load Data TicketsDBDataContext db = new TicketsDBDataContext(); var r = from p in db.Ticketers where p.ID2 == CaseID select p; foreach (var x in r) { creator = x.Ticketor; cemail = x.Temail; cphone = x.Tphone; DC = x.Dissue; stat = "" + x.Status; if (stat == "F") { stat = "Follow-Up"; } if (stat == "C") { stat = "Closed"; } if (stat == "P") { stat = "Pending"; } if (stat == "O") { stat = "Open"; } priority = x.Priority + ""; if (priority == "L") { priority = "Low"; } if (priority == "M") { priority = "Medium"; } if (priority == "H") { priority = "High"; } if (x.Supported) { supported = "Issue is Supported by CNS IT"; } else if (!x.Supported) { supported = "Issue is NOT supported by CNS IT"; } Device = x.DeviceID; type = x.IssueType; resolver = x.Resolver; daresolv = x.Dresolve; eresolv = x.Remail; presolv = x.Rphone; issue = x.Issue; notes = x.Notes; resolution = x.Resolution; Assigned = x.Assigned; } //get a new class for printing PCPrint printer = new PCPrint(); //sent font printer.PrinterFont = new Font("Arial", 10); //set text printer.TextToPrint = " " + "CNS" + spacer(100, ' ') + "Ticket ID: " + CaseID + "\r\nIT Ticketing System" + "\r\n\r\n\r\n"; printer.TextToPrint += "Creator of ticket: " + creator + "\r\n"; printer.TextToPrint += "Creator's email: " + cemail + "\r\n"; printer.TextToPrint += "Creator's phone Number: " + cphone + "\r\n"; printer.TextToPrint += "Date Created: " + DC + "\r\n"; printer.TextToPrint += "Status: " + stat + "\r\n"; printer.TextToPrint += supported + "\r\n"; printer.TextToPrint += "Priority: " + priority + "\r\n"; printer.TextToPrint += "Device ID(If any): " + Device + "\r\n"; printer.TextToPrint += "Issue Type: " + type + "\r\n"; printer.TextToPrint += "Assigned to: " + Assigned + "\r\n"; printer.TextToPrint += "Resolver: " + resolver + "\r\n"; printer.TextToPrint += "Resolver email: " + eresolv + "\r\n"; printer.TextToPrint += "Resolver phone Number: " + presolv + "\r\n"; printer.TextToPrint += "Date Resolved: " + daresolv + "\r\n"; printer.TextToPrint += "\r\n\r\n" + spacer(70, ' ') + "Issue:\r\n" + spacer(125, '-') + "\r\n" + issue + "\r\n" + spacer(125, '-') + "\r\n\r\n"; printer.TextToPrint += spacer(65, ' ') + "Additional Notes:\r\n" + spacer(125, '-') + "\r\n" + notes + "\r\n" + spacer(125, '-') + "\r\n\r\n"; printer.TextToPrint += spacer(67, ' ') + "Resolution\r\n" + spacer(125, '-') + "\r\n" + resolution; //print printer.Print(); }