private void AddDocumentsToDataSet(DocumentDataSet destinationDateSet) { foreach (var reportedDocument in _reportedDocuments) { var title = reportedDocument.DocumentSubType.ToString(); var contractNumber = reportedDocument.ContractNumber; var description = reportedDocument.Description; var remarks = reportedDocument.Remarks; var nomenclature = reportedDocument.Nomenсlature.ToString(); var issueValidFrom = reportedDocument.IssueDateValidFrom.ToString("dd MM yyyy"); var docType = reportedDocument.DocType.ToString(); var department = reportedDocument.Department.ToString(); var contractor = reportedDocument.Supplier.ToString(); var aboard = reportedDocument.Aboard ? "Yes" : "No"; var status = reportedDocument.Status.ToString(); var issueValidTo = reportedDocument.IssueValidTo ? reportedDocument.IssueDateValidTo.ToString("dd MM yyyy") : ""; var issueRemain = reportedDocument.Remains?.ToString() ?? ""; var revisonValidFrom = reportedDocument.Revision ? reportedDocument.RevisionDateFrom.ToString("dd MM yyyy") : ""; var revisonValidTo = reportedDocument.RevisionValidTo ? reportedDocument.RevisionDateValidTo.ToString("dd MM yyyy") : ""; var revisonRemain = reportedDocument.RevisionRemains?.ToString() ?? ""; var prolongation = reportedDocument.ProlongationWay.ToString(); var responsible = reportedDocument.ResponsibleOccupation.ToString(); var specialist = reportedDocument.Specialist != null?reportedDocument.Specialist.ToString() : reportedDocument.Parent.ToString(); destinationDateSet.DocumentDataTable.AddDocumentDataTableRow(title, contractNumber, description, remarks, nomenclature, issueValidFrom, docType, department, contractor, aboard, status, issueValidTo, issueRemain, revisonValidFrom, revisonValidTo, revisonRemain, prolongation, responsible, specialist); } }
protected virtual DataSet GenerateDataSet() { var dataset = new DocumentDataSet(); AddAdditionalDataToDataSet(dataset); AddDocumentsToDataSet(dataset); return(dataset); }
/// <summary> /// Добавление дополнительной информации /// </summary> /// <param name="destinationDateSet"></param> private void AddAdditionalDataToDataSet(DocumentDataSet destinationDateSet) { var reportFooter = new GlobalTermsProvider()["ReportFooter"].ToString(); var reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString(); var reportFooterLink = new GlobalTermsProvider()["ProductWebsite"].ToString(); _dateAsOf = DateTime.Today.ToString("dd MM yyyy"); destinationDateSet.AdditionalDataTAble.AddAdditionalDataTAbleRow(_reportTitle, _operatorLogotype, _filterSelection, _dateAsOf, reportFooter, reportFooterPrepared, reportFooterLink, _reportedDocuments.Count()); }
private void AddDocumentsToDataSet(DocumentDataSet destinationDateSet) { foreach (var reportedDocument in _reportedDocuments) { var title = reportedDocument.DocumentSubType.ToString(); var contractNumber = reportedDocument.ContractNumber; var description = reportedDocument.Description; var remarks = reportedDocument.Remarks; var nomenclature = reportedDocument.Nomenсlature.ToString(); var issueValidFrom = reportedDocument.IssueDateValidFrom.ToString("dd MMMM yyyy"); var docType = reportedDocument.DocType.ToString(); var department = reportedDocument.Department.ToString(); var specialist = reportedDocument.Specialist != null?reportedDocument.Specialist.ToString() : reportedDocument.Parent.ToString(); destinationDateSet.DocumentDataTable.AddDocumentDataTableRow(title, contractNumber, description, remarks, nomenclature, issueValidFrom, docType, department, null, null, null, null, null, null, null, null, null, null, specialist); } }
/// <summary> /// Поиск элементов из строки отчета в текущем документе и связанных файлах /// </summary> /// <param name="elementsInDocument">Коллекция, в которую складываются элементы из текущего документа</param> /// /// <param name="elementsInLink">Коллекция, в которую складываются элементы из связанного</param> /// /// <param name="linkInstance">Если найдены элементы в связи, возвращает объект связи; в противном случае null</param> static public void GetElementsFromReportRow(Document doc, CollisionReportRow row, out ICollection <Element> elementsInDocument, out ICollection <Element> elementsInLink, out RevitLinkInstance linkInstance) { linkInstance = null; DocumentDataSet docSet = new DocumentDataSet(doc, true); DocumentData docData1 = docSet[row.E1_DocumentName]; DocumentData docData2 = docSet[row.E2_DocumentName]; Document doc1 = docData1.Document; Document doc2 = docData2.Document; Element e1 = doc1.GetElement(row.E1_Id); Element e2 = doc2.GetElement(row.E2_Id); elementsInDocument = new List <Element>(); elementsInLink = new List <Element>(); if (e1 != null) { if (doc1.IsLinked) { elementsInLink.Add(e1); linkInstance = docData1.Instance; } else { elementsInDocument.Add(e1); } } if (e2 != null) { if (doc2.IsLinked) { elementsInLink.Add(e2); linkInstance = docData2.Instance; } else { elementsInDocument.Add(e2); } } }