コード例 #1
0
 public bool DeleteDonationPlanHeader(DonationPlanHeader donationPlanHeader)
 {
     if (donationPlanHeader == null)
     {
         return(false);
     }
     _unitOfWork.DonationPlanHeaderRepository.Delete(donationPlanHeader);
     _unitOfWork.Save();
     return(true);
 }
コード例 #2
0
 public bool DeleteReceiptAllocation(DonationPlanHeader donationPlanHeader)
 {
     try
     {
         var donationDetailHubIDs =
             _unitOfWork.DonationPlanDetailRepository.FindBy(
                 m => m.DonationHeaderPlanID == donationPlanHeader.DonationHeaderPlanID).Select(m => m.HubID);
         var receiptPlans = _unitOfWork.ReceiptAllocationReository.FindBy(m => donationDetailHubIDs.Contains(m.HubID) && m.SINumber == donationPlanHeader.ShippingInstruction.Value &&
                                                                          m.ETA == donationPlanHeader.ETA);
         foreach (var receiptAllocation in receiptPlans)
         {
             _unitOfWork.ReceiptAllocationReository.Delete(receiptAllocation);
         }
         _unitOfWork.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
 public bool DeleteDonation(DonationPlanHeader donationPlanHeader)
 {
     try
     {
         var donationPlanDetails =
             _unitOfWork.DonationPlanDetailRepository.FindBy(
                 m => m.DonationHeaderPlanID == donationPlanHeader.DonationHeaderPlanID);
         foreach (var planDetail in donationPlanDetails)
         {
             _unitOfWork.DonationPlanDetailRepository.Delete(planDetail);
             _unitOfWork.Save();
         }
         _unitOfWork.DonationPlanHeaderRepository.Delete(donationPlanHeader);
         _unitOfWork.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #4
0
        private bool SaveNewDonationPlan(DonationViewModel donationViewModel, int siId)
        {
            try
            {
                var donationHeader = new DonationPlanHeader
                {
                    AllocationDate        = DateTime.Now,
                    CommodityID           = donationViewModel.CommodityID,
                    DonorID               = donationViewModel.DonorID,
                    ETA                   = donationViewModel.ETA,
                    IsCommited            = false,
                    ProgramID             = donationViewModel.ProgramID,
                    ShippingInstructionId = siId,
                    DonatedAmount         = donationViewModel.WieghtInMT,
                    CommodityTypeID       = donationViewModel.CommodityTypeID
                };

                foreach (var donationDetail in donationViewModel.DonationPlanDetails.Select(donationPlanDetail => new DonationPlanDetail
                {
                    HubID = donationPlanDetail.HubID,
                    AllocatedAmount = donationPlanDetail.AllocatedAmount,
                    ReceivedAmount = donationPlanDetail.ReceivedAmount,
                    Balance = donationPlanDetail.Balance,
                    DonationPlanHeader = donationHeader
                }))
                {
                    _donationPlanDetailService.AddDonationPlanDetail(donationDetail);
                }

                _transactionService.PostDonationPlan(donationHeader);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #5
0
 public bool EditDonationPlanHeader(DonationPlanHeader donationPlanHeader)
 {
     _unitOfWork.DonationPlanHeaderRepository.Edit(donationPlanHeader);
     _unitOfWork.Save();
     return(true);
 }