Beispiel #1
0
 public List<customer> GetCustomersFromAUser(int userID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.customers.Where(c=>c.id_usuario.Equals(userID)).ToList<customer>();
     }
 }
Beispiel #2
0
 public List<customer> GetCustomers()
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.customers.OrderBy(c => c.nome).ToList<customer>();
     }
 }
Beispiel #3
0
 public customer GetCustomerById(int customerID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.customers.FirstOrDefault(c=>c.id_customer.Equals(customerID));
     }
 }
Beispiel #4
0
 public List<usuario> GetUsersWithAnAccessLevel(int accessLevel)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.usuarios.Where(u=>u.valor_nivel_acesso.Equals(accessLevel)).ToList<usuario>();
     }
 }
Beispiel #5
0
 public usuario GetUserById(int userID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.usuarios.FirstOrDefault(u=>u.id_usuario.Equals(userID)) ;
     }
 }
Beispiel #6
0
 public List<usuario> GetUsers()
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.usuarios.OrderBy(u => u.nome).ToList<usuario>();
     }
 }
Beispiel #7
0
 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>();
     }
 }
Beispiel #8
0
 public nivel_acesso GetAccessLevelById(int accessLevelID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.niveis_acesso.FirstOrDefault(na => na.id_nivel_acesso.Equals(accessLevelID));
     }
 }
Beispiel #9
0
 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>();
     }
 }
Beispiel #10
0
 public List<regiao> GetRegionsFromACity(int cityID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.regioes.Where(r => r.id_cidade.Equals(cityID)).ToList<regiao>();
     }
 }
Beispiel #11
0
 public List<cidade> GetCities()
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.cidades.OrderBy(c => c.nome).ToList<cidade>();
     }
 }
Beispiel #12
0
 public cidade GetCityById(int cityID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.cidades.FirstOrDefault(c => c.id_cidade.Equals(cityID));
     }
 }
Beispiel #13
0
 public regiao GetRegionById(int regionID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.regioes.FirstOrDefault(r => r.id_regiao.Equals(regionID));
     }
 }
Beispiel #14
0
 public List<classificacao> GetClassifications()
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.classificacoes.OrderBy(c => c.nome).ToList<classificacao>();
     }
 }
Beispiel #15
0
 public classificacao GetClassificationById(int classificationID)
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.classificacoes.FirstOrDefault(c => c.id_classificacao.Equals(classificationID));
     }
 }
Beispiel #16
0
 public List<nivel_acesso> GetAccessLevels()
 {
     using (DAOModelEntities ctx = new DAOModelEntities())
     {
         return ctx.niveis_acesso.OrderBy(na => na.nome).ToList<nivel_acesso>();
     }
 }
Beispiel #17
0
        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));
            }
        }