Esempio n. 1
0
        public Restaurant ReturnNombre(string email_rest, string pass_rest)
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT NOMBRE_REST FROM RESTAURANT WHERE EMAIL_REST='" + email_rest + "' AND PASS_REST= '" + pass_rest + "'";

            bd.CreateCommand(sql);
            Restaurant   llocal = new Restaurant();
            Restaurant   a      = null;
            DbDataReader result = bd.Query();

            result.Read();
            a = new Restaurant(result.GetString(0));
            result.Close();
            bd.Close();
            return(a);
        }
Esempio n. 2
0
        public Administrador GetNameAdmin(string rut_admin, string pass_admin)
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT NOM_ADMIN FROM ADMINISTRADOR WHERE RUT_ADMIN='" + rut_admin + "' AND PASS_ADMIN= '" + pass_admin + "'";

            bd.CreateCommand(sql);
            Administrador llocal = new Administrador();
            Administrador a      = null;
            DbDataReader  result = bd.Query();

            result.Read();
            a = new Administrador(result.GetString(0));
            result.Close();
            bd.Close();
            return(a);
        }
Esempio n. 3
0
        public List <Restaurant> getCodeRest()
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect(); //método conectar

            List <Restaurant> rest = new List <Restaurant>();
            string            sql  = "SELECT COD_REST,NOMBRE_REST FROM RESTAURANT";

            bd.CreateCommand(sql);
            DbDataReader readed = bd.Query();//resultado de la consulta

            while (readed.Read())
            {
                Restaurant r = new Restaurant(readed.GetInt32(0), readed.GetString(1));
                rest.Add(r);
            }
            readed.Close();
            bd.Close();
            return(rest);
        }
Esempio n. 4
0
        public bool LoginRest(string email_rest, string pass_rest)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM RESTAURANT WHERE EMAIL_REST='" + email_rest + "' AND PASS_REST= '" + pass_rest + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }
Esempio n. 5
0
        public bool LoginUsuario(string rut_usuario, string pass_usuario)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM USUARIO WHERE RUT_USUARIO='" + rut_usuario + "' AND PASS_USUARIO= '" + pass_usuario + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }
Esempio n. 6
0
        public bool LoginAdmin(string rut_admin, string pass_admin)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM ADMINISTRADOR WHERE RUT_ADMIN='" + rut_admin + "' AND PASS_ADMIN= '" + pass_admin + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }