コード例 #1
0
        public virtual ActionResult Increase(long clientId, PaymentModel model)
        {
            Debug.Assert(model.Money != null);

            if (!ModelState.IsValid)
            {
                BindBag(clientId);

                return(View(model));
            }

            try
            {
                var timestamp = DateTimeOffset.Parse(model.Timestamp);
                _balance.Increase(clientId, model.Money.Value, model.Comment, timestamp, false);
            }
            catch (ArgumentException e)
            {
                BindBag(clientId);

                ModelState.AddModelError(e.ParamName, e.Message);

                return(View(model));
            }

            return(RedirectToAction(MVC.Balance.Increase(clientId)));
        }
コード例 #2
0
        public void Increase(long clientId, decimal money, string comment, DateTimeOffset timestamp, bool isCalculation)
        {
            using (var scope = new TransactionScope())
            {
                _instance.Increase(clientId, money, comment, timestamp, isCalculation);

                AddEvent(clientId, money, comment, timestamp, EventType.BalanceIncreased);

                scope.Complete();
            }
        }
コード例 #3
0
        public void CancelCalculatation(long applicationId)
        {
            var calculation = _calculations.GetByApplication(applicationId);

            _service.CancelCalculatation(applicationId);

            var money = CalculationDataHelper.GetMoney(calculation, calculation.InsuranceRate);

            _balance.Increase(calculation.ClientId,
                              money,
                              GetComment(EventType.CalculationCanceled, calculation),
                              DateTimeProvider.Now,
                              true);
        }