Exemplo n.º 1
0
 public bool InlogControle(string gebruikersNaam, string wachtWoord)
 {
     if ((db.LogIn(gebruikersNaam, wachtWoord)) != null)
     {
         account = db.account;
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
        public Account LogIn(string gebruikersNaam, string wachtWoord)
        {
            try
            {
                OpenVerbinding();
                cmd.Connection = conn;
                cmd.CommandText = "SELECT \"Wachtwoord\", \"Rol\" FROM \"Account\" WHERE \"Inlognaam\" = '" + gebruikersNaam + "'";
                OracleDataReader reader = cmd.ExecuteReader();
                string wachtwoord;
                string rol;

                while (reader.Read())
                {
                    wachtwoord = (string)reader["Wachtwoord"];
                    rol = (string)reader["Rol"];

                    if (wachtWoord == wachtwoord)
                    {
                        if (rol.ToLower() == "beheerder")
                        {
                            return account = new Account(gebruikersNaam, EnumMedewerkerRol.Beheerder);
                        }
                        else if (rol.ToLower() == "wagenparkbeheerder")
                        {
                            return account = new Account(gebruikersNaam, EnumMedewerkerRol.WagenparkBeheerder);
                        }
                        else if (rol.ToLower() == "schoonmaker")
                        {
                            return account = new Account(gebruikersNaam, EnumMedewerkerRol.Schoonmaker);
                        }
                        else if (rol.ToLower() == "technicus")
                        {
                            return account = new Account(gebruikersNaam, EnumMedewerkerRol.Technicus);
                        }
                    }
                }

                return null;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return null;
            }
            finally
            {
                conn.Close();
            }
        }