public bool AddRecievedLoanReciptPlanDetail(LoanReciptPlanDetail loanReciptPlanDetail)
 {
     var loanReciptPlan = _unitOfWork.LoanReciptPlanRepository.FindById(loanReciptPlanDetail.LoanReciptPlanID);
     if (loanReciptPlan!=null)
     {
         _unitOfWork.LoanReciptPlanDetailRepository.Add(loanReciptPlanDetail);
         var reciptAllocaltion = new ReceiptAllocation()
             {
                 ReceiptAllocationID = Guid.NewGuid(),
                 PartitionID = 0,
                 IsCommited = false,
                 ETA = loanReciptPlan.CreatedDate,
                 ProjectNumber = loanReciptPlan.ProjectCode,
                 CommodityID = loanReciptPlan.CommodityID,
                 CommoditySourceID = loanReciptPlan.CommoditySourceID,
                 SINumber = loanReciptPlan.ShippingInstruction.Value,
                 QuantityInMT = loanReciptPlanDetail.RecievedQuantity,
                 HubID = loanReciptPlanDetail.HubID,
                 //SourceHubID = loanReciptPlan.SourceHubID,
                 ProgramID = loanReciptPlan.ProgramID,
                 IsClosed = false
             };
         _unitOfWork.ReceiptAllocationReository.Add(reciptAllocaltion);
         _unitOfWork.Save();
         return true;
     }
     return false;
 }
Пример #2
0
        public bool Approve(LocalPurchase localPurchase)
        {
            try
               {
               localPurchase.StatusID = (int) LocalPurchaseStatus.Approved;
               _unitOfWork.LocalPurchaseRepository.Edit(localPurchase);
               foreach (var localPurchaseDetail in localPurchase.LocalPurchaseDetails)
               {
                   var reciptAllocaltion = new ReceiptAllocation()
                       {
                           ReceiptAllocationID = Guid.NewGuid(),
                           ProgramID = localPurchase.ProgramID,
                           CommodityID = localPurchase.CommodityID,
                           DonorID = localPurchase.DonorID,
                           ETA = localPurchase.DateCreated,
                           SINumber = localPurchase.ShippingInstruction.Value,
                           QuantityInMT = localPurchaseDetail.AllocatedAmount,
                           HubID = localPurchaseDetail.HubID,
                           CommoditySourceID = 3, //Local Purchase
                           ProjectNumber = localPurchase.ProjectCode,
                           //PurchaseOrder = localPurchase.PurchaseOrder,
                           PartitionID = 0,
                           IsCommited = false
                       };
                   _unitOfWork.ReceiptAllocationReository.Add(reciptAllocaltion);
                   _unitOfWork.Save();
               }
               return true;
               }
               catch (Exception)
               {

               return false;
               }
        }
Пример #3
0
        public bool Approve(Transfer transfer)
        {
            if (transfer!=null)
               {
                   transfer.StatusID = (int) LocalPurchaseStatus.Approved;
                   _unitOfWork.TransferRepository.Edit(transfer);
                   var reciptAllocaltion = new ReceiptAllocation()
                   {
                       ReceiptAllocationID = Guid.NewGuid(),
                       ProgramID = transfer.ProgramID,
                       CommodityID = transfer.CommodityID,
                       ETA = transfer.CreatedDate,
                       SINumber = transfer.ShippingInstruction.Value,
                       QuantityInMT = transfer.Quantity,
                       HubID = transfer.DestinationHubID,
                       CommoditySourceID = transfer.CommoditySourceID,
                       ProjectNumber = transfer.ProjectCode,
                       SourceHubID = transfer.SourceHubID,
                       PartitionID = 0,
                       IsCommited = false
                   };
                   _unitOfWork.ReceiptAllocationReository.Add(reciptAllocaltion);
                   _unitOfWork.Save();
                   return true;

               }
               return false;
        }
Пример #4
0
        public bool ApproveRecieptPlan(LoanReciptPlan loanReciptPlan)
        {
            if (loanReciptPlan != null)
               {
               loanReciptPlan.StatusID = (int)LocalPurchaseStatus.Approved;
               _unitOfWork.LoanReciptPlanRepository.Edit(loanReciptPlan);
               _unitOfWork.Save();
               var loanReceiptPlanDetail =
                   _unitOfWork.LoanReciptPlanDetailRepository.FindBy(
                       l => l.LoanReciptPlanID == loanReciptPlan.LoanReciptPlanID);
               if (loanReceiptPlanDetail != null)
                   foreach (var loan in loanReceiptPlanDetail)
                   {
                       var parentID = _unitOfWork.CommodityRepository.FindById(loanReciptPlan.CommodityID).ParentID ??
                                      loanReciptPlan.CommodityID;

                       var reciptAllocaltion = new ReceiptAllocation()
                                                   {
                                                       ReceiptAllocationID = Guid.NewGuid(),
                                                       ProgramID = loanReciptPlan.ProgramID,
                                                       CommodityID = (int) parentID,
                                                       ETA = loanReciptPlan.CreatedDate,
                                                       SINumber = loanReciptPlan.ShippingInstruction.Value,
                                                       QuantityInMT = loan.RecievedQuantity,
                                                       HubID = loan.HubID,
                                                       CommoditySourceID = loanReciptPlan.CommoditySourceID,
                                                       ProjectNumber = loanReciptPlan.ProjectCode,
                                                       //SourceHubID = loanReciptPlan.SourceHubID,
                                                       DonorID = int.Parse(loanReciptPlan.LoanSource),
                                                       PartitionId = 0,
                                                       IsCommited = false,
                                                       IsFalseGRN = loanReciptPlan.IsFalseGRN,
                                                       ReceiptPlanID = loan.LoanReciptPlanDetailID
                                                   };

                       _unitOfWork.ReceiptAllocationReository.Add(reciptAllocaltion);

                       _unitOfWork.Save();
                   }
               return true;

               }
               return false;
        }