Exemple #1
0
        public PaymentByCardViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            CallTaskWorker callTaskWorker,
            IOrderPaymentSettings orderPaymentSettings,
            IOrderParametersProvider orderParametersProvider,
            Employee currentEmployee) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            if (orderPaymentSettings == null)
            {
                throw new ArgumentNullException(nameof(orderPaymentSettings));
            }

            if (orderParametersProvider == null)
            {
                throw new ArgumentNullException(nameof(orderParametersProvider));
            }

            _callTaskWorker  = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker));
            _currentEmployee = currentEmployee;

            TabName = "Оплата по карте";

            ItemsList = UoW.GetAll <PaymentFrom>().ToList();

            if (PaymentByCardFrom == null)
            {
                PaymentByCardFrom = ItemsList.FirstOrDefault(p => p.Id == orderPaymentSettings.DefaultSelfDeliveryPaymentFromId);
            }

            Entity.PropertyChanged += Entity_PropertyChanged;

            ValidationContext.ServiceContainer.AddService(typeof(IOrderParametersProvider), orderParametersProvider);
        }
        public PaymentByCardViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            CallTaskWorker callTaskWorker,
            IOrderPaymentSettings orderPaymentSettings
            )
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            this.orderPaymentSettings = orderPaymentSettings ?? throw new ArgumentNullException(nameof(orderPaymentSettings));
            this.callTaskWorker       = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker));
            TabName = "Оплата по карте";

            ItemsList = UoW.GetAll <PaymentFrom>().ToList();

            if (PaymentByCardFrom == null)
            {
                PaymentByCardFrom = ItemsList.FirstOrDefault(p => p.Id == orderPaymentSettings.DefaultSelfDeliveryPaymentFromId);
            }

            Entity.PropertyChanged += Entity_PropertyChanged;
        }