コード例 #1
0
        public ShowHtmlDataDto GetReportViewer2(string reportID, string loginDomain, string loginSite, string printTemplateID)
        {
            List <ProcedureDto> procedureDtos = GetProcedureByReportID(reportID).ToList();
            ProcedureDto        procedure     = procedureDtos[0];

            DataTable dt;
            string    templateInfo = "";

            //use store procedure
            Order           order           = _dbContext.Set <Order>().Where(p => p.UniqueID == procedure.OrderID).FirstOrDefault();
            string          accNo           = order.AccNo;
            string          modalityType    = procedure.ModalityType;
            ReportDBService reportDBService = new ReportDBService();
            string          templateID      = "";

            reportDBService.GetReportPrintTemplate(accNo, modalityType, reportID, loginSite, out templateID, out dt);


            //print templateID
            if (!string.IsNullOrEmpty(printTemplateID))
            {
                Report report = _dbContext.Set <Report>().Where(r => r.UniqueID == reportID).FirstOrDefault();
                if (report != null && report.Status < (int)RPStatus.FirstApprove)
                {
                    templateID = printTemplateID;
                }
            }

            if (templateID != "")
            {
                PrintTemplate printTemplate = _dbContext.Set <PrintTemplate>().Where(p => p.UniqueID == templateID).FirstOrDefault();
                if (printTemplate != null)
                {
                    templateInfo = generatePrintTemplate(printTemplate);
                }
            }
            else
            {
                return(null);
            }


            string templateGuid = ReportUtils.GetFirstRowValueFromDataSet(dt.DataSet, ReportCommon.FIELDNAME_tbReport__PrintTemplateGuid);

            DataTable newdt = generateDataTable4PrintingForReport(dt.DataSet, ref templateInfo, reportID, loginDomain);

            using (MemoryStream ms = new MemoryStream())
            {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(ms, newdt);

                return(new ShowHtmlDataDto {
                    Template = templateInfo, data = Convert.ToBase64String(ms.ToArray())
                });
            }
        }
コード例 #2
0
        public bool UpdateReportPrintStatusByProcedureID(string procedureID, string printer, string site, string domain)
        {
            bool result    = false;
            var  procedure = _dbContext.Set <Procedure>().Where(p => p.UniqueID == procedureID).FirstOrDefault();

            if (procedure != null && !String.IsNullOrEmpty(procedure.ReportID))
            {
                var       report          = _dbContext.Set <Report>().Where(p => p.UniqueID == procedure.ReportID).FirstOrDefault();
                var       order           = _dbContext.Set <Order>().Where(p => p.UniqueID == procedure.OrderID).FirstOrDefault();
                var       accNo           = order.AccNo;
                var       modalityType    = procedure.ModalityType;
                var       reportDBService = new ReportDBService();
                var       templateID      = String.Empty;
                DataTable templateDT      = null;
                reportDBService.GetReportPrintTemplate(accNo, modalityType, procedure.ReportID, site, out templateID, out templateDT);
                if (procedure.Status == (int)RPStatus.FirstApprove && !String.IsNullOrEmpty(templateID))
                {
                    report.IsPrint   = 1;
                    report.Optional1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    //report.PrintCopies++; Will be handled in tbReportPrintLog trigger
                    if (String.IsNullOrEmpty(report.PrintTemplateID))
                    {
                        report.PrintTemplateID = templateID;
                    }

                    result = true;
                }

                // update report print log
                _reportPrintLogRepository.Add(new ReportPrintLog
                {
                    UniqueID   = Guid.NewGuid().ToString(),
                    ReportID   = procedure.ReportID,
                    TemplateID = templateID,
                    Printer    = printer,
                    PrintDate  = DateTime.Now,
                    Type       = "Print",
                    Counts     = 1,
                    Domain     = domain
                });
                _dbContext.SaveChanges();
            }

            return(result);
        }
コード例 #3
0
        public string GetReportPrintTemplateID(string reportID, string loginDomain, string loginSite)
        {
            List <ProcedureDto> procedureDtos = GetProcedureByReportID(reportID).ToList();
            ProcedureDto        procedure     = procedureDtos[0];

            DataTable dt;

            //use store procedure
            Order           order           = _dbContext.Set <Order>().Where(p => p.UniqueID == procedure.OrderID).FirstOrDefault();
            string          accNo           = order.AccNo;
            string          modalityType    = procedure.ModalityType;
            ReportDBService reportDBService = new ReportDBService();
            string          templateID      = "";

            reportDBService.GetReportPrintTemplate(accNo, modalityType, reportID, loginSite, out templateID, out dt);

            return(templateID);
        }
コード例 #4
0
        public string GetReportViewer(string reportID, string loginDomain, string loginSite)
        {
            List <ProcedureDto> procedureDtos = GetProcedureByReportID(reportID).ToList();
            ProcedureDto        procedure     = procedureDtos[0];

            DataTable dt;
            string    templateInfo = "";

            //use store procedure
            Order           order           = _dbContext.Set <Order>().Where(p => p.UniqueID == procedure.OrderID).FirstOrDefault();
            string          accNo           = order.AccNo;
            string          modalityType    = procedure.ModalityType;
            ReportDBService reportDBService = new ReportDBService();
            string          templateID      = "";

            reportDBService.GetReportPrintTemplate(accNo, modalityType, reportID, loginSite, out templateID, out dt);
            if (templateID != "")
            {
                PrintTemplate printTemplate = _dbContext.Set <PrintTemplate>().Where(p => p.UniqueID == templateID).FirstOrDefault();
                if (printTemplate != null)
                {
                    templateInfo = generatePrintTemplate(printTemplate);
                }
            }
            else
            {
                return(null);
            }


            string templateGuid = ReportUtils.GetFirstRowValueFromDataSet(dt.DataSet, ReportCommon.FIELDNAME_tbReport__PrintTemplateGuid);

            DataTable newdt = generateDataTable4PrintingForReport(dt.DataSet, ref templateInfo, reportID, loginDomain);

            DataSet newds = new DataSet();

            newds.Tables.Add(newdt);
            //get html
            return(GetRenderedReportHtml(newds, templateInfo));
        }