public object GetRelatedDocumentEntry(InvoiceSubtypes.ValidationRuleSet formType) { switch (RefTypeSelected) { case RefType.Keine: return(null); case RefType.Storno: CancelledOriginalDocumentType docType = new CancelledOriginalDocumentType(); docType.Comment = RefComment; if (!string.IsNullOrEmpty(RefSelectedDocType)) { docType.DocumentType = (DocumentTypeType)Enum.Parse(typeof(DocumentTypeType), RefSelectedDocType); docType.DocumentTypeSpecified = true; } docType.InvoiceDate = RefInvDate; docType.InvoiceNumber = RefInvNumber; return(docType); case RefType.Verweis: RelatedDocumentType relDoc = new RelatedDocumentType(); relDoc.Comment = RefComment; if (!string.IsNullOrEmpty(RefSelectedDocType)) { relDoc.DocumentType = (DocumentTypeType)Enum.Parse(typeof(DocumentTypeType), RefSelectedDocType); relDoc.DocumentTypeSpecified = true; } if (RefInvDate.CompareTo(new DateTime(2000, 1, 1)) > 0) { relDoc.InvoiceDate = RefInvDate; relDoc.InvoiceDateSpecified = true; } relDoc.InvoiceNumber = RefInvNumber; return(relDoc); default: throw new ArgumentOutOfRangeException(); } }
public void AddRelatedDocument <T>(T relDoc) { if (relDoc == null) { return; } if (relDoc is CancelledOriginalDocumentType) { CancelledOriginalDocumentType cDoc = relDoc as CancelledOriginalDocumentType; RefComment = cDoc.Comment ?? ""; if (cDoc.DocumentTypeSpecified) { RefSelectedDocType = cDoc.DocumentType.ToString(); } RefInvDate = cDoc.InvoiceDate; RefInvNumber = cDoc.InvoiceNumber; RefTypeSelected = RefType.Storno; return; } if (relDoc is RelatedDocumentType) { RelatedDocumentType rDoc = relDoc as RelatedDocumentType; RefComment = rDoc.Comment ?? ""; if (rDoc.DocumentTypeSpecified) { RefSelectedDocType = rDoc.DocumentType.ToString(); } if (rDoc.InvoiceDateSpecified) { RefInvDate = rDoc.InvoiceDate; } RefInvNumber = rDoc.InvoiceNumber; RefTypeSelected = RefType.Verweis; return; } }