示例#1
0
        public void addJoke(
            string userName, string password, string joke)
        {
            jokesImplement jokesObj = new jokesImplement();

            try {
                jokesObj.addJoke(userName, password, joke);
                // catch jokeExceptions
            } catch (jokeException e) {
                throwFault("Fault occurred", e.failReason, userName);
            }
            // then, catch general System Exceptions
            catch (Exception e) {
                throwFault(e.Message, "F_System", userName);
            }
        }
示例#2
0
        public xmlJokesReturn[] getUnmoderated(
            string userName, string password, int howMany)
        {
            jokesImplement jokesObj = new jokesImplement();

            try {
                xmlJokesReturn[] myJokes =
                    jokesObj.getUnmoderated(userName, password, howMany);
                return(myJokes);
                // catch jokeExceptions
            } catch (jokeException e) {
                throwFault("Fault occurred", e.failReason, userName);
                return(null); // code never reached, but needed by compiler
            }
            // then, catch general System Exceptions
            catch (Exception e) {
                throwFault(e.Message, "F_System", userName);
                return(null); // code never reached, but needed by compiler
            }
        }
示例#3
0
        public void addRating(
            string userName, string password, int rating, int jokeID)
        {
            jokesImplement jokesObj = new jokesImplement();

            try {
                if ((rating < 1) && (rating > 5))
                {
                    throwFault("Fault occurred", "F_ratingInvalid", userName);
                }
                else
                {
                    jokesObj.addRating(userName, password, rating, jokeID);
                }
                // catch jokeExceptions
            } catch (jokeException e) {
                throwFault("Fault occurred", e.failReason, userName);
            }
            // then, catch general System Exceptions
            catch (Exception e) {
                throwFault(e.Message, "F_System", userName);
            }
        }