private ReceivedDeliveryLineItem MapLineItem(tblSourcingLineItem tblItem) { var item = new ReceivedDeliveryLineItem(tblItem.Id); if (tblItem.GradeId != null) item.CommodityGrade = _commodityRepository.GetGradeByGradeId(tblItem.GradeId.Value); item.ContainerNo = tblItem.ContainerNo; item.Description = tblItem.Description; item.ParentDocId = tblItem.ParentId.HasValue ? tblItem.ParentId.Value : Guid.Empty; item.Weight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0; item.DeliveredWeight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0; if (tblItem.CommodityId != null) item.Commodity = _commodityRepository.GetById(tblItem.CommodityId.Value); if (tblItem.ContainerId != null) item.ContainerType = _containerTypeRepository.GetById(tblItem.ContainerId.Value); return item; }
private CommodityTransferLineItem MapCommodityStorageLineItem(tblSourcingLineItem tblItem) { return new CommodityTransferLineItem(tblItem.Id) { Commodity = _commodityRepository.GetById(tblItem.CommodityId.Value), CommodityGrade = _commodityRepository.GetAll(true).SelectMany(s => s.CommodityGrades).FirstOrDefault(s => tblItem.GradeId != null && s.Id == tblItem.GradeId.Value), ContainerNo = tblItem.ContainerNo,//_equipmentRepository.GetById(tblItem.ContainerId.Value) as SourcingContainer, Description = tblItem.Description, Note = tblItem.Note, ParentLineItemId = tblItem.ParentId.HasValue ? tblItem.ParentId.Value : Guid.Empty, ParentDocId = tblItem.tblSourcingDocument.Id, ContainerType = tblItem.ContainerId.HasValue ? _containerTypeRepository.GetById(tblItem.ContainerId.Value) : null, Weight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0, }; }
private CommodityStorageLineItem MapCommodityStorageLineItem(tblSourcingLineItem tblItem) { return new CommodityStorageLineItem(tblItem.Id) { Commodity = _commodityRepository.GetById(tblItem.CommodityId.Value), CommodityGrade = _commodityRepository.GetAll(true).SelectMany(s => s.CommodityGrades).FirstOrDefault(s => tblItem.GradeId != null && s.Id == tblItem.GradeId.Value), ContainerNo = tblItem.ContainerNo,//_equipmentRepository.GetById(tblItem.ContainerId.Value) as SourcingContainer, Description = tblItem.Description, Note = tblItem.Note, ParentLineItemId = tblItem.ParentId.HasValue ? tblItem.ParentId.Value : Guid.Empty, LineItemStatus = tblItem.LineItemStatusId.HasValue ? (SourcingLineItemStatus)tblItem.LineItemStatusId : SourcingLineItemStatus.Confirmed, ContainerType =tblItem.ContainerId.HasValue? _containerTypeRepository.GetById(tblItem.ContainerId.Value):null, Weight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0, WeighType = (int) (tblItem.WeighType.HasValue ? (WeighType)tblItem.WeighType.Value : WeighType.Manual), }; }
protected CommodityPurchaseLineItem MapCommodityPurchaseLineItem(tblSourcingLineItem tblItem) { return new CommodityPurchaseLineItem(tblItem.Id) { Commodity = _commodityRepository.GetById(tblItem.CommodityId.Value), CommodityGrade = _commodityRepository.GetAll(true).SelectMany(s => s.CommodityGrades).FirstOrDefault(s => tblItem.GradeId != null && s.Id == tblItem.GradeId.Value), ContainerNo =tblItem.ContainerNo, //_equipmentRepository.GetById(tblItem.ContainerId.Value) as SourcingContainer, Description = tblItem.Description, Note = tblItem.Note, ParentLineItemId = tblItem.ParentId.HasValue ? tblItem.ParentId.Value : Guid.Empty, TareWeight = tblItem.TareWeight.HasValue ? tblItem.TareWeight.Value : 0, NoOfContainers = tblItem.NoOfContainer.HasValue ? tblItem.NoOfContainer.Value : 0, Weight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0, ContainerType =tblItem.ContainerId.HasValue? _containerTypeRepository.GetById(tblItem.ContainerId.Value):null, LineItemStatus =tblItem.LineItemStatusId.HasValue? (SourcingLineItemStatus)tblItem.LineItemStatusId:SourcingLineItemStatus.New }; }
private CommodityReleaseLineItem MapCommodityReleaseLineItem(tblSourcingLineItem tblItem) { var item = DocumentLineItemPrivateConstruct<CommodityReleaseLineItem>(tblItem.Id); item.Commodity = _commodityRepository.GetById(tblItem.CommodityId.Value); item.CommodityGrade = _commodityRepository.GetAll(true).SelectMany(s => s.CommodityGrades).FirstOrDefault( s => tblItem.GradeId != null && s.Id == tblItem.GradeId.Value); item.ContainerNo = tblItem.ContainerNo;// _equipmentRepository.GetById(tblItem.ContainerId.Value) as SourcingContainer; if (tblItem.ContainerId != null) item.ContainerType = _containerTypeRepository.GetById(tblItem.ContainerId.Value); item.Description = tblItem.Description; item.Note = tblItem.Note; item.ParentLineItemId = tblItem.ParentId.HasValue ? tblItem.ParentId.Value : Guid.Empty; item.Weight = tblItem.Weight.HasValue ? tblItem.Weight.Value : 0; if (tblItem.LineItemStatusId != null) item.LineItemStatus = (SourcingLineItemStatus)tblItem.LineItemStatusId; return item; }
/// <summary> /// Create a new tblSourcingLineItem object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="documentId">Initial value of the DocumentId property.</param> public static tblSourcingLineItem CreatetblSourcingLineItem(global::System.Guid id, global::System.Guid documentId) { tblSourcingLineItem tblSourcingLineItem = new tblSourcingLineItem(); tblSourcingLineItem.Id = id; tblSourcingLineItem.DocumentId = documentId; return tblSourcingLineItem; }
/// <summary> /// Deprecated Method for adding a new object to the tblSourcingLineItem EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotblSourcingLineItem(tblSourcingLineItem tblSourcingLineItem) { base.AddObject("tblSourcingLineItem", tblSourcingLineItem); }
protected tblSourcingLineItem NewLineItem(Guid lineItemId,Guid parentId, Guid documentId, Guid conmmodityId, Guid gradeId, Guid containerId, decimal? weight, int weightype, string description, string containerNo ) { var li = new tblSourcingLineItem { Id = lineItemId, DocumentId = documentId, CommodityId = conmmodityId, ContainerId =containerId, GradeId = gradeId, Weight = weight, WeighType = weightype, NoOfContainer = 0, TareWeight = 0, Note = description, ParentId = parentId, Description = description==null? "" : description, ContainerNo = containerNo, LineItemStatusId = (int)SourcingLineItemStatus.New }; return li; }