public PrinterDataEntity ProcessPrinterInfo() { PrinterDataEntity printer = new PrinterDataEntity(); printer.Name = txtprinter.Text; printer.Model = txtmodel.Text; printer.Active = rdbactive.Checked ? true : false; return printer; }
public static bool PrintCheckList(LaundryHeaderDataEntity header, PrinterDataEntity printer) { try { SetPrinter(printer); if (ps == null) return false; StringBuilder sb = new StringBuilder(); sb.Append(SetAlignment("CENTER")); sb.Append(SetFontSize(2)); sb.AppendLine("CHECKLIST"); sb.Append(SetFontSize(0)); sb.AppendLine(""); sb.Append(SetAlignment("LEFT")); sb.AppendLine("SO#: " + header.LaundryHeaderID.ToString()); sb.AppendLine("CUSTOMER: " + header.Customer.Name); sb.AppendLine("DATE: " + header.ReceivedDate.ToShortDateString()); sb.AppendLine(""); sb.Append(SetAlignment("CENTER")); sb.Append(" ITEM # OF ITEMS"); sb.AppendLine(""); int qty = 0; foreach(LaundryJobChecklistDataEntity checklist in header.JobChecklistEntities) { sb.AppendLine(SetAlignment("CENTER") + " " + FormatStringAlignment(checklist.Checklist.Name.ToUpper(),"LEFT") + FormatStringAlignment(checklist.Qty.ToString(), "RIGHT")); qty += checklist.Qty; } sb.AppendLine(""); sb.AppendLine(""); sb.Append(SetAlignment("CENTER")); sb.AppendLine("LISTED "+ qty.ToString() +" of " +header.TotalItemQty.ToString() + " ITEMS"); sb.AppendLine(""); sb.AppendLine("******************************"); sb.AppendLine(""); sb.AppendLine(""); sb.Append(CutPaper()); RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString()); return true; } catch(Exception ex) { throw ex; } }
public void Delete(PrinterDataEntity p_printer) { using(var session = NHibernateHelper.OpenSession()) { using(var transaction = session.BeginTransaction()) { try { session.Delete(p_printer); transaction.Commit(); } catch(Exception ex) { transaction.Rollback(); throw ex; } } } }
public void SetPrinterInfo(List<PrinterDataEntity> p_printers) { m_printers = p_printers; if(m_printers.Count <= 0){ m_printerEntity = new PrinterDataEntity(); m_printers.Add(m_printerEntity); } foreach(PrinterDataEntity entity in m_printers){ m_printerEntity = entity; } txtprinter.Text = m_printerEntity.Name == null ? "" : m_printerEntity.Name; txtmodel.Text = m_printerEntity.Model == null ? "" : m_printerEntity.Model; //m_printerEntity.Active = m_printerEntity.Active == null ? false : m_printerEntity.Active; if(!m_printerEntity.Active){ rdbinactive.Checked = true; } rdbactive.Checked = rdbinactive.Checked ? false : true; foreach(string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters){ listBox1.Items.Add(printer); } }
private static void SetPrinter(PrinterDataEntity printer) { if(printer == null) return; ps = new PrinterSettings(); ps.PrinterName = printer.Name; return; }
public static bool PrintRefillSlip(PrinterDataEntity printer, RefillHeaderDataEntity header, CompanyDataEntity company) { try{ SetPrinter(printer); if (ps == null) return false; StringBuilder sb = new StringBuilder(); PrintRefillOrderSlip(ref sb, header,company); RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString()); return true; } catch(Exception ex) { throw ex; } }
public static bool PrintLaundrySlip(PrinterDataEntity printer, LaundryHeaderDataEntity header, CompanyDataEntity company) { try{ SetPrinter(printer); if (ps == null) return false; StringBuilder sb = new StringBuilder(); PrintClaimSlip(ref sb, header, company); RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString()); sb = new StringBuilder(); PrintTag(ref sb, header); ps.Copies = 1; RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString()); return true; } catch(Exception ex) { throw ex; } }