int IPaymentService.SaveOrUpdateCollection(PaymentCollectionDTO paymentCollection)
        {
            paymentcollection paymentcollectionEntity = new paymentcollection();
            AutoMapper.Mapper.Map(paymentCollection, paymentcollectionEntity);

            if (paymentCollection.PC_Id == 0)
            {
                base.PaymentCollectionRepository.Save(paymentcollectionEntity);
            }
            else
            {
                base.PaymentCollectionRepository.Update(paymentcollectionEntity);
            }
            return paymentcollectionEntity.PC_Id;
        }
     private void Fixuppaymentcollection(paymentcollection previousValue)
     {
         if (previousValue != null && previousValue.paymenttransits.Contains(this))
         {
             previousValue.paymenttransits.Remove(this);
         }
 
         if (paymentcollection != null)
         {
             if (!paymentcollection.paymenttransits.Contains(this))
             {
                 paymentcollection.paymenttransits.Add(this);
             }
             if (PaymentTransit_CollectionId != paymentcollection.PC_Id)
             {
                 PaymentTransit_CollectionId = paymentcollection.PC_Id;
             }
         }
     }
        void IPaymentService.SendPaymentToHeadCashier(BatchTransferDTO batchTransferDTO)
        {
            batchtransfer batchtransferEntity = new batchtransfer();
            AutoMapper.Mapper.Map(batchTransferDTO, batchtransferEntity);

            using (TransactionScope transactionScope = new TransactionScope())
            {
                base.BatchTransferRepository.Save(batchtransferEntity);

                foreach (PaymentTransitDTO item in batchTransferDTO.PaymentTransits)
                {
                    PaymentCollectionDTO paymentCollectionDTO = GetCollectionDetailsById(item.PaymentTransit_CollectionId);
                    paymentCollectionDTO.PC_Status = (int)Globals.CollectionStatus.SENTTOCASHIER;
                    paymentCollectionDTO.PC_LastUpdateDate = DateTime.Now;

                    paymentcollection paymentcollectionEntity = new paymentcollection();
                    AutoMapper.Mapper.Map(paymentCollectionDTO, paymentcollectionEntity);

                    base.PaymentCollectionRepository.Update(paymentcollectionEntity);
                }
                transactionScope.Complete();
            }
        }
        void IPaymentService.UpdateBatchDetails(BatchTransferDTO batchTransferDTO)
        {
            using (TransactionScope transactionScope = new TransactionScope())
            {
                batchtransfer batchTransferEntity = new batchtransfer();
                AutoMapper.Mapper.Map(batchTransferDTO, batchTransferEntity);

                base.BatchTransferRepository.Update(batchTransferEntity);

                foreach (PaymentTransitDTO item in batchTransferDTO.PaymentTransits)
                {
                    PaymentCollectionDTO paymentCollectionDTO = GetCollectionDetailsById(item.PaymentTransit_CollectionId);
                    paymentCollectionDTO.PC_Status = (int)Globals.CollectionStatus.ACCEPTEDBYCASHIER;
                    paymentCollectionDTO.PC_LastUpdateDate = DateTime.Now;

                    ////Instrument status and Instrument Realization date to be updated
                    ////in case payment mode is cheque
                    if (paymentCollectionDTO.PC_PaymentMode == (int)Globals.PaymentModes.CHEQUE)
                    {
                        paymentCollectionDTO.PC_InstrumentStatus = (int)Globals.InstrumentStatus.PENDING;
                        paymentCollectionDTO.PC_InstrumentRealizationDate = DateTime.Now;
                    }
                    else
                    {
                        paymentCollectionDTO.PC_InstrumentStatus = 0;
                    }

                    paymentcollection paymentcollectionEntity = new paymentcollection();
                    AutoMapper.Mapper.Map(paymentCollectionDTO, paymentcollectionEntity);

                    base.PaymentCollectionRepository.Update(paymentcollectionEntity);
                }
                transactionScope.Complete();
            }
        }
     private void Fixuppaymentcollection(paymentcollection previousValue)
     {
         if (previousValue != null && previousValue.smspaymentregistrations.Contains(this))
         {
             previousValue.smspaymentregistrations.Remove(this);
         }
 
         if (paymentcollection != null)
         {
             if (!paymentcollection.smspaymentregistrations.Contains(this))
             {
                 paymentcollection.smspaymentregistrations.Add(this);
             }
             if (SMSPay_Payment_Id != paymentcollection.PC_Id)
             {
                 SMSPay_Payment_Id = paymentcollection.PC_Id;
             }
         }
         else if (!_settingFK)
         {
             SMSPay_Payment_Id = null;
         }
     }