Completati tutti i metodi per il Cliente e l'admin.
-Resta da implementare esclusivvaemnte l'ordinamento per datascadenza e id, e la condizione delle cene nella zona dell'utente.
This commit is contained in:
@@ -64,6 +64,11 @@ public class BeniDiConsumo implements Utilizzabile, Serializable{
|
|||||||
public void setBeniInStock(int beniInStock) {
|
public void setBeniInStock(int beniInStock) {
|
||||||
this.beniInStock = beniInStock;
|
this.beniInStock = beniInStock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBeniVenduti() {
|
||||||
|
beniInStock--;
|
||||||
|
beniVenduti++;
|
||||||
|
}
|
||||||
|
|
||||||
private int idBene;
|
private int idBene;
|
||||||
private String descrizioneBene;
|
private String descrizioneBene;
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class CeneInRistoranti implements Utilizzabile, Serializable{
|
|||||||
@Override
|
@Override
|
||||||
public boolean eAcquistabile() {
|
public boolean eAcquistabile() {
|
||||||
if((dataScadenzaOffertaCena.before(new GregorianCalendar())) && (numCenedaVendere>ceneVendute))
|
if((dataScadenzaOffertaCena.before(new GregorianCalendar())) && (numCenedaVendere>ceneVendute))
|
||||||
return true;
|
return false;
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIdCena() {
|
public int getIdCena() {
|
||||||
@@ -94,6 +94,12 @@ public class CeneInRistoranti implements Utilizzabile, Serializable{
|
|||||||
public void setNumCenedaVendere(int numCenedaVendere) {
|
public void setNumCenedaVendere(int numCenedaVendere) {
|
||||||
this.numCenedaVendere = numCenedaVendere;
|
this.numCenedaVendere = numCenedaVendere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCeneVendute()
|
||||||
|
{
|
||||||
|
numCenedaVendere--;
|
||||||
|
ceneVendute++;
|
||||||
|
}
|
||||||
|
|
||||||
private int idCena;
|
private int idCena;
|
||||||
private String nomeRistorante;
|
private String nomeRistorante;
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class Vacanze implements Utilizzabile, Serializable{
|
|||||||
@Override
|
@Override
|
||||||
public boolean eAcquistabile() {
|
public boolean eAcquistabile() {
|
||||||
if(scadenzaOfferta.before(new GregorianCalendar())) //L'offerta della vacanza scade se la data sua scadenza e successiva a quella della data odierna
|
if(scadenzaOfferta.before(new GregorianCalendar())) //L'offerta della vacanza scade se la data sua scadenza e successiva a quella della data odierna
|
||||||
return true;
|
return false;
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIdViaggio() {
|
public int getIdViaggio() {
|
||||||
@@ -75,6 +75,11 @@ public class Vacanze implements Utilizzabile, Serializable{
|
|||||||
public void setPrezzoPSingola(double prezzoPSingola) {
|
public void setPrezzoPSingola(double prezzoPSingola) {
|
||||||
this.prezzoPSingola = prezzoPSingola;
|
this.prezzoPSingola = prezzoPSingola;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setViaggiVenduti()
|
||||||
|
{
|
||||||
|
viaggiVenduti++;
|
||||||
|
}
|
||||||
|
|
||||||
private int idViaggio;
|
private int idViaggio;
|
||||||
private String localitaViaggio;
|
private String localitaViaggio;
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ import it.unisa.info13d.Articoli.CeneInRistoranti;
|
|||||||
import it.unisa.info13d.Articoli.Global;
|
import it.unisa.info13d.Articoli.Global;
|
||||||
import it.unisa.info13d.Articoli.Utilizzabile;
|
import it.unisa.info13d.Articoli.Utilizzabile;
|
||||||
import it.unisa.info13d.Articoli.Vacanze;
|
import it.unisa.info13d.Articoli.Vacanze;
|
||||||
|
import it.unisa.info13d.Login.Access;
|
||||||
|
import it.unisa.info13d.Login.Entry;
|
||||||
import it.unisa.info13d.Utility.ReShow;
|
import it.unisa.info13d.Utility.ReShow;
|
||||||
|
import it.unisa.info13d.Login.Access;
|
||||||
|
import it.unisa.info13d.Login.LoggedUser;
|
||||||
|
import it.unisa.info13d.Login.LoginData;
|
||||||
|
import it.unisa.info13d.Login.StoricoItem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -59,12 +65,12 @@ public class Catalogo{
|
|||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
*/
|
*/
|
||||||
public void showMenu(String userType,ReShow r) throws FileNotFoundException, ClassNotFoundException, ParseException, IOException
|
public void showMenu(String userType,String username, ReShow r) throws FileNotFoundException, ClassNotFoundException, ParseException, IOException
|
||||||
{
|
{
|
||||||
if(userType.equals("Admin"))
|
if(userType.equals("Admin"))
|
||||||
AdminSession.showAdminMenu(this,r);
|
AdminSession.showAdminMenu(this,r);
|
||||||
else
|
else
|
||||||
ClientSession.showClientMenu(this,r);
|
ClientSession.showClientMenu(this,r, username);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Questo metodo permette l'inserimento di un nuovo deal all'interno del catalogo
|
* Questo metodo permette l'inserimento di un nuovo deal all'interno del catalogo
|
||||||
@@ -98,23 +104,33 @@ public class Catalogo{
|
|||||||
String localita = inputData.nextLine();
|
String localita = inputData.nextLine();
|
||||||
|
|
||||||
System.out.println("Data Partenza (GG/MM/AAAA): ");
|
System.out.println("Data Partenza (GG/MM/AAAA): ");
|
||||||
DateFormat format = new SimpleDateFormat( "dd/MM/yyyy" );
|
String data = inputData.nextLine();
|
||||||
|
String temp[];
|
||||||
|
String marcatore="/";
|
||||||
|
temp = data.split(marcatore);
|
||||||
|
GregorianCalendar dataPartenza = new GregorianCalendar((Integer.parseInt(temp[2])),(Integer.parseInt(temp[1]))-1,(Integer.parseInt(temp[0])));
|
||||||
|
/*DateFormat format = new SimpleDateFormat( "dd/MM/yyyy" );
|
||||||
Date date = format.parse(inputData.nextLine());
|
Date date = format.parse(inputData.nextLine());
|
||||||
GregorianCalendar dataPartenza = new GregorianCalendar();
|
GregorianCalendar dataPartenza = new GregorianCalendar();
|
||||||
dataPartenza.setTime(date);
|
dataPartenza.setTime(date);*/
|
||||||
|
|
||||||
System.out.println("Data Scadenza offerta (GG/MM/AAAA): ");
|
System.out.println("Data Scadenza offerta (GG/MM/AAAA): ");
|
||||||
date = format.parse(inputData.nextLine());
|
String data2 = inputData.nextLine();
|
||||||
|
String temp2[];
|
||||||
|
temp2 = data2.split(marcatore);
|
||||||
|
GregorianCalendar dataScad = new GregorianCalendar((Integer.parseInt(temp2[2])),(Integer.parseInt(temp2[1]))-1,(Integer.parseInt(temp2[0])));
|
||||||
|
|
||||||
|
/*date = format.parse(inputData.nextLine());
|
||||||
GregorianCalendar dataScadVacanza = new GregorianCalendar();
|
GregorianCalendar dataScadVacanza = new GregorianCalendar();
|
||||||
dataScadVacanza.setTime(date);
|
dataScadVacanza.setTime(date);*/
|
||||||
|
|
||||||
System.out.println("Prezzo singola persona: ");
|
System.out.println("Prezzo singola persona: ");
|
||||||
String prezzo = inputData.nextLine();
|
String prezzo = inputData.nextLine();
|
||||||
double prezzoPSing = Double.parseDouble(prezzo);
|
double prezzoPSing = Double.parseDouble(prezzo);
|
||||||
|
|
||||||
int idViaggio=Global.get_next_id();
|
|
||||||
|
|
||||||
catalogoOfferte.add(new Vacanze(idViaggio, localita, dataPartenza, dataScadVacanza, prezzoPSing));
|
|
||||||
|
catalogoOfferte.add(new Vacanze(Global.get_next_id(), localita, dataPartenza, dataScad, prezzoPSing));
|
||||||
store_data();
|
store_data();
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
@@ -132,18 +148,22 @@ public class Catalogo{
|
|||||||
double prezzoPSingCena = Double.parseDouble(prezzoCena);
|
double prezzoPSingCena = Double.parseDouble(prezzoCena);
|
||||||
|
|
||||||
System.out.println("Data Scadenza offerta (GG/MM/AAAA): ");
|
System.out.println("Data Scadenza offerta (GG/MM/AAAA): ");
|
||||||
DateFormat format2 = new SimpleDateFormat( "dd/MM/yyyy" );
|
String data3 = inputData.nextLine();
|
||||||
|
String temp3[];
|
||||||
|
String marcatore2="/";
|
||||||
|
temp3 = data3.split(marcatore2);
|
||||||
|
GregorianCalendar dataScadCena = new GregorianCalendar((Integer.parseInt(temp3[2])),(Integer.parseInt(temp3[1])),(Integer.parseInt(temp3[0])));
|
||||||
|
/*DateFormat format2 = new SimpleDateFormat( "dd/MM/yyyy" );
|
||||||
date = format2.parse(inputData.nextLine());
|
date = format2.parse(inputData.nextLine());
|
||||||
GregorianCalendar dataScadCena = new GregorianCalendar();
|
GregorianCalendar dataScadCena = new GregorianCalendar();
|
||||||
dataScadCena.setTime(date);
|
dataScadCena.setTime(date);*/
|
||||||
|
|
||||||
System.out.println("Cene da Vendere: ");
|
System.out.println("Cene da Vendere: ");
|
||||||
String nCene = inputData.nextLine();
|
String nCene = inputData.nextLine();
|
||||||
int ceneDaVendere = Integer.parseInt(nCene);
|
int ceneDaVendere = Integer.parseInt(nCene);
|
||||||
|
|
||||||
int idCena=Global.get_next_id();
|
|
||||||
|
catalogoOfferte.add(new CeneInRistoranti(Global.get_next_id(), ristorante, localitaCena, descrizioneCena, prezzoPSingCena, dataScadCena, ceneDaVendere));
|
||||||
catalogoOfferte.add(new CeneInRistoranti(idCena, ristorante, localitaCena, descrizioneCena, prezzoPSingCena, dataScadCena, ceneDaVendere));
|
|
||||||
store_data();
|
store_data();
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
@@ -157,10 +177,8 @@ public class Catalogo{
|
|||||||
System.out.println("Quantita in magazzino: ");
|
System.out.println("Quantita in magazzino: ");
|
||||||
String qntMag = inputData.nextLine();
|
String qntMag = inputData.nextLine();
|
||||||
int qnt_mag = Integer.parseInt(prezzoBene);
|
int qnt_mag = Integer.parseInt(prezzoBene);
|
||||||
|
|
||||||
int idBene=Global.get_next_id();
|
catalogoOfferte.add(new BeniDiConsumo(Global.get_next_id(), descrizioneBene, prezzo_bene, qnt_mag));
|
||||||
|
|
||||||
catalogoOfferte.add(new BeniDiConsumo(idBene, descrizioneBene, prezzo_bene, qnt_mag));
|
|
||||||
store_data();
|
store_data();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -187,30 +205,39 @@ public class Catalogo{
|
|||||||
CeneInRistoranti dealCena = (CeneInRistoranti)deal;
|
CeneInRistoranti dealCena = (CeneInRistoranti)deal;
|
||||||
visualizzaCena(dealCena);
|
visualizzaCena(dealCena);
|
||||||
}
|
}
|
||||||
|
|
||||||
store_data();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.print("Elimina prodotto [Inserisci id]: ");
|
System.out.print("Elimina prodotto [Inserisci id]: ");
|
||||||
Scanner inputData = new Scanner(System.in);
|
Scanner inputData = new Scanner(System.in);
|
||||||
String id = inputData.nextLine();
|
String id = inputData.nextLine();
|
||||||
int idDel = Integer.parseInt(id);
|
int idDel = Integer.parseInt(id);
|
||||||
|
System.out.println(idDel);
|
||||||
for(Utilizzabile deal: catalogoOfferte)
|
for(Utilizzabile deal: catalogoOfferte)
|
||||||
{
|
{
|
||||||
if(deal instanceof Vacanze && ((Vacanze)deal).getIdViaggio()==idDel)
|
if(deal instanceof Vacanze && ((Vacanze)deal).getIdViaggio()==idDel)
|
||||||
{
|
{
|
||||||
catalogoOfferte.remove(deal);
|
catalogoOfferte.remove(deal);
|
||||||
|
store_data();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(deal instanceof BeniDiConsumo && ((BeniDiConsumo) deal).getIdBene()==idDel)
|
if(deal instanceof BeniDiConsumo && ((BeniDiConsumo) deal).getIdBene()==idDel)
|
||||||
{
|
{
|
||||||
catalogoOfferte.remove(deal);
|
catalogoOfferte.remove(deal);
|
||||||
|
store_data();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(deal instanceof CeneInRistoranti && ((CeneInRistoranti) deal).getIdCena()==idDel)
|
if(deal instanceof CeneInRistoranti && ((CeneInRistoranti) deal).getIdCena()==idDel)
|
||||||
{
|
{
|
||||||
catalogoOfferte.remove(deal);
|
catalogoOfferte.remove(deal);
|
||||||
|
store_data();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Questo metodo visualizza le offerte attive del catalogo
|
||||||
|
*/
|
||||||
public void offerteAttive()
|
public void offerteAttive()
|
||||||
{
|
{
|
||||||
for(Utilizzabile deal: catalogoOfferte)
|
for(Utilizzabile deal: catalogoOfferte)
|
||||||
@@ -245,6 +272,9 @@ public class Catalogo{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Questo metodo visualizza le offerte scadute del catalogo
|
||||||
|
*/
|
||||||
public void offerteScadute()
|
public void offerteScadute()
|
||||||
{
|
{
|
||||||
System.out.println("------ Offerte Scadute -----");
|
System.out.println("------ Offerte Scadute -----");
|
||||||
@@ -268,9 +298,132 @@ public class Catalogo{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Questa metodo aggiunge credito al conto dell'utente
|
||||||
|
* @param user
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void aggiungiCredito(String user) throws FileNotFoundException, ClassNotFoundException, IOException
|
||||||
|
{
|
||||||
|
Entry loggedUser = Access.get_user_data(user);
|
||||||
|
System.out.println("----- Acquisto Credito -----");
|
||||||
|
System.out.println("Saldo Attuale:"+ loggedUser.getBalance());
|
||||||
|
System.out.println("Aggiungi importo da ricaricare:");
|
||||||
|
Scanner inputData = new Scanner(System.in);
|
||||||
|
String euro = inputData.nextLine();
|
||||||
|
loggedUser.setBalance(Double.parseDouble(euro));
|
||||||
|
Access.replace_data(user, loggedUser);
|
||||||
|
System.out.println("Saldo attuale: "+loggedUser.getBalance());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Questo metodo permette all'utente di effettuare un acquisto
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void acquistaProdotto(String user) throws FileNotFoundException, ClassNotFoundException, IOException
|
||||||
|
{
|
||||||
|
Entry loggedUser = Access.get_user_data(user);
|
||||||
|
System.out.println("----- Shop ----");
|
||||||
|
System.out.println("### Prodotti ###");
|
||||||
|
|
||||||
|
offerteAttive();
|
||||||
|
|
||||||
|
System.out.println("Offerta da acquistare[inserisci id]: ");
|
||||||
|
Scanner inputData = new Scanner(System.in);
|
||||||
|
String idProd = inputData.nextLine();
|
||||||
|
int idDel = Integer.parseInt(idProd);
|
||||||
|
|
||||||
|
Entry userLogged = Access.get_user_data(user);
|
||||||
|
boolean trovato=false;
|
||||||
|
ArrayList<StoricoItem> storico = userLogged.getStorico();
|
||||||
|
|
||||||
|
for(Utilizzabile dealsc: catalogoOfferte)
|
||||||
|
{
|
||||||
|
if((dealsc instanceof Vacanze) && ((Vacanze)dealsc).getIdViaggio()==idDel)
|
||||||
|
{
|
||||||
|
Vacanze dealVacanza = (Vacanze)dealsc;
|
||||||
|
if(dealVacanza.eAcquistabile())
|
||||||
|
{
|
||||||
|
trovato=true;
|
||||||
|
storico.add(new StoricoItem("Viaggio: "+dealVacanza.getLocalitaViaggio(), new GregorianCalendar() ,dealVacanza.getPrezzoPSingola()));
|
||||||
|
dealVacanza.setViaggiVenduti();
|
||||||
|
loggedUser.setBalance((dealVacanza.getPrezzoPSingola()*(-1)));
|
||||||
|
store_data();
|
||||||
|
Access.replace_data(user, loggedUser);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Il prodotto non e' acquistabile");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if((dealsc instanceof BeniDiConsumo) && ((BeniDiConsumo) dealsc).getIdBene()==idDel)
|
||||||
|
{
|
||||||
|
BeniDiConsumo dealBene = (BeniDiConsumo)dealsc;
|
||||||
|
if(dealBene.eAcquistabile())
|
||||||
|
{
|
||||||
|
trovato=true;
|
||||||
|
storico.add(new StoricoItem("Prodotto: "+dealBene.getDescrizioneBene(), new GregorianCalendar() ,dealBene.getPrezzoBene()));
|
||||||
|
dealBene.setBeniVenduti();
|
||||||
|
loggedUser.setBalance((dealBene.getPrezzoBene()*(-1)));
|
||||||
|
Access.replace_data(user, loggedUser);
|
||||||
|
store_data();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Il prodotto non e' acquistabile");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if( (dealsc instanceof CeneInRistoranti) && ((CeneInRistoranti) dealsc).getIdCena()==idDel)
|
||||||
|
{
|
||||||
|
CeneInRistoranti dealCena = (CeneInRistoranti)dealsc;
|
||||||
|
if(dealCena.eAcquistabile())
|
||||||
|
{
|
||||||
|
trovato=true;
|
||||||
|
storico.add(new StoricoItem("Cena ristorante "+dealCena.getNomeRistorante()+" "+dealCena.getDescrizione_cena(), new GregorianCalendar() ,dealCena.getCostoPerPersona()));
|
||||||
|
dealCena.setCeneVendute();
|
||||||
|
loggedUser.setBalance((dealCena.getCostoPerPersona()*(-1)));
|
||||||
|
Access.replace_data(user, loggedUser);
|
||||||
|
store_data();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Il prodotto non e' acquistabile");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!trovato) System.out.println("### Prodotto non presente nel catalogo");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Questo metodo visualizza lo storico degli ordini effettuati dall'utente
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void visualizzaStorico(String user) throws FileNotFoundException, ClassNotFoundException, IOException
|
||||||
|
{
|
||||||
|
Entry userLogged = Access.get_user_data(user);
|
||||||
|
System.out.println("########### STORICO ###########");
|
||||||
|
ArrayList<StoricoItem> storico = userLogged.getStorico();
|
||||||
|
for(StoricoItem record: storico)
|
||||||
|
{
|
||||||
|
System.out.println("| deal: "+record.getDescription()+"| data:"+new SimpleDateFormat("dd/MM/yyyy").format(record.getData_acquisto()+"| Prezzo: "+record.getPrezzo()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void aggiungiCredito()
|
|
||||||
{}
|
|
||||||
|
|
||||||
public void visualizzaVacanza(Vacanze dealVacanza)
|
public void visualizzaVacanza(Vacanze dealVacanza)
|
||||||
{
|
{
|
||||||
@@ -283,12 +436,12 @@ public class Catalogo{
|
|||||||
int meseS = scadenza.get(Calendar.MONTH);
|
int meseS = scadenza.get(Calendar.MONTH);
|
||||||
int annoS = scadenza.get(Calendar.YEAR);
|
int annoS = scadenza.get(Calendar.YEAR);
|
||||||
|
|
||||||
System.out.println("#Vacanza-"+dealVacanza.getIdViaggio()+"# Scadenza: "+giornoS+"/"+meseS+"/"+annoS+"| Localita: "+dealVacanza.getLocalitaViaggio()+"| Partenza: "+giornoP+"/"+meseP+"/"+annoP+"| Prezzo Pers. Singola: "+dealVacanza.getPrezzoPSingola());
|
System.out.println("#Vacanza-"+dealVacanza.getIdViaggio()+"# Scadenza: "+giornoS+"/"+(meseS+1)+"/"+annoS+"| Localita: "+dealVacanza.getLocalitaViaggio()+"| Partenza: "+giornoP+"/"+(meseP+1)+"/"+annoP+"| Prezzo Pers. Singola: "+dealVacanza.getPrezzoPSingola()+"\n--");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visualizzaBene(BeniDiConsumo dealBene)
|
public void visualizzaBene(BeniDiConsumo dealBene)
|
||||||
{
|
{
|
||||||
System.out.println("#Articolo-"+dealBene.getIdBene()+"# Descrizione: "+dealBene.getDescrizioneBene()+" Prezzo: "+dealBene.getPrezzoBene()+"| Quantita in magazzino: "+dealBene.getBeniInStock());
|
System.out.println("#Articolo-"+dealBene.getIdBene()+"# Descrizione: "+dealBene.getDescrizioneBene()+" Prezzo: "+dealBene.getPrezzoBene()+"| Quantita in magazzino: "+dealBene.getBeniInStock()+"\n--");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visualizzaCena(CeneInRistoranti dealCena)
|
public void visualizzaCena(CeneInRistoranti dealCena)
|
||||||
@@ -297,11 +450,18 @@ public class Catalogo{
|
|||||||
int giornoSC = scadenzaCena.get(Calendar.DAY_OF_MONTH);
|
int giornoSC = scadenzaCena.get(Calendar.DAY_OF_MONTH);
|
||||||
int meseSC = scadenzaCena.get(Calendar.MONTH);
|
int meseSC = scadenzaCena.get(Calendar.MONTH);
|
||||||
int annoSC = scadenzaCena.get(Calendar.YEAR);
|
int annoSC = scadenzaCena.get(Calendar.YEAR);
|
||||||
System.out.println("#Cena-"+dealCena.getIdCena()+"# Scadenza:"+giornoSC+"/"+meseSC+"/"+annoSC+"| Ristorante: "+dealCena.getNomeRistorante()+"| Indirizzo: "+dealCena.getLuogo()+"| Descrizione: "+dealCena.getDescrizione_cena()+"| Costo: "+dealCena.getCostoPerPersona());
|
System.out.println("#Cena-"+dealCena.getIdCena()+"# Scadenza:"+giornoSC+"/"+(meseSC+1)+"/"+annoSC+"| Ristorante: "+dealCena.getNomeRistorante()+"| Indirizzo: "+dealCena.getLuogo()+"| Descrizione: "+dealCena.getDescrizione_cena()+"| Costo: "+dealCena.getCostoPerPersona()+"\n--");
|
||||||
}
|
}
|
||||||
public ArrayList<Utilizzabile> getCatalogo() {
|
|
||||||
|
public ArrayList<Utilizzabile> getCatalogo() {
|
||||||
return catalogoOfferte;
|
return catalogoOfferte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean testInputData()
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private ArrayList<Utilizzabile> catalogoOfferte;
|
private ArrayList<Utilizzabile> catalogoOfferte;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package it.unisa.info13d.GestioneCatalogo;
|
package it.unisa.info13d.GestioneCatalogo;
|
||||||
|
|
||||||
import it.unisa.info13d.Articoli.Utilizzabile;
|
import it.unisa.info13d.Articoli.Utilizzabile;
|
||||||
|
import it.unisa.info13d.Login.Access;
|
||||||
import it.unisa.info13d.Utility.ReShow;
|
import it.unisa.info13d.Utility.ReShow;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
/**
|
/**
|
||||||
@@ -14,8 +17,11 @@ import java.util.Scanner;
|
|||||||
public class ClientSession {
|
public class ClientSession {
|
||||||
/**
|
/**
|
||||||
* Questo metodo visualizza il menu per i Clienti
|
* Questo metodo visualizza il menu per i Clienti
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
* @throws FileNotFoundException
|
||||||
*/
|
*/
|
||||||
public static void showClientMenu(Catalogo catalogo, ReShow r) {
|
public static void showClientMenu(Catalogo catalogo, ReShow r, String username) throws FileNotFoundException, ClassNotFoundException, IOException {
|
||||||
System.out.println("------------ Menu operazioni ------------");
|
System.out.println("------------ Menu operazioni ------------");
|
||||||
System.out.println("1 --> Acquista Credito"); //Si acquista credito per l'acquisto dei prodotti
|
System.out.println("1 --> Acquista Credito"); //Si acquista credito per l'acquisto dei prodotti
|
||||||
System.out.println("2 --> Visualizza Offerte"); //Visualizza le offerte acquistabili
|
System.out.println("2 --> Visualizza Offerte"); //Visualizza le offerte acquistabili
|
||||||
@@ -37,16 +43,16 @@ public class ClientSession {
|
|||||||
switch(sceltaMenu)
|
switch(sceltaMenu)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
|
catalogo.aggiungiCredito(username);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
|
catalogo.offerteAttive();
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
|
catalogo.acquistaProdotto(username);
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
|
catalogo.visualizzaStorico(username);
|
||||||
break;
|
break;
|
||||||
case "5":
|
case "5":
|
||||||
r.reshow = false;
|
r.reshow = false;
|
||||||
|
|||||||
@@ -251,22 +251,4 @@ public class Access {
|
|||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public class Entry implements Serializable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBalance(double balance) {
|
public void setBalance(double balance) {
|
||||||
this.balance = balance;
|
this.balance += balance;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<StoricoItem> getStorico() {
|
public ArrayList<StoricoItem> getStorico() {
|
||||||
@@ -52,7 +53,7 @@ public class Entry implements Serializable{
|
|||||||
private String user;
|
private String user;
|
||||||
private String password;
|
private String password;
|
||||||
private String location;
|
private String location;
|
||||||
private double balance = 0;
|
private double balance;
|
||||||
private boolean type;
|
private boolean type;
|
||||||
private ArrayList<StoricoItem> storico;
|
private ArrayList<StoricoItem> storico;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Main {
|
|||||||
|
|
||||||
ReShow r = new ReShow();
|
ReShow r = new ReShow();
|
||||||
for (;r.reshow;)
|
for (;r.reshow;)
|
||||||
load_catalogo.showMenu(login.getType(),r);
|
load_catalogo.showMenu(login.getType(),login.getUsername(),r);
|
||||||
IdCounter.save_counter();
|
IdCounter.save_counter();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user