Beispiel #1
0
        //TODO: payment.CreatedByID = Account.GetCurrentUser().ID; before edit payment
        public void Edit(D.Payment payment)
        {
            EF.Payment efpayment = ConverToEFwithID(payment);

            var tempPayment = _context.Payments.Single(a => a.PaymentID == efpayment.PaymentID);

            tempPayment.PaymentID     = efpayment.PaymentID;
            tempPayment.Name          = efpayment.Name;
            tempPayment.Amount        = efpayment.Amount;
            tempPayment.BeneficiaryID = efpayment.BeneficiaryID;
            tempPayment.CurrencyID    = efpayment.CurrencyID;
            tempPayment.Locked        = efpayment.Locked;
            tempPayment.Email         = efpayment.Email;
            //tempPayment.CreatedDate = efpayment.CreatedDate;
            //tempPayment.PaymentDate = efpayment.PaymentDate;
            tempPayment.ModifiedDate    = efpayment.ModifiedDate;
            tempPayment.PublishDate     = efpayment.PublishDate;
            tempPayment.CreatedByID     = efpayment.CreatedByID;
            tempPayment.ModifiedByID    = efpayment.ModifiedByID;
            tempPayment.PaymentSourceID = efpayment.PaymentSourceID;
            tempPayment.PaymentTypeID   = efpayment.PaymentTypeID;
            tempPayment.OptOut          = efpayment.OptOut;

            _context.SaveChanges();
        }
Beispiel #2
0
 public void Delete(D.Payment payment)
 {
     throw new NotImplementedException();
     //EF.Payment efpayment = ConverToEFwithID(payment);
     //_context.Payments.Attach(ConvertToEF(payment));
     //_context.Entry(efpayment).State = EntityState.Deleted;
     //_context.Payments.Remove(ConvertToEF(payment));
     //_context.SaveChanges();
 }
Beispiel #3
0
        private EF.Payment ConvertToEF(D.Payment payment)
        {
            int beneficiaryID = _context.Beneficiaries.FirstOrDefault(b => b.Name == payment.Beneficiary.Name).BeneficiaryID;
            int currencyID    = _context.Currencies.FirstOrDefault(c => c.CurrencyCode == payment.Currency.CurrencyCode).CurrencyID;
            int sourceID      = _context.Sources.FirstOrDefault(c => c.Source == payment.Source.Source).PaymentSourceID;
            int typeID        = _context.Types.FirstOrDefault(c => c.Type == payment.Type.Type).PaymentTypeID;
            int createdByID   = _context.Accounts.FirstOrDefault(c => c.UserName == payment.CreatedBy).AccountID;

            return(new EF.Payment(payment.Name, payment.Amount, beneficiaryID, currencyID, payment.Email, payment.CreatedDate,
                                  payment.PaymentDate, createdByID, sourceID, typeID, payment.OptOut));
        }
Beispiel #4
0
        private EF.Payment ConverToEFwithID(D.Payment payment)
        {
            int beneficiaryID = _context.Beneficiaries.FirstOrDefault(b => b.Name == payment.Beneficiary.Name).BeneficiaryID;
            int currencyID    = _context.Currencies.FirstOrDefault(c => c.CurrencyCode == payment.Currency.CurrencyCode).CurrencyID;
            int sourceID      = _context.Sources.FirstOrDefault(c => c.Source == payment.Source.Source).PaymentSourceID;
            int typeID        = _context.Types.FirstOrDefault(c => c.Type == payment.Type.Type).PaymentTypeID;
            int createdByID   = _context.Accounts.FirstOrDefault(c => c.UserName == payment.CreatedBy).AccountID;

            int paymentID = _context.Payments.FirstOrDefault(p => p.PaymentID == payment.PaymentID).PaymentID;

            var accounts     = _context.Accounts;
            var account      = accounts.FirstOrDefault(c => c.UserName == payment.ModifiedBy);
            int modifiedByID = account.AccountID;

            return(new EF.Payment(payment.PaymentID, payment.Name, payment.Amount, beneficiaryID, currencyID, payment.Locked,
                                  payment.Email, payment.CreatedDate, payment.PaymentDate, payment.ModifiedDate, payment.PublishDate, createdByID,
                                  modifiedByID, sourceID, typeID, payment.OptOut));
        }
Beispiel #5
0
 public bool Exists(D.Payment payment)
 {
     return(GetAllEF().Equals(payment));
 }
Beispiel #6
0
 //TODO: payment.CreatedByID = Account.GetCurrentUser().ID; before adding payment
 public void Add(D.Payment payment)
 {
     _context.Payments.Add(ConvertToEF(payment));
     _context.SaveChanges();
 }
Beispiel #7
0
 public void Delete(D.Payment payment)
 {
     _context.Payments.Remove(ConvertToEF(payment));
     _context.SaveChanges();
 }
Beispiel #8
0
 //TODO: payment.CreatedByID = Account.GetCurrentUser().ID; before edit payment
 public void Edit(D.Payment payment)
 {
     EF.Payment efpayment = ConverToEFwithID(payment);
     _context.Entry(efpayment).State = EntityState.Modified;
     _context.SaveChanges();
 }
Beispiel #9
0
 public void Edit(P.Payment payment)
 {
     PaymentRepository.Edit(payment);
 }
Beispiel #10
0
 public void Publish(P.Payment payment)
 {
     payment.Publish();
     PaymentRepository.Edit(payment);
 }
Beispiel #11
0
 public void Create(P.Payment payment)
 {
     PaymentRepository.Add(payment);
 }