private void performChainContainer(string document_id, Dictionary <string, byte[]> additionalTicketsToBeChained) { APICon.Container.ChainContainer container = new APICon.Container.ChainContainer(); Event[] e = controller.getAllBindedEventsInChain(document_id); foreach (Event ev in e) { //Console.WriteLine(ev.ToString()); GetContentResponse cr = controller.getUPDDocumentContent(ev.document_id); string name = GetTextFromXml(cr.body, "Файл[@*]/@ИдФайл"); container.AddEntry(name + ".xml", Utils.Base64DecodeToBytes(cr.body, "windows-1251")); container.AddEntry(name + GetSignExtensionForContainer(), GetSignEncodedBodyForContainer(cr.sign)); if (ev.event_status.StartsWith("УПД")) { byte[] pdf = Utils.Base64DecodeToBytes(controller.GetPdf(ev.document_id), "UTF-8"); container.AddEntry(name + ".pdf", pdf); container.docFunction = GetTextFromXml(cr.body, "Файл/Документ/@Функция"); string[] s = { "КСЧФ", "КСЧФДИС", "ДИС" }; container.docNumber = GetTextFromXml(cr.body, s.Contains(container.docFunction) ? "Файл/Документ/СвКСчФ/@НомерКСчФ" : "Файл/Документ/СвСчФакт/@НомерСчФ"); container.docDate = GetTextFromXml(cr.body, s.Contains(container.docFunction) ? "Файл/Документ/СвКСчФ/@ДатаКСчФ" : "Файл/Документ/СвСчФакт/@ДатаСчФ"); container.SetContainerName(); } } foreach (string key in additionalTicketsToBeChained.Keys) { container.AddEntry(key, additionalTicketsToBeChained[key]); } DFSHelper.saveContainer(container); }