public bool WriteRequiredReleasNotes(bool?releaseNoteRequired, string fileName) { var assets = LinqReleaseNotes.GetAssetsWithReleaseNoteRequired( Dictionary.RefinedDictionary, releaseNoteRequired); IEnumerable <CReleaseNoteAsset> cReleaseNoteAssets = assets as CReleaseNoteAsset[] ?? assets.ToArray(); if (!UtilityFunctions.IsAny(cReleaseNoteAssets)) { NoAssetsAvailableToPrint(fileName); return(false); } using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(fileName + ".xml")) { writer.WriteStartDocument(); writer.WriteStartElement("AllReleaseNotes"); foreach (CReleaseNoteAsset cReleaseNoteAsset in cReleaseNoteAssets) { writer.WriteStartElement("ReleaseNote"); writer.WriteElementString("ID", cReleaseNoteAsset.Id.ToString()); writer.WriteElementString("Name", cReleaseNoteAsset.Name.ToString()); writer.WriteElementString("URL", cReleaseNoteAsset.URL.ToString()); writer.WriteElementString("ReleaseNoteRequired", cReleaseNoteAsset.ReleaseNoteRequired.ToString()); writer.WriteStartElement("Categories"); foreach (int i in Dictionary.RefinedDictionary[cReleaseNoteAsset].Keys) { writer.WriteElementString("Category", Dictionary.RefinedDictionary[cReleaseNoteAsset][i]); } writer.WriteEndElement(); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); } return(true); }
public bool WriteRequiredReleaseNotes(bool?releaseNoteRequired, string fileName) { Tuple <Application, Workbook, Workbook> xLAppAndWorkbook = SetUpExcelWorkbooks(); Application xLApp = xLAppAndWorkbook.Item1; Workbook AuditWorkbook = xLAppAndWorkbook.Item2; Workbook OutputWorkbook = xLAppAndWorkbook.Item3; Worksheet AuditWorksheet = AuditWorkbook.ActiveSheet; Worksheet OutputWorksheet = OutputWorkbook.ActiveSheet; IEnumerable <CReleaseNoteAsset> cReleaseNoteAssets = LinqReleaseNotes .GetAssetsWithReleaseNoteRequired(Dictionary.RefinedDictionary, releaseNoteRequired); Dictionary <CReleaseNoteAsset, Dictionary <int, string> > parsedDictionary = cReleaseNoteAssets.ToDictionary(cReleaseNoteAsset => cReleaseNoteAsset, cReleaseNoteAsset => Dictionary.RefinedDictionary[cReleaseNoteAsset]); WriteOutputSheet(parsedDictionary, OutputWorksheet); var cReleaseNoteAssetsAudit = Dictionary.RefinedDictionary.Keys; Boolean WrongFormatItems = WrongFormatItemsExist(cReleaseNoteAssets.Where(item => !item.IsReleaseNoteCorrectlyFormatted)); if (WrongFormatItems) { List <string> wrongFormatText = WriteWrongFormatText(cReleaseNoteAssets); System.IO.File.WriteAllLines(fileName + " Errors.txt", wrongFormatText); } WriteAuditSheet(cReleaseNoteAssetsAudit, AuditWorksheet); AuditWorkbook.SaveAs(fileName + " Audit.xlsx"); OutputWorkbook.SaveAs(fileName + " Output.xlsx"); if (cmdHide) { xLApp.Quit(); } else { xLApp.Visible = true; } return(WrongFormatItems); }