예제 #1
0
        public string ToJSONString()
        {
            string dateFormat   = "dd-MMM-yyyy";
            string amountFormat = "00.00";

            return(string.Format("$!$\r\n \"invoiceType\": \"{0}\",\r\n \"supplierNumber\": \"{1}\",\r\n \"supplierSiteNumber\": \"{2}\",\r\n \"invoiceDate\": \"{3}\",\r\n \"invoiceNumber\": \"{4}\",\r\n \"invoiceAmount\": {5},\r\n \"payGroup\": \"{6}\",\r\n \"dateInvoiceReceived\": \"{7}\",\r\n \"dateGoodsReceived\": \"{8}\",\r\n \"remittanceCode\": \"{9}\",\r\n \"specialHandling\": \"{10}\",\r\n \"nameLine1\": \"{11}\",\r\n \"nameLine2\": \"{12}\",\r\n \"addressLine1\": \"{13}\",\r\n \"addressLine2\": \"{14}\",\r\n \"addressLine3\": \"{15}\",\r\n \"city\": \"{16}\",\r\n \"country\": \"{17}\",\r\n \"province\": \"{18}\",\r\n \"postalCode\": \"{19}\",\r\n \"qualifiedReceiver\": \"{20}\",\r\n \"terms\": \"{21}\",\r\n \"payAloneFlag\": \"{22}\",\r\n \"paymentAdviceComments\": \"{23}\",\r\n \"remittanceMessage1\": \"{24}\",\r\n \"remittanceMessage2\": \"{25}\",\r\n \"remittanceMessage3\": \"{26}\",\r\n \"glDate\": \"{27}\",\r\n \"invoiceBatchName\": \"{28}\",\r\n \"currencyCode\": \"{29}\",\r\n \"invoiceLineDetails\": [$!$\r\n   \"invoiceLineNumber\": {30},\r\n   \"invoiceLineType\": \"{31}\",\r\n   \"lineCode\": \"{32}\",\r\n   \"invoiceLineAmount\": {33},\r\n   \"defaultDistributionAccount\": \"{34}\",\r\n   \"description\": \"{35}\",\r\n   \"taxClassificationCode\": \"{36}\",\r\n   \"distributionSupplier\": \"{37}\",\r\n   \"info1\": \"{38}\",\r\n   \"info2\": \"{39}\",\r\n   \"info3\": \"{40}\"\r\n   $&$]\r\n$&$",
                                 InvoiceType,
                                 SupplierNumber,
                                 SupplierSiteNumber.ToString("000"),
                                 InvoiceDate.ToLocalTime().ToString(dateFormat),
                                 InvoiceNumber,
                                 InvoiceAmount.ToString(amountFormat),
                                 PayGroup,
                                 DateInvoiceReceived.ToLocalTime().ToString(dateFormat),
                                 DateGoodsReceived.HasValue ? DateGoodsReceived.Value.ToLocalTime().ToString(dateFormat) : "",
                                 RemittanceCode,
                                 (SpecialHandling ? "D" : "N"),
                                 NameLine1,
                                 NameLine2,
                                 AddressLine1,
                                 AddressLine2,
                                 AddressLine3,
                                 City,
                                 Country,
                                 Province,
                                 PostalCode = !string.IsNullOrEmpty(PostalCode) ? PostalCode.Replace(" ", ""): string.Empty,
                                 QualifiedReceiver,
                                 Terms,
                                 PayAloneFlag,
                                 PaymentAdviceComments,
                                 RemittanceMessage1,
                                 RemittanceMessage2,
                                 RemittanceMessage3,
                                 GLDate.HasValue ? GLDate.Value.ToLocalTime().ToString(dateFormat) : "",
                                 InvoiceBatchName,
                                 CurrencyCode,
                                 InvoiceLineNumber,
                                 InvoiceLineType,
                                 LineCode,
                                 InvoiceLineAmount.ToString(amountFormat),
                                 DefaultDistributionAccount,
                                 Description,
                                 TaxClassificationCode,
                                 DistributionSupplier,
                                 Info1,
                                 Info2,
                                 Info3
                                 ).Replace("$!$", "{").Replace("$&$", "}"));
        }