Esempio n. 1
0
        public void EnbaledForm(string keyValue)
        {
            FlowEntity flowEntity = GetForm(keyValue);

            if (flowEntity != null && !string.IsNullOrEmpty(flowEntity.Id))
            {
                flowEntity.Modify(keyValue);
                flowEntity.EnabledMark = true;
                service.Update(flowEntity);
            }
            else
            {
                throw new Exception("获取数据异常!");
            }
        }
Esempio n. 2
0
        public ICommandResult Handle(UpdateFlowCommand command)
        {
            ICommandResult result = new CommandResult();

            _loggingService.Log(this.GetType(), ELogType.Neutral, ELogLevel.Debug, new { command.Owner, command.OwnerType, command.Object, command.Path, command.RequestHost }, "FlowCommandHandler.Handle(Update)");

            try
            {
                Flow flow = new Flow(command.Owner, command.OwnerType, command.Object, command.Path);

                if (flow.Valid)
                {
                    if (_flowRepository.CheckExists(command.Id))
                    {
                        if (!_flowRepository.CheckExists(flow.Path))
                        {
                            if (_flowRepository.Update(command.Id, flow))
                            {
                                result = new CommandResult(200);
                            }
                        }

                        else if (_flowRepository.Valid)
                        {
                            result = new CommandResult(400, new Notification("Path", "Already in Use"));
                        }
                    }

                    else if (_flowRepository.Valid)
                    {
                        result = new CommandResult(400, new Notification("Flow", "Could not be found"));
                    }
                }

                else
                {
                    result = new NewFlowCommandResult(400, flow.Notifications);
                }
            }
            catch (Exception e)
            {
                _loggingService.Log(this.GetType(), ELogType.Neutral, ELogLevel.Error, new { command.Owner, command.OwnerType, command.Object, command.Path, command.RequestHost }, e);
            }

            return(result);
        }
Esempio n. 3
0
        public Flow Update(Flow updateFlow)
        {
            Flow flow = _flowRepository.Update(updateFlow);

            return(flow);
        }