keypad as switch

I'm trying to figure out how to use my UNO and a 4x3 keypad to run a 8 channel relay. I want each key to turn on a different relay but I also want my * key to be a all on and my # key to be an all off. I'd also like to be able to press the key that is on again to turn just that relay off while leaving the other relays on. I'm new to arduino and coding so its been a difficult task. I have the keypad working but can only get one relay to turn on and that is it. Any help would be greatly appreciated.

/* @file EventSerialKeypad.pde
 || @version 1.0
 || @author Alexander Brevig
 || @contact alexanderbrevig@gmail.com
 ||
 || @description
 || | Demonstrates using the KeypadEvent.
 || #
 */
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
    {'1','2','3'},
    {'4','5','6'},
    {'7','8','9'},
    {'*','0','#'}
};

byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
byte ledPin = 13;
byte ledPin1 = 12;
byte ledPin2 = 11; 
byte ledPin3 = 10;


boolean ledPin_state;

void setup(){
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);              // Sets the digital pin as output.
    digitalWrite(ledPin, HIGH);           // Turns the relay off.
    digitalWrite(ledPin1,HIGH);
    digitalWrite(ledPin2,HIGH);
    digitalWrite(ledPin3,HIGH);   
    keypad.addEventListener(keypadEvent); // Add an event listener for this keypad
}

void loop(){
    char key = keypad.getKey();

    if (key) {
        Serial.println(key);
    }
    
}

// Taking care of some special events.
void keypadEvent(KeypadEvent key){
    switch (keypad.getState()){
    case PRESSED:
        if (key == '1') {
            digitalWrite(ledPin,LOW);
             }
             
     if (key == '2') {
            digitalWrite(ledPin2,LOW);
           }
     
     if (key == '3') {
            digitalWrite(ledPin3,LOW);
           }
     if (key == '4') {
            digitalWrite(ledPin1,LOW);
                   // Remember LED state, lit or unlit.
     if (key == '#') {
            digitalWrite(ledPin,HIGH);   // turns all relays off
            digitalWrite(ledPin2,HIGH);
            digitalWrite(ledPin3,HIGH);
            digitalWrite(ledPin1,HIGH);
     if (key == '*') {digitalWrite(ledPin,LOW);      // Turns all relays on 
                      digitalWrite(ledPin1,LOW); 
                      digitalWrite(ledPin2,LOW); 
                      digitalWrite(ledPin3,LOW); 
     }                 
    }
     }
    }
}

Is this a school project?
Better look at switchcase:
http://arduino.cc/en/Reference/SwitchCase#.UxdnfeDT9SU

Yes this is a school project that I might have underestimated! In a switch case I would still have to setup my keypad?

Try:

  case PRESSED:
    
    if (key == '1') 
    {
      digitalWrite(ledPin,LOW);
    }

    
    if (key == '2') 
    {
      digitalWrite(ledPin2,LOW);
    }

    
    if (key == '3') 
    {
      digitalWrite(ledPin3,LOW);
    }
    
    if (key == '4') 
    {
      digitalWrite(ledPin1,LOW);
      // Remember LED state, lit or unlit.
    }
    
    if (key == '#') 
    {
      digitalWrite(ledPin,HIGH);   // turns all relays off
      digitalWrite(ledPin2,HIGH);
      digitalWrite(ledPin3,HIGH);
      digitalWrite(ledPin1,HIGH);
    }
    
    if (key == '*') 
    {
      digitalWrite(ledPin,LOW);      // Turns all relays on 
      digitalWrite(ledPin1,LOW); 
      digitalWrite(ledPin2,LOW); 
      digitalWrite(ledPin3,LOW);
    } 
    break;

http://forum.arduino.cc/index.php?topic=223162.0

WHY DOUBLE POST?

I double posted because I was still confused on the whole coding of this project. I thought that maybe someone could give me a different point of view and that it would help me to easier understand what is going on. Some of the terminology was throwing me off. I thought I might find a dumbed down version