Exemplo n.º 1
0
        public IActionResult InsertTransaction([FromBody] PointTransaction transaction)
        {
            var result = _tokenService.CreateToken(transaction);

            _tokenService.SaveChanges();

            return(Ok(result));
        }
Exemplo n.º 2
0
        public PointTransaction Update(PointTransaction token)
        {
            var cleanToken = RemoveTransactionChildren(token);

            _context.PointTransaction.Update(cleanToken);

            return(token);
        }
Exemplo n.º 3
0
        private PointTransaction RemoveTransactionChildren(PointTransaction transaction)
        {
            var cleanTransaction = transaction;

            cleanTransaction.AwardFrom            = null;
            cleanTransaction.AwardTo              = null;
            cleanTransaction.Product              = null;
            cleanTransaction.PointTransactionType = null;
            return(cleanTransaction);
        }
Exemplo n.º 4
0
 public static PointTransaction CreatePointTransaction(int pointTransactionID, int customerID, int pointAccountID, decimal amount, int pointTransactionTypeID, global::System.DateTime transactionDate)
 {
     PointTransaction pointTransaction = new PointTransaction();
     pointTransaction.PointTransactionID = pointTransactionID;
     pointTransaction.CustomerID = customerID;
     pointTransaction.PointAccountID = pointAccountID;
     pointTransaction.Amount = amount;
     pointTransaction.PointTransactionTypeID = pointTransactionTypeID;
     pointTransaction.TransactionDate = transactionDate;
     return pointTransaction;
 }
Exemplo n.º 5
0
 public void AddToPointTransactions(PointTransaction pointTransaction)
 {
     base.AddObject("PointTransactions", pointTransaction);
 }
        private static void ImportMemberinVexiere(PointTransaction transaction)
        {
            Member member = _memberServiceClient.GetMember(new ApplicationContext(), new NameBasedMemberIdentifier { MemberName = transaction.CustomerID.ToString() }, null);

            if (member == null)
            {

                var context = Context.Current.ExigoContext;
                var customer = context.Customers.Where(x => x.CustomerID == transaction.CustomerID).FirstOrDefault();
                if (customer != null)
                {
                    member = new Member();
                    member.CreationDate = DateTime.UtcNow;
                    member.MemberName = customer.CustomerID.ToString();
                    member.Email = customer.Email;
                    member.BirthDate = customer.BirthDate ?? DateTime.Now;
                    member.Name = new Name()
                    {
                        FirstName = customer.FirstName,
                        LastName = customer.LastName
                    };
                    member.SoftCashSetting = new SoftCashSetting()
                    {
                        DollarEquivalent = 1,
                        MinimumBalance = 200,
                        ExpiryDays = 365
                    };

                    _memberServiceClient.CreateMember(new ApplicationContext(), member, null);
                }
            }
        }
        private static List<PointTransaction> GetTransaction()
        {
            List<PointTransaction> list=new List<PointTransaction>();

            //---Customer ID,Transaction ID,Amount,Transaction Date,Point Account----//

            var allSoftCash = new StreamReader(ConfigurationManager.AppSettings["AllSoftCash"]);

            while(!allSoftCash.EndOfStream)
            {
                string line = allSoftCash.ReadLine();
                var data = line.Split(',');
                var pt = new PointTransaction();
                pt.CustomerID = Convert.ToInt32(data[0]);
                pt.PointTransactionId = Convert.ToInt32(data[1]);
                pt.Amount = Convert.ToDecimal(data[2]);
                pt.TransactionDate = Convert.ToDateTime(data[3]);
                pt.PointAccountID = Convert.ToInt32(data[4]);

                //if (existingIds.Contains(pt.PointTransactionId.ToString()) == false)
                list.Add(pt);

            }

            return list;
        }
        private static List<Int32> GetExecutedIds()
        {
            var executedIds = new List<Int32>();
            var allSoftCash = new StreamReader(ConfigurationManager.AppSettings["ExecutedSoftCashIds"]);

            while (!allSoftCash.EndOfStream)
            {
                string line = allSoftCash.ReadLine();
                var data = line.Split(',');
                var pt = new PointTransaction();
               executedIds.Add(Convert.ToInt32(data[0]));
            }

            return executedIds;
        }
 public PointTransaction UpdateToken(PointTransaction token)
 {
     return(_tokenRepository.Update(token));
 }
Exemplo n.º 10
0
 public Task CreateAsync(PointTransaction transaction)
 {
     DL.PointTransactions pTr = _mapper.Map <DL.PointTransactions>(transaction);
     _dbContext.PointTransactions.Add(pTr);
     return(_dbContext.SaveChangesAsync());
 }