/// <summary> /// Создать XML файлы из данных, считанных из БД /// </summary> /// <param name="rep_year">Отчетный год</param> /// <param name="org">Организация</param> /// <param name="list_id">Список идентификаторов пакетов</param> /// <param name="connectionStr">Строка подключения</param> /// <param name="mapXml">Карта - выходной параметр</param> /// <param name="szv3Xml">Сводная ведомость - выходной параметр</param> /// <param name="szv2XmlArray">Описи - выходной параметр</param> /// <param name="szv1XmlArray">Документы СЗВ1 - выходной параметр</param> /// <returns></returns> public static int MakeXml(int repYear, Org org, IEnumerable <long> listId, string connectionStr, out XmlDocument mapXml, out XmlDocument szv3Xml, out IEnumerable <XmlDocument> szv2XmlArray, out IEnumerable <IEnumerable <XmlDocument> > szv1XmlArray) { int res = 0; XmlDocument szv3 = Szv3Xml.GetXml(org.idVal, repYear, connectionStr); LinkedList <XmlDocument> szv2Array = new LinkedList <XmlDocument>(); LinkedList <IEnumerable <XmlDocument> > szv1Array = new LinkedList <IEnumerable <XmlDocument> >(); foreach (long listID in listId) { XmlDocument szv2 = Szv2Xml.GetXml(listID, connectionStr); long[] docsID = Docs.GetDocsID(listID, connectionStr); IEnumerable <XmlDocument> szv1 = Szv1Xml.GetXml(docsID, org, connectionStr); if (szv1 != null && szv2 != null) { szv2Array.AddLast(szv2); szv1Array.AddLast(szv1); } else { res = -1; } } mapXml = MapXml.GetXml(szv2Array, szv1Array); szv3Xml = szv3; szv2XmlArray = szv2Array; szv1XmlArray = szv1Array; // return(res); }
void _wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser wb = sender as WebBrowser; if (wb == null) { return; } object[] tags = wb.Tag as object[]; long merge_id = (long)tags[0]; string performer = tags[1] as string; DateTime printDate = (DateTime)tags[2]; System.Xml.XmlDocument xml = Szv3Xml.GetXml(merge_id, _connection); HtmlDocument htmlDoc = wb.Document; string repYear = this.yearBox.Value.ToString(); htmlDoc.InvokeScript("setRegnum", new object[] { _org.regnumVal }); htmlDoc.InvokeScript("setOrgName", new object[] { _org.nameVal }); htmlDoc.InvokeScript("setYear", new object[] { repYear }); htmlDoc.InvokeScript("setSzv3Xml", new object[] { xml.InnerXml }); htmlDoc.InvokeScript("setPrintDate", new object[] { printDate.ToString("dd.MM.yyyy") }); htmlDoc.InvokeScript("setPerformer", new object[] { performer }); htmlDoc.InvokeScript("setChiefPost", new object[] { _org.chiefpostVal }); //MyPrinter.ShowWebPage(wb); MyPrinter.ShowPrintPreviewWebPage(wb); }
void _wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser wb = sender as WebBrowser; if (wb == null) { return; } DataRow mergeRow = _mergeRow ?? Mergies.CreateRow(); mergeRow[MergiesView.listCount] = (int)packetcountBox.Value; mergeRow[MergiesView.docCount] = (int)documentcountBox.Value; XmlDocument xml = Szv3Xml.GetXml(mergeRow, _svodTable); HtmlDocument htmlDoc = wb.Document; string repYear = this.yearBox.Text; htmlDoc.InvokeScript("setRegnum", new object[] { _org.regnumVal }); htmlDoc.InvokeScript("setOrgName", new object[] { _org.nameVal }); htmlDoc.InvokeScript("setYear", new object[] { repYear }); htmlDoc.InvokeScript("setSzv3Xml", new object[] { xml.InnerXml }); htmlDoc.InvokeScript("setChiefPost", new object[] { _org.chiefpostVal }); MyPrinter.ShowPrintPreviewWebPage(wb); }