package registration;

import java.rmi.RemoteException;
import javax.ejb.*;
import java.util.*;
import java.text.NumberFormat;

// Container-managed persistence

public class RegistrationBean implements EntityBean {

    protected transient EntityContext ctx;
    public String theuser, password, creditcard, emailaddress;
    public double balance;

    public boolean verifyPassword(String password) 
				throws RemoteException { 
	if (this.password.equals(password)) {
	    return true;
	} else {
            return false;
        }
    }
    public String getEmailAddress() throws RemoteException { 
	return emailaddress;
    }
    public String getUser() throws RemoteException { 
	return theuser;
    }
    public int adjustAccount(double amount) throws RemoteException { 
        balance=balance+amount;
        return(0);
    }

    public double getBalance() throws RemoteException {
	return balance;
    }

    public void ejbCreate(String theuser, String password, 
			String emailaddress, String creditcard) 
			throws CreateException, RemoteException {
	this.theuser=theuser;
	this.password=password;
	this.emailaddress=emailaddress;
	this.creditcard=creditcard;
	this.balance=0;
  }
 

    public void ejbPostCreate(String theuser, String password, 
			String emailaddress, String creditcard) 
			throws CreateException, RemoteException {
    }

    public void setEntityContext(javax.ejb.EntityContext ctx) 
			throws RemoteException {
    this.ctx = ctx;
    }

    public void unsetEntityContext() throws RemoteException {   
    ctx = null;  
    } 

    public void ejbRemove() throws RemoteException, RemoveException { }
    public void ejbActivate() throws RemoteException { }
    public void ejbPassivate() throws RemoteException { }
    public void ejbLoad() throws RemoteException { }
    public void ejbStore() throws RemoteException { }
}

