protected void OnButtonAcceptClicked(object sender, EventArgs e)
        {
            var validationContext = _validationContextFactory.CreateNewValidationContext(
                Entity,
                new Dictionary <object, object> {
                { "NewStatus", RouteListStatus.Closed },
                { nameof(IRouteListItemRepository), new RouteListItemRepository() }
            });

            validationContext.ServiceContainer.AddService(new OrderParametersProvider(_parametersProvider));
            validationContext.ServiceContainer.AddService(new DeliveryRulesParametersProvider(_parametersProvider));

            if (!ServicesConfig.ValidationService.Validate(Entity, validationContext))
            {
                return;
            }

            if (Entity.Status == RouteListStatus.Delivered)
            {
                ChangeStatusAndCreateTaskFromDelivered();
            }
            Entity.AcceptMileage(CallTaskWorker);

            UpdateStates();
            SaveAndClose();
        }
Exemple #2
0
        protected void OnButtonAcceptClicked(object sender, EventArgs e)
        {
            var validationContext = new Dictionary <object, object> {
                { "NewStatus", RouteListStatus.Closed },
                { nameof(IRouteListItemRepository), new EntityRepositories.Logistic.RouteListItemRepository() }
            };
            var valid = new QSValidator <RouteList>(Entity, validationContext);

            if (valid.RunDlgIfNotValid((Window)this.Toplevel))
            {
                return;
            }

            if (Entity.Status == RouteListStatus.Delivered)
            {
                Entity.ChangeStatusAndCreateTask(RouteListStatus.MileageCheck, CallTaskWorker);
            }
            Entity.AcceptMileage(CallTaskWorker);

            UpdateStates();
            SaveAndClose();
        }