public IEnumerable <IResult> PrintRegistry() { var doc = new RegistryDocument(Waybill, PrintableLines()); var docSettings = doc.Settings; yield return(new DialogResult(new RegistryDocSettings((RegistryDocumentSettings)docSettings))); yield return(new DialogResult(new PrintPreviewViewModel(new PrintResult("Реестр", doc)), fullScreen: true)); }
public void RegistryDocument_waybillLines() { var waybillLines = waybill.Lines; /* проверка надбавки в рублях в первой препарате */ Assert.AreEqual(4m, waybillLines[0].RetailMarkupInRubles); var doc = new RegistryDocument(waybill, waybillLines); var flowDoc = doc.Build(); var listTableCellCollection = flowDoc.Blocks.OfType <Table>().Skip(1).First() .RowGroups.Select(x => x.Rows).ToList() .First().Select(x => x.Cells).ToList(); var tableCellCollection = listTableCellCollection[0]; /* проверка количества строк в таблице */ Assert.AreEqual(15, listTableCellCollection.Count()); /* проверяем названия столбцов */ var ValueCollumnName = new TextRange(tableCellCollection[0].ContentStart, tableCellCollection[0].ContentEnd).Text; Assert.AreEqual("№ пп", ValueCollumnName); ValueCollumnName = new TextRange(tableCellCollection[3].ContentStart, tableCellCollection[3].ContentEnd).Text; Assert.AreEqual("Предприятие - изготовитель", ValueCollumnName); ValueCollumnName = new TextRange(tableCellCollection[11].ContentStart, tableCellCollection[11].ContentEnd).Text; Assert.AreEqual("Розн. торг. надб. руб", ValueCollumnName); /* Розн. торг. надб. руб проверяем значение в первом препарате */ tableCellCollection = listTableCellCollection[2]; var ValueCell = new TextRange(tableCellCollection[14].ContentStart, tableCellCollection[14].ContentEnd).Text; decimal?RetailMarkupInRubles = Convert.ToDecimal(ValueCell); Assert.AreEqual(4m, RetailMarkupInRubles); tableCellCollection = listTableCellCollection[3]; ValueCell = new TextRange(tableCellCollection[14].ContentStart, tableCellCollection[14].ContentEnd).Text; Assert.AreEqual(string.Empty, ValueCell); }