public List<customer> GetCustomersFromAUser(int userID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.customers.Where(c=>c.id_usuario.Equals(userID)).ToList<customer>(); } }
public List<customer> GetCustomers() { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.customers.OrderBy(c => c.nome).ToList<customer>(); } }
public customer GetCustomerById(int customerID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.customers.FirstOrDefault(c=>c.id_customer.Equals(customerID)); } }
public List<usuario> GetUsersWithAnAccessLevel(int accessLevel) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.usuarios.Where(u=>u.valor_nivel_acesso.Equals(accessLevel)).ToList<usuario>(); } }
public usuario GetUserById(int userID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.usuarios.FirstOrDefault(u=>u.id_usuario.Equals(userID)) ; } }
public List<usuario> GetUsers() { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.usuarios.OrderBy(u => u.nome).ToList<usuario>(); } }
public List<usuario> GetUsersFromACity(int cityID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.usuarios.Where(u => u.cidade.Equals(cityID)).OrderBy(u => u.nome).ToList<usuario>(); } }
public nivel_acesso GetAccessLevelById(int accessLevelID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.niveis_acesso.FirstOrDefault(na => na.id_nivel_acesso.Equals(accessLevelID)); } }
public List<customer> GetCustomersFromACity(int cityID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.customers.Where(c => c.id_cidade.Equals(cityID)).OrderBy(c => c.nome).ToList<customer>(); } }
public List<regiao> GetRegionsFromACity(int cityID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.regioes.Where(r => r.id_cidade.Equals(cityID)).ToList<regiao>(); } }
public List<cidade> GetCities() { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.cidades.OrderBy(c => c.nome).ToList<cidade>(); } }
public cidade GetCityById(int cityID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.cidades.FirstOrDefault(c => c.id_cidade.Equals(cityID)); } }
public regiao GetRegionById(int regionID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.regioes.FirstOrDefault(r => r.id_regiao.Equals(regionID)); } }
public List<classificacao> GetClassifications() { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.classificacoes.OrderBy(c => c.nome).ToList<classificacao>(); } }
public classificacao GetClassificationById(int classificationID) { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.classificacoes.FirstOrDefault(c => c.id_classificacao.Equals(classificationID)); } }
public List<nivel_acesso> GetAccessLevels() { using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.niveis_acesso.OrderBy(na => na.nome).ToList<nivel_acesso>(); } }
public usuario GetUserByLoginAndPassword(string login, string password) { // Create a MD5 hash of the password for comparison MD5 md5 = MD5.Create(); byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(password)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString()); } string hashedPassword = sb.ToString(); using (DAOModelEntities ctx = new DAOModelEntities()) { return ctx.usuarios.FirstOrDefault(u => u.email.Equals(login) && u.senha.Equals(hashedPassword)); } }