예제 #1
0
        public static InvoiceLineItemDTO MapToInvoiceLineItemDTO(InvoiceDTO invoiceDTO)
        {
            if (invoiceDTO == null)
            {
                return(null);
            }

            InvoiceLineItemDTO invoiceLineItemDTO = new InvoiceLineItemDTO
            {
                Commodity       = invoiceDTO.Commodity,
                CreatedBy       = invoiceDTO.CreatedBy,
                CurrentApprover = invoiceDTO.CurrentApprover,
                Paid            = invoiceDTO.Paid,
                PaymentNotes    = invoiceDTO.PaymentNotes,

                POShipToCity       = invoiceDTO.POShipToCity,
                POShipToCountry    = invoiceDTO.POShipToCountry,
                POShipToName       = invoiceDTO.POShipToName,
                ProjectDescription = invoiceDTO.ProjectDescription,
                ReqNumber          = invoiceDTO.ReqNumber,
                RequestedBy        = invoiceDTO.RequestedBy,
                TargetLocationCode = invoiceDTO.TargetLocationCode,

                WorkflowCode = invoiceDTO.WorkflowCode
            };

            double.TryParse(invoiceDTO.AccountingTotal, out double accTotal);
            invoiceLineItemDTO.AccountingTotal = accTotal;

            double.TryParse(invoiceDTO.POLineTotal, out double poLineTotal);
            invoiceLineItemDTO.POLineTotal = poLineTotal;

            double.TryParse(invoiceDTO.PONumber, out double poNo);
            invoiceLineItemDTO.PONumber = poNo;

            double.TryParse(invoiceDTO.ReqLineNumber, out double reqLineNo);
            invoiceLineItemDTO.ReqLineNumber = reqLineNo;

            double.TryParse(invoiceDTO.ReqLineTotal, out double reqLineTotal);
            invoiceLineItemDTO.ReqLineTotal = reqLineTotal;

            double.TryParse(invoiceDTO.Total, out double total);
            invoiceLineItemDTO.Total = total;

            double.TryParse(invoiceDTO.TotalTax, out double totalTax);
            invoiceLineItemDTO.TotalTax = totalTax;

            DateTime.TryParse(invoiceDTO.LocalPaymentDate, out DateTime localPayDate);
            invoiceLineItemDTO.LocalPaymentDate = localPayDate;

            return(invoiceLineItemDTO);
        }
예제 #2
0
        public static InvoiceHeaderDTO MapToInvoiceHeaderDTO(InvoiceDTO invoiceHeaderDTO)
        {
            if (invoiceHeaderDTO == null)
            {
                return(null);
            }

            return(new InvoiceHeaderDTO
            {
                ProjectId = invoiceHeaderDTO.ProjectId,
                AccountingTotalCurrency = invoiceHeaderDTO.AccountingTotalCurrency,
                Billing = invoiceHeaderDTO.Billing,
                Currency = invoiceHeaderDTO.Currency,
                InvoiceDate = invoiceHeaderDTO.InvoiceDate,
                InvoiceNumber = invoiceHeaderDTO.InvoiceNumber,
                Status = invoiceHeaderDTO.Status,
                Supplier = invoiceHeaderDTO.Supplier
            });
        }