public Domain.Request FindSingle(int requestID) { var request = new Domain.Request(); var order = new Order(); order.LoadByPrimaryKey(requestID); request.RequestID = order.ID; request.OrderNumber = order.RefNo; request.LetterNumber = !order.IsColumnNull("LetterNo") ? order.LetterNo : ""; request.RequestedDate = order.EurDate; request.Client = _clientRepository.FindSingle(order.RequestedBy); request.Mode = _modeService.GetEnum(order.FromStore); request.PaymentTerm = _paymentTermService.FindSingle(order.PaymentTypeID); request.OrderStatus = _orderStatusService.GetEnum(order.OrderStatusID); var orderDetail = new OrderDetail(); orderDetail.LoadAllByOrderID(requestID); orderDetail.Rewind(); request.RequestDetails = new Collection <Domain.RequestDetail>(); while (!orderDetail.EOF) { var item = _itemRepository.FindSingle(orderDetail.ItemID); var unitOfIssue = _unitOfIssueRepository.FindSingle(orderDetail.UnitID); var requestDetail = new Domain.RequestDetail() { RequestDetailId = orderDetail.ID, Item = item, Unit = unitOfIssue, RequestedQuantity = orderDetail.Pack, ApprovedQuantity = !orderDetail.IsColumnNull("ApprovedQuantity") ? orderDetail.ApprovedQuantity : orderDetail.Pack, IsFirstLoad = orderDetail.IsColumnNull("ApprovedQuantity"), ActivityGroup = orderDetail.IsColumnNull(OrderDetail.ColumnNames.StoreID)?null:_activityRepository.FindSingle(orderDetail.StoreID, orderDetail.DeliveryNote), ExpiryDate = !orderDetail.IsColumnNull("PreferredExpiryDate") ? orderDetail.PreferredExpiryDate : (DateTime?)null, Manufacturer = !orderDetail.IsColumnNull("PreferredManufacturerID") ? _manufacturerRepository.FindSingle( orderDetail.PreferredManufacturerID) : null, physicalStore = !orderDetail.IsColumnNull("PreferredPhysicalStoreID") ? _physicalStoreRepository.FindSingle( orderDetail.PreferredPhysicalStoreID) : null }; request.RequestDetails.Add(requestDetail); orderDetail.MoveNext(); } return(request); }
public Domain.Request FindSingle(int requestID) { var request = new Domain.Request(); var order = new Order(); order.LoadByPrimaryKey(requestID); request.RequestID = order.ID; request.OrderNumber = order.RefNo; request.LetterNumber = !order.IsColumnNull("LetterNo") ? order.LetterNo : ""; request.RequestedDate = order.EurDate; request.Client = _clientRepository.FindSingle(order.RequestedBy); request.Mode = _modeService.GetEnum(order.FromStore); request.PaymentTerm = _paymentTermService.FindSingle(order.PaymentTypeID); request.OrderStatus = _orderStatusService.GetEnum(order.OrderStatusID); var orderDetail = new OrderDetail(); orderDetail.LoadAllByOrderID(requestID); orderDetail.Rewind(); request.RequestDetails = new Collection<Domain.RequestDetail>(); while (!orderDetail.EOF) { var item = _itemRepository.FindSingle(orderDetail.ItemID); var unitOfIssue = _unitOfIssueRepository.FindSingle(orderDetail.UnitID); var requestDetail = new Domain.RequestDetail() { RequestDetailId = orderDetail.ID, Item = item, Unit = unitOfIssue, RequestedQuantity = orderDetail.Pack, ApprovedQuantity = !orderDetail.IsColumnNull("ApprovedQuantity") ? orderDetail.ApprovedQuantity : orderDetail.Pack, IsFirstLoad = orderDetail.IsColumnNull("ApprovedQuantity"), ActivityGroup = orderDetail.IsColumnNull(OrderDetail.ColumnNames.StoreID)?null:_activityRepository.FindSingle(orderDetail.StoreID,orderDetail.DeliveryNote), ExpiryDate = !orderDetail.IsColumnNull("PreferredExpiryDate") ? orderDetail.PreferredExpiryDate : (DateTime?)null, Manufacturer = !orderDetail.IsColumnNull("PreferredManufacturerID") ? _manufacturerRepository.FindSingle( orderDetail.PreferredManufacturerID) : null, physicalStore = !orderDetail.IsColumnNull("PreferredPhysicalStoreID") ? _physicalStoreRepository.FindSingle( orderDetail.PreferredPhysicalStoreID) : null }; request.RequestDetails.Add(requestDetail); orderDetail.MoveNext(); } return request; }