示例#1
0
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            DataTable dt = null;

            try
            {
                /* 1. instantiate the report */
                var rpt = InstantiateRDLC("sherm.rpt.msdbrpt.ReportHardcopySDSPlacard001.rdlc");
                /* 2. populate the report */
                rpt.DataSources.Clear();
                dt = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SDSPLACARD];
                var dr   = dt.Rows[0];
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                rpt.SetParameters(new ReportParameter[] {
                    /* fixed captions */
                    new ReportParameter("lTitle1", m(4118)),               /* W O R K I N G */
                    new ReportParameter("lTitle2", m(4119)),               /* I N S T R U C T I O N S */
                    new ReportParameter("lSectionSubstancename", m(4120)), /* S U B S T A N C E   N A M E */
                    new ReportParameter("lSectionHazards", m(4121)),       /* H A Z A R D S   F O R   P E O P L E   A N D   E N V I R O N M E N T */
                    new ReportParameter("lSectionProtection", m(4122)),    /* P R O T E C T I V E   M E A S U R E S   A N D   C O D E   O F   P R A C T I C E */
                    new ReportParameter("lSectionConduct", m(4123)),       /* C O N D U C T   I N   D A N G E R O U S   S I T U A T I O N S */
                    new ReportParameter("lSectionFirstaid", m(4124)),      /* F I R S T   A I D */
                    new ReportParameter("lSectionDisposal", m(4125)),      /* P R O P E R   D I S P O S A L */
                    /* dynamic content */
                    new ReportParameter("Signalword", dr["Signalword"].ToString()),
                    new ReportParameter("Applicable", String.Format("{0}: {1}", m(4128), dr["MultiOrgCap"].ToString())), /* Applies to */
                    new ReportParameter("Caption", dr["Caption"].ToString()),
                    new ReportParameter("Hazards", dr["fHazards"].ToString()),
                    new ReportParameter("Protection", dr["fProtection"].ToString()),
                    new ReportParameter("Conduct", dr["fConduct"].ToString()),
                    new ReportParameter("PhoneEmergency", dr["PhoneEmergency"].ToString()),
                    new ReportParameter("Firstaid", dr["fFirstaid"].ToString()),
                    new ReportParameter("PhoneFirstaid", dr["PhoneFirstaid"].ToString()),
                    new ReportParameter("Disposal", dr["fDisposal"].ToString()),
                    new ReportParameter("Meta", dr["fMeta"].ToString()),
                    new ReportParameter("imgLogo", Logo)
                });
                /* the pictures */
                var pics = new ReportHardcopySDSPlacard()
                {
                    imgHAZLeft  = (byte[])dr["imgHAZLeft"],
                    imgHAZRight = (byte[])dr["imgHAZRight"],
                    imgPPELeft  = (byte[])dr["imgPPELeft"], /* updated [pkosec 20140429] */
                    imgPPERight = (byte[])dr["imgPPERight"] /* added [dlatikay 20150504] MEA-2015-00112 */
                };
                var sdspics = new List <ReportHardcopySDSPlacard>()
                {
                    pics
                };
                var dsPics     = "Pictures";
                var dynDS_Pics = new ReportDataSource(dsPics, sdspics);
                rpt.DataSources.Add(dynDS_Pics);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
示例#2
0
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            DataTable dt = null;

            try
            {
                /* 1. instantiate the report */
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = "sherm.rpt.msdbrpt.ReportHardcopySDSPlacard002.rdlc",
                    EnableExternalImages   = true
                };
                /* 2. populate the report */
                rpt.DataSources.Clear();
                dt = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SDSPLACARD];
                var dr   = dt.Rows[0];
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                rpt.SetParameters(new ReportParameter[] {
                    /* dynamic content */
                    new ReportParameter("Signalword", dr["Signalword"].ToString()),
                    new ReportParameter("ApplicableSite", String.Format("{0}: {1}", m(3014) /* Mill */, dr["fLongCap"].ToString())), /* [pkosec 20150306] MEA-2015-00094.3 / Mill */
                    new ReportParameter("ApplicableDept", String.Format("{0}: {1}", m(251), dr["MultiOrgCap"].ToString())),          /* [dlatikay 20150920] MEA-2015-00428 / Area */
                    new ReportParameter("Caption", dr["Caption"].ToString()),
                    new ReportParameter("Hazards", dr["fHazards"].ToString()),
                    new ReportParameter("Protection", dr["fProtection"].ToString()),
                    new ReportParameter("Conduct", dr["fConduct"].ToString()),
                    new ReportParameter("PhoneEmergency", dr["PhoneEmergency"].ToString()),
                    new ReportParameter("Firstaid", dr["fFirstaid"].ToString()),
                    new ReportParameter("PhoneFirstaid", dr["PhoneFirstaid"].ToString()),
                    new ReportParameter("Disposal", dr["fDisposal"].ToString()),
                    new ReportParameter("imgLogo", Logo),
                    /* added [pkosec 20140430] MEA-2014-00190 */
                    new ReportParameter("ResponsibleName", dr["fResponsiblePerson"].ToString()),
                    new ReportParameter("ReportNumber", dr["fReportNumber"].ToString()),
                    new ReportParameter("CurDate", dr["fCurDate"].ToString()),
                    /* [dlatikay 20150602] MEA-2015-00140.1 */
                    new ReportParameter("TextInsteadOfLogo", dr["TextInsteadOfLogo"].ToString())
                });
                /* the pictures */
                var pics = new ReportHardcopySDSPlacard()
                {
                    imgHAZLeft  = (byte[])dr["imgHAZLeft"],
                    imgHAZRight = (byte[])dr["imgHAZRight"],
                    imgPPELeft  = (byte[])dr["imgPPELeft"],
                    imgPPERight = (byte[])dr["imgPPERight"],
                    imgFIR      = (byte[])dr["imgFIR"],
                    imgEMG      = (byte[])dr["imgEMG"]
                };
                var sdspics = new List <ReportHardcopySDSPlacard>()
                {
                    pics
                };
                var dsPics     = "Pictures";
                var dynDS_Pics = new ReportDataSource(dsPics, sdspics);
                rpt.DataSources.Add(dynDS_Pics);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }