public UserRole GetById(Guid id) { using (var connection = context.CreateConnection()) { return(connection.Query <UserRole>(UserRoleQuery.ById(id)).SingleOrDefault()); } }
public void Delete(Guid id) { using (var connection = context.CreateConnection()) { connection.Execute(UserRoleQuery.Delete(id)); } }
public IEnumerable <UserRole> GetAll() { using (var connection = context.CreateConnection()) { return(connection.Query <UserRole>(UserRoleQuery.All())); } }
internal static bool ConsultarRol() { const string methodName = "ConsultarRol"; try { Log.WriteEntry(ClassName, methodName, TraceEventType.Information, "Consultando Rol de usuario: " + _userName); // Leer User Role var URquery = new UserRoleQuery(_userName); var result = _proxy.Handle(URquery); Log.WriteEntry(ClassName, methodName, TraceEventType.Information, string.Format("Resultado: UserID: {0} Nombre: {1} Rol: {2}", result.UserID, result.UserName, result.UserRole)); // Guardar UserId para Lectura de datos _userID = result.UserID; _userRole = result.UserRole; return(true); } catch (Exception ex) { Log.WriteEntry(ClassName, methodName, TraceEventType.Error, string.Format("Error: {0}", ex.Message)); return(false); } }
static bool LoginAdministrador(IMessageHandling proxy) { var loginCmd = new LoginCommand { UserName = "******", Password = "******", }; var status = proxy.Handle(loginCmd); bool Success = status.GetType() == typeof(Success); if (Success) { Console.WriteLine("Login Aceptado."); // Leer User Role var URquery = new UserRoleQuery(loginCmd.UserName); var result = proxy.Handle(URquery); Console.WriteLine(string.Format(" UserID: {0} Nombre: {1} Rol: {2}", result.UserID, result.UserName, result.UserRole)); // Guardar UserId para Lectura de datos _userID = result.UserID; return(true); } else { Console.WriteLine(string.Format("Login Denegado. Mensaje: {0}", (status as Failure).Errormessage)); return(false); } }
public UserRole Update(UserRole userrole) { using (var connection = context.CreateConnection()) { connection.Execute(UserRoleQuery.Update(userrole)); return(userrole); } }
// Query Handling public UserRoleQueryResult Handle(UserRoleQuery query) { ICollectionRead <Usuario> qryDataUser = new UsuarioData(); IEntityRead <Userinfo> qryDataUserInfo = new UserinfoData(); UserRoleQueryHandler qryHandler = new UserRoleQueryHandler(qryDataUser, qryDataUserInfo); return(qryHandler.Handle(query)); }
public UserRole Create(UserRole userrole) { if (userrole.Id == Guid.Empty) { userrole.Id = Guid.NewGuid(); } using (var connection = context.CreateConnection()) { connection.Execute(UserRoleQuery.Insert(userrole)); return(userrole); } }
public void In_UserRoleQuery(UserRoleQuery query) { try { ICollectionRead <Usuario> qryDataUser = new UsuarioData(); IEntityRead <Userinfo> qryDataUserInfo = new UserinfoData(); UserRoleQueryHandler qryHandler = new UserRoleQueryHandler(qryDataUser, qryDataUserInfo); Out_UserRoleQuery(qryHandler.Handle(query)); } catch (Exception) { throw; } }
static bool LoginJefeGrupo(IMessageHandling proxy) { var loginCmd = new LoginCommand { UserName = "******", Password = "******", }; var status = proxy.Handle(loginCmd); bool Success = status.GetType() == typeof(Success); if (Success) { Console.WriteLine("Login Aceptado."); // Leer User Role var URquery = new UserRoleQuery(loginCmd.UserName); var result = proxy.Handle(URquery); Console.WriteLine(string.Format(" UserID: {0} Nombre: {1} Rol: {2}", result.UserID, result.UserName, result.UserRole)); // Guardar UserId para Lectura de datos _userID = result.UserID; // Valor de prueba en DB 72011518751 Console.WriteLine(string.Format(" Comparacion UserID leído: {0} esperado: 72011518751 ", _userID)); return(true); } else { Console.WriteLine(string.Format("Login Denegado. Mensaje: {0}", (status as Failure).Errormessage)); return(false); } }
public UserRoleQueryResult Handle(UserRoleQuery query) { return(GetUserRole(query.Login)); }
public async Task <IActionResult> Get([FromQuery] UserRoleQuery query) { var result = await _mediator.Send(query); return(Ok(result)); }