public static RequisitionLineItemDTO MapToRequisitionLineItemDTO(RequisitionDTO requisitionLineItem) { if (requisitionLineItem == null) { return(null); } var requisitionLineItemDTO = new RequisitionLineItemDTO { Id = requisitionLineItem.Id, Item = requisitionLineItem.Item, Account = requisitionLineItem.Account, CostCode = requisitionLineItem.CostCode, ProjectDescription = requisitionLineItem.ProjectDescription, TargetLocationCode = requisitionLineItem.TargetLocationCode, ShipToAddressName = requisitionLineItem.ShipToAddressName, RequestedBy = requisitionLineItem.RequestedBy, CurrentApprover = requisitionLineItem.CurrentApprover, CreatedBy = requisitionLineItem.CreatedBy, RequisitionHeaderId = requisitionLineItem.RequisitionHeaderId }; int.TryParse(requisitionLineItem.RequisitionLineNumber, out int requisitionLineNumber); requisitionLineItemDTO.RequisitionLineNumber = requisitionLineNumber; double.TryParse(requisitionLineItem.OrderTotal, out double orderTotal); requisitionLineItemDTO.OrderTotal = orderTotal; double.TryParse(requisitionLineItem.ReportingTotal, out double reportingTotal); requisitionLineItemDTO.ReportingTotal = reportingTotal; return(requisitionLineItemDTO); }
public static RequisitionHeaderDTO MapToRequisitionHeaderDTO(RequisitionDTO requisitionHeader) { if (requisitionHeader == null) { return(null); } var requisitionHeaderDTO = new RequisitionHeaderDTO { Id = requisitionHeader.Id, Supplier = requisitionHeader.Supplier, Status = requisitionHeader.Status, Currency = requisitionHeader.Currency, ProjectId = requisitionHeader.ProjectId }; int.TryParse(requisitionHeader.RequisitionNumber, out int requisitionNumber); requisitionHeaderDTO.RequisitionNumber = requisitionNumber; DateTime.TryParse(requisitionHeader.CreatedDate, out DateTime createdDate); requisitionHeaderDTO.CreatedDate = createdDate; int.TryParse(requisitionHeader.PurchaseOrderNumber, out int purchaseOrderNumber); requisitionHeaderDTO.PurchaseOrderNumber = purchaseOrderNumber; return(requisitionHeaderDTO); }