public override void writeToHTML(HtmlStreamWriter writer) { if (writer == null || sections == null) { return; } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return; } //section title List <string> strSectionFields = new List <string>(); getFields(strSectionFields); writer.WriteElementString("SectionInfoTitle", ReportResource.sectionTitle); writer.writeTableTitle("Section", strSectionFields, true); //section info foreach (MEPSection section in sections) { string str = "Section"; DataTable detailInfoTB = new DataTable("SectionDetailInfo"); bool bTable = getSectionInfo(section, detailInfoTB, true); string totalPL = helper.getTotalPressureLossByType(section, SectionMemberType.Section); if (bTable) { writer.writeTable(str, detailInfoTB, section.Number.ToString(), totalPL); } } }
public override void writeToHTML(HtmlStreamWriter writer) { if (writer == null || system == null) { return; } //system name string sysName = system.Name; if (sysName.Length > 0) { writer.WriteElementString("SystemName", sysName); } //system info if (needToWrite()) { DataTable tb = new DataTable("SystemInfo"); getInfoDataTable(tb); writer.WriteElementString("SystemInfoTitle", ReportResource.systemInformation); writer.writeDataTable(tb); } }
public override void writeToHTML(HtmlStreamWriter writer) { if (writer == null || system == null) return; //system name string sysName = system.Name; if (sysName.Length > 0) writer.WriteElementString("SystemName", sysName); //system info if (needToWrite()) { DataTable tb = new DataTable("SystemInfo"); getInfoDataTable(tb); writer.WriteElementString("SystemInfoTitle", ReportResource.systemInformation); writer.writeDataTable(tb); } }
public override void writeToHTML(HtmlStreamWriter writer) { if (writer == null || sections == null || !needToWrite()) return; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return; //segment title List<string> strSegmentFields = new List<string>(); getFields(strSegmentFields); writer.WriteElementString("SegmentInfoTitle", ReportResource.segmentDetailInfo); writer.writeTableTitle("Segment", strSegmentFields); //segment info foreach (MEPSection section in sections) { string str = "Segment"; DataTable detailInfoTB = new DataTable("SegmentDetailInfo"); bool bTable = getSegmentInfo(section, detailInfoTB, true); string totalPL = helper.getTotalPressureLossByType(section, SectionMemberType.Segment); if (bTable) writer.writeTable(str, detailInfoTB, section.Number.ToString(), totalPL); } }
public override bool save(string fileName, PressureLossReportData reportData) { HtmlStreamWriter writer = new HtmlStreamWriter(); try { // Check if the xslt file exists if (!File.Exists(writer.XsltFileName)) { string subMsg = ReportResource.xsltFileSubMsg .Replace("%FULLPATH%", writer.XsltFileName ); UIHelperFunctions.postWarning( ReportResource.htmlGenerateTitle, ReportResource.xsltFileMsg, subMsg ); return false; } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return false; //xml head writer.WriteStartDocument(false); //root node string transXML = "UserPressureLossReport"; writer.WriteStartElement(transXML); //title writer.WriteElementString("Title", ReportResource.reportName); //domain if (helper.Domain == ReportResource.pipeDomain) writer.WriteElementString("DomainName", ReportResource.pipeReportName); else writer.WriteElementString("DomainName", ReportResource.ductReportName); //write project info ReportProjectInfo proInfo = new ReportProjectInfo(); proInfo.writeToHTML(writer); //each system List<MEPSystem> systems = helper.getSortedSystems(); if (systems == null || systems.Count < 1) return false; foreach (MEPSystem sysElem in systems) { if (sysElem == null) continue; //system node string xmlString = "System"; writer.WriteStartElement(xmlString); //system info: name and info MEPSystemInfo systemInfo = new MEPSystemInfo(sysElem); systemInfo.writeToHTML(writer); //critical path if (helper.ReportData.DisplayCriticalPath) { string criticalInfo =ReportResource.criticalPath + " : " + MEPSystemInfo.getCriticalPath(sysElem); criticalInfo += " ; "+ ReportResource.totalPressureLoss + " : " + MEPSystemInfo.getCriticalPathPressureLoss(sysElem); writer.WriteElementString("CriticalPath", criticalInfo); } List<MEPSection> sections = new List<MEPSection>(); MEPSystemInfo.getSectionsFromSystem(sysElem, sections); //sections: title and info SectionsInfo sectionInfo = new SectionsInfo(sections); sectionInfo.writeToHTML(writer); //segments: title and info SegmentsInfo segmentsInfo = new SegmentsInfo(sections); segmentsInfo.writeToHTML(writer); //fittings: title and info FittingsInfo fittingsInfo = new FittingsInfo(sections); fittingsInfo.writeToHTML(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Save(fileName); return true; } catch { writer.Close(); //delete xml File.Delete(writer.XmlFileName); UIHelperFunctions.postWarning(ReportResource.htmlGenerateTitle, ReportResource.htmlMsg); return false; } }
public override bool save(string fileName, PressureLossReportData reportData) { HtmlStreamWriter writer = new HtmlStreamWriter(); try { // Check if the xslt file exists if (!File.Exists(writer.XsltFileName)) { string subMsg = ReportResource.xsltFileSubMsg .Replace("%FULLPATH%", writer.XsltFileName); UIHelperFunctions.postWarning( ReportResource.htmlGenerateTitle, ReportResource.xsltFileMsg, subMsg); return(false); } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return(false); } //xml head writer.WriteStartDocument(false); //root node string transXML = "UserPressureLossReport"; writer.WriteStartElement(transXML); //title writer.WriteElementString("Title", ReportResource.reportName); //domain if (helper.Domain == ReportResource.pipeDomain) { writer.WriteElementString("DomainName", ReportResource.pipeReportName); } else { writer.WriteElementString("DomainName", ReportResource.ductReportName); } //write project info ReportProjectInfo proInfo = new ReportProjectInfo(); proInfo.writeToHTML(writer); //each system List <MEPSystem> systems = helper.getSortedSystems(); if (systems == null || systems.Count < 1) { return(false); } foreach (MEPSystem sysElem in systems) { if (sysElem == null) { continue; } //system node string xmlString = "System"; writer.WriteStartElement(xmlString); //system info: name and info MEPSystemInfo systemInfo = new MEPSystemInfo(sysElem); systemInfo.writeToHTML(writer); //critical path if (helper.ReportData.DisplayCriticalPath) { string criticalInfo = ReportResource.criticalPath + " : " + MEPSystemInfo.getCriticalPath(sysElem); criticalInfo += " ; " + ReportResource.totalPressureLoss + " : " + MEPSystemInfo.getCriticalPathPressureLoss(sysElem); writer.WriteElementString("CriticalPath", criticalInfo); } List <MEPSection> sections = new List <MEPSection>(); MEPSystemInfo.getSectionsFromSystem(sysElem, sections); //sections: title and info SectionsInfo sectionInfo = new SectionsInfo(sections); sectionInfo.writeToHTML(writer); //segments: title and info SegmentsInfo segmentsInfo = new SegmentsInfo(sections); segmentsInfo.writeToHTML(writer); //fittings: title and info FittingsInfo fittingsInfo = new FittingsInfo(sections); fittingsInfo.writeToHTML(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Save(fileName); return(true); } catch { writer.Close(); //delete xml File.Delete(writer.XmlFileName); UIHelperFunctions.postWarning(ReportResource.htmlGenerateTitle, ReportResource.htmlMsg); return(false); } }