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 ICollection <StockInformation> GetStockInformationByOrderID(int orderId) { var balance = new Balance(); var stockInformationTable = balance.GetBalanceByOrder(orderId, CurrentContext.UserId); ICollection <StockInformation> stockInformations = new Collection <StockInformation>(); foreach (DataRowView stockInformationRow in stockInformationTable) { var itemID = Convert.ToInt32(stockInformationRow["ItemID"]); var unitID = Convert.ToInt32(stockInformationRow["UnitID"]); var stockInformation = new StockInformation { Item = _itemRepository.FindSingle(Convert.ToInt32(itemID)), Unit = _unitOfIssueRepository.FindSingle(Convert.ToInt32(unitID)), Manufacturer = DBNull.Value != stockInformationRow["ManufacturerId"] ? _manufacturerRepository.FindSingle( Convert.ToInt32(stockInformationRow["ManufacturerId"])) : null, Activity = _activityRepository.FindSingle( Convert.ToInt32(stockInformationRow["ActivityID"]), Convert.ToBoolean(stockInformationRow["DeliveryNote"])), ExpiryDate = DBNull.Value != stockInformationRow["ExpiryDate"] ? Convert.ToDateTime(stockInformationRow["ExpiryDate"]) : (DateTime?)null, PhysicalStore = DBNull.Value != stockInformationRow["PhysicalStoreID"] ? _physicalStoreRepository.FindSingle( Convert.ToInt32(stockInformationRow["PhysicalStoreID"])) : null, Quantity = Convert.ToDecimal(stockInformationRow["Usable"]) }; stockInformations.Add(stockInformation); } return(stockInformations); }
public ICollection <Forcasting> GetForcastingByOrderID(int orderId) { var orderDetail = new BLL.OrderDetail(); var ForcastingTable = orderDetail.LoadForcastingByOrderID(orderId).DefaultView; ICollection <Forcasting> Forcastings = new Collection <Forcasting>(); foreach (DataRowView ForcastingRow in ForcastingTable) { var itemID = Convert.ToInt32(ForcastingRow["ItemID"]); var unitID = Convert.ToInt32(ForcastingRow["UnitID"]); var Forcasting = new Forcasting { Item = _itemRepository.FindSingle(Convert.ToInt32(itemID)), Unit = _unitOfIssueRepository.FindSingle(Convert.ToInt32(unitID)), TotalIssued = Convert.ToDecimal(ForcastingRow["TotalIssued"]), Dos = Convert.ToDecimal(ForcastingRow["DOS"]), FiscalYearDays = Convert.ToInt32(ForcastingRow["FiscalYearDays"]) }; Forcastings.Add(Forcasting); } return(Forcastings); }