public decimal GetReceivedAlreadyInUnit(ReceiptAllocation receiptAllocation)
 {
     decimal sum = 0;
     if (receiptAllocation.Receives != null)
         foreach (Receive r in receiptAllocation.Receives)
         {
             foreach (ReceiveDetail rd in r.ReceiveDetails)
             {
                 sum = sum + rd.QuantityInUnit;
             }
         }
     return sum;
 }
Beispiel #2
0
        public decimal GetReceivedAlreadyInUnit(ReceiptAllocation receiptAllocation)
        {
            decimal sum = 0;

            if (receiptAllocation.Receives != null)
            {
                foreach (Receive r in receiptAllocation.Receives)
                {
                    foreach (ReceiveDetail rd in r.ReceiveDetails)
                    {
                        sum = sum + rd.QuantityInUnit;
                    }
                }
            }
            return(sum);
        }
        /// <summary>
        /// Generates the receipt allocation.
        /// </summary>
        /// <returns></returns>
        public BLL.ReceiptAllocation GenerateReceiptAllocation()
        {
            ReceiptAllocation receiptAllocation = new ReceiptAllocation()
            {
                ProjectNumber = this.ProjectNumber,
                SINumber = this.SINumber,
                QuantityInMT = this.QuantityInMT,
                CommodityID = this.CommodityID,
                HubID = this.HubID,
                ETA = this.ETA,
                DonorID = this.DonorID == null ? (int?) null : this.DonorID.Value,
                GiftCertificateDetailID = this.GiftCertificateDetailID,
                PartitionID = this.PartitionID,
                ProgramID = this.ProgramID,
                CommoditySourceID = this.CommoditySourceID,
                IsCommited = this.IsCommited,
                SourceHubID = this.SourceHubID,
                PurchaseOrder = this.PurchaseOrder,
                SupplierName = this.SupplierName,
                OtherDocumentationRef = this.OtherDocumentationRef,
                QuantityInUnit = this.QuantityInUnit,
                Remark = this.Remark
            };
            if(this.ReceiptAllocationID.HasValue)
            {
                receiptAllocation.ReceiptAllocationID = this.ReceiptAllocationID.Value;
            }

            return receiptAllocation;
        }