Пример #1
0
        public Command RunSearcher(Dictionary <string, object> row, WebCommandsController controller) //obligatorio tanto por la interface como que es el metodo que se ejecutara para buscar y crear el command
        {
            CreateWebUser commands = null;

            if (row.GetValueOrDefault("userid").ToString().Equals(""))
            {
                string uid = Guid.NewGuid().ToString(); //generamos el guid del usuario

                //hay que indicar que campo de la tabla es la clave por la que realizaremos las busquedas
                if (ConsultasPreparadas.Singelton().UpdateTableForGUID(controller, row, uid, "usercode") == 1)
                {
                    Console.WriteLine("Preparando el command CreateWebUser");
                    commands = new CreateWebUser(uid)
                    {
                        Username = row.GetValueOrDefault("username").ToString(), Usercode = row.GetValueOrDefault("usercode").ToString()
                    };
                }
            }
            else
            {
                //mirar en la base de datos del marc si existe, si existe no hacemos nada, si no existe volvemos a enviar el command
                Boolean exist = false;

                if (!exist)
                {
                    Console.WriteLine("Re-enviando command CreateWebUser");
                    commands = new CreateWebUser(row.GetValueOrDefault("userid").ToString())
                    {
                        Username = row.GetValueOrDefault("username").ToString(), Usercode = row.GetValueOrDefault("usercode").ToString()
                    };
                }
            }

            return(commands); //devuelvo el command
        }
Пример #2
0
 public WebUserCreated(string aggregateId, string username, string usercode, CreateWebUser previous)
     : base(typeof(WebUser).Name, aggregateId, 0, previous)
 {
     Id            = aggregateId;
     this.Username = username;
     this.Usercode = usercode;
 }
Пример #3
0
 public async Task CreateWebUser(CreateWebUser command)
 {
     //Console.WriteLine("Creando evento WebUserCreated");
     await RaiseEventAsync(new WebUserCreated(command.AggregateId, command.Username, command.Usercode, command));
 }