@Override
	public void actionPerformed(ActionEvent e) {
		
		if(e.getSource() == comboBox  ){
			
			if(comboBox.getSelectedIndex()!=0){
				int room_type_id = 0;
				room_type_id = roomTypeMap.get(comboBox.getSelectedItem());
				RoomRateDataSource rrDS = new RoomRateDataSource();
				RoomRate rr = new RoomRate();
				rr = rrDS.getRoomTypeRateByRoomTypeId(room_type_id);
				rrDS.close();
				tfOldPricePeakWKD.setText(String.valueOf(rr.getPeak_weekday()));
				tfOldPricePeakWKN.setText(String.valueOf(rr.getPeak_weekend()));;
				tfOldPriceNormalWKD.setText(String.valueOf(rr.getOff_season_weekday()));
				tfOldPriceNormalWKN.setText(String.valueOf(rr.getOff_season_weekend()));
			}else
				;
		}
		
		if(e.getSource()== btnSubmit){
			int room_type_id = 0;
			room_type_id = roomTypeMap.get(comboBox.getSelectedItem());
			RoomRate rr = new RoomRate();
			RoomRateDataSource rrDS = new RoomRateDataSource();
			
			rr.setId(rrDS.getRoomRateIdByRoomTypeId(room_type_id)); //
			rr.setFk_room_type_id(room_type_id);
			if( tfNewPricePeakWKD.getText().isEmpty())
				rr.setPeak_weekday(Double.parseDouble(tfOldPricePeakWKD.getText()));
			else
				rr.setPeak_weekday(Double.parseDouble(tfNewPricePeakWKD.getText()));
			
			if( tfNewPricePeakWKN.getText().isEmpty())
				rr.setPeak_weekend(Double.parseDouble(tfOldPricePeakWKN.getText()));
			else
				rr.setPeak_weekend(Double.parseDouble(tfNewPricePeakWKN.getText()));
			
			if( tfNewPriceNormalWKD.getText().isEmpty())
				rr.setOff_season_weekday(Double.parseDouble(tfOldPriceNormalWKD.getText()));
			else
				rr.setOff_season_weekday(Double.parseDouble(tfNewPriceNormalWKD.getText()));
			
			if(  tfNewPriceNormalWKN.getText().isEmpty())
				rr.setOff_season_weekend(Double.parseDouble(tfOldPriceNormalWKN.getText()));
			else
				rr.setOff_season_weekend(Double.parseDouble(tfNewPriceNormalWKN.getText()));
			
			rrDS.updateRoomRate(rr);
			
			if(rrDS.updateRoomRate(rr))
				JOptionPane.showMessageDialog(this, "Successful", "Success", JOptionPane.INFORMATION_MESSAGE);
			else
				JOptionPane.showMessageDialog(this, "Failed", "Failed", JOptionPane.INFORMATION_MESSAGE);
			
			tfNewPricePeakWKD.setText("");
			tfNewPricePeakWKN.setText("");;
			tfNewPriceNormalWKD.setText("");
			tfNewPriceNormalWKN.setText("");
			
			rr = rrDS.getRoomTypeRateByRoomTypeId(room_type_id);
			rrDS.close();
			tfOldPricePeakWKD.setText(String.valueOf(rr.getPeak_weekday()));
			tfOldPricePeakWKN.setText(String.valueOf(rr.getPeak_weekend()));;
			tfOldPriceNormalWKD.setText(String.valueOf(rr.getOff_season_weekday()));
			tfOldPriceNormalWKN.setText(String.valueOf(rr.getOff_season_weekend()));
		}
		
	}