public async Task <ICommandResult> Handle(ActionDefineAddCommand mesage)
        {
            try
            {
                ActionDefine actionDefine = new ActionDefine();
                actionDefine.Init(mesage);

                await _roleService.AddToDb(actionDefine);

                await _eventSender.Notify(actionDefine.Events);

                ICommandResult result = new CommandResult
                {
                    Message  = "",
                    ObjectId = actionDefine.Id,
                    Status   = CommandResult.StatusEnum.Sucess
                };
                return(result);
            }
            catch (Exception e)
            {
                e.Data["Param"] = mesage;
                ICommandResult result = new CommandResult()
                {
                    Message = e.Message,
                    Status  = CommandResult.StatusEnum.Fail
                };
                return(result);
            }
        }
 public async Task Add(ActionDefine actionDefine)
 {
     await WithConnection(async (connection) =>
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@Id", actionDefine.Id, DbType.String);
         parameters.Add("@NAME", actionDefine.Name, DbType.String);
         parameters.Add("@Group", actionDefine.Group, DbType.String);
         var data = await connection.ExecuteAsync(ProcName.ActionDefine_Add, parameters, commandType: CommandType.StoredProcedure);
         return(data);
     });
 }
示例#3
0
        public bool CallLogicAction(ActionDefine actionType, ActionParam param)
        {
            try
            {
                LogicAction action = (LogicAction)LogicActionFactory.Instance.CreateAction(actionType);
                if (null == action)
                {
                    return(false);
                }
                action.ActionId = (int)actionType;
                action.ActParam = param;

                lock (m_QueueLogicAction)
                {
                    m_QueueLogicAction.Enqueue(action);
                }
                return(true);
            }
            catch (Exception ex)
            {
                DebugMod.LogException(ex);
                return(false);
            }
        }
示例#4
0
 public async Task AddToDb(ActionDefine actionDefine)
 {
     await _actionDefineRepository.Add(actionDefine);
 }