public HraHtmlDocument printHtmlDoc(int apptID, string unitnum, int templateID) { if (string.IsNullOrEmpty(printer) || printer.ToUpper() == "BATCH") { return null; } HraHtmlDocument hdoc = null; try { SessionManager.Instance.SetActivePatient(unitnum, apptID); hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return null; } hdoc.targetPrinter = printer; hdoc.apptid = apptID; if (printer.ToLower() != "batch") { hdoc.Print(); } } catch (Exception e) { Logger.Instance.WriteToLog("printHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ") " + e.ToString()); return null; } return hdoc; }
public HraHtmlDocument printHtmlDoc(int apptID, string unitnum, int templateID) { if (string.IsNullOrEmpty(printer) || printer.ToUpper() == "BATCH") { return(null); } HraHtmlDocument hdoc = null; try { SessionManager.Instance.SetActivePatient(unitnum, apptID); hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return(null); } hdoc.targetPrinter = printer; hdoc.apptid = apptID; if (printer.ToLower() != "batch") { hdoc.Print(); } } catch (Exception e) { Logger.Instance.WriteToLog("printHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ") " + e.ToString()); return(null); } return(hdoc); }
public bool savePdfDoc(int apptID, string unitnum, int templateID, string directory) { try { SessionManager.Instance.SetActivePatient(unitnum, apptID); directory = Configurator.GetDocumentStorage(); // override save location with config.xml if (directory.Substring(directory.Length - 1) != "\\") { directory = directory + "\\"; } string templateDirectory = Configurator.GetDocumentTemplateStorage(); // override save location with config.xml if (templateDirectory.Substring(templateDirectory.Length - 1) != "\\") { templateDirectory = templateDirectory + "\\"; } HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return(false); } hdoc.apptid = apptID; FileInfo fInfo = hdoc.template.CalculateFileName(SessionManager.Instance.GetActivePatient().name, SessionManager.Instance.GetActivePatient().apptdatetime.ToShortDateString().Replace("/", "-"), SessionManager.Instance.GetActivePatient().apptid, SessionManager.Instance.GetActivePatient().unitnum, "pdf", directory); string PdfFileName = fInfo.FullName; DocumentTemplate.ConvertToPdf(hdoc.template.htmlText, PdfFileName); } catch (Exception e) { Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString()); return(false); } return(true); }
public bool saveHtmlDoc(int apptID, string unitnum, int templateID, string directory) { try { SessionManager.Instance.SetActivePatient(unitnum, apptID); HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return(false); } hdoc.apptid = apptID; hdoc.Save(directory); } catch (Exception e) { Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString()); return(false); } return(true); }
public bool savePdfDoc(int apptID, string unitnum, int templateID, string directory) { try { SessionManager.Instance.SetActivePatient(unitnum, apptID); directory = Configurator.GetDocumentStorage(); // override save location with config.xml if (directory.Substring(directory.Length - 1) != "\\") directory = directory + "\\"; string templateDirectory = Configurator.GetDocumentTemplateStorage(); // override save location with config.xml if (templateDirectory.Substring(templateDirectory.Length - 1) != "\\") templateDirectory = templateDirectory + "\\"; HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return false; } hdoc.apptid = apptID; FileInfo fInfo = hdoc.template.CalculateFileName(SessionManager.Instance.GetActivePatient().name, SessionManager.Instance.GetActivePatient().apptdatetime.ToShortDateString().Replace("/", "-"), SessionManager.Instance.GetActivePatient().apptid, SessionManager.Instance.GetActivePatient().unitnum, "pdf", directory); string PdfFileName = fInfo.FullName; DocumentTemplate.ConvertToPdf(hdoc.template.htmlText,PdfFileName); } catch (Exception e) { Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString()); return false; } return true; }
public bool saveHtmlDoc(int apptID, string unitnum, int templateID, string directory) { try { SessionManager.Instance.SetActivePatient(unitnum, apptID); HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID); if (hdoc == null) { Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null"); return false; } hdoc.apptid = apptID; hdoc.Save(directory); } catch (Exception e) { Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString()); return false; } return true; }