Commit 70e0d9c4 by Patryk Czarnik

Klient wysyłający dane na serwer

parent e5d5c32b
package ogloszenia.klient;
import ogloszenia.generated.*;
import java.math.BigDecimal;
import java.util.Scanner;
public class Klient3_Edycja {
public static void main(String[] args) {
OgloszeniaService service = new OgloszeniaService();
Ogloszenia proxy = service.getOgloszeniaPort();
System.out.println("Ujemne id kończy program");
Scanner sc = new Scanner(System.in);
while(true) {
System.out.print("Podaj id szukanego ogłoszenia: ");
int id = sc.nextInt();
if(id <= 0) break;
try {
OgloszenieSamochodowe ogl = proxy.readOne(id);
System.out.printf("%s %s za %s\n", ogl.getMarka(), ogl.getModel(), ogl.getCena());
System.out.println(ogl.getTytul());
System.out.println(ogl.getOpis());
System.out.print("Podaj zmianę ceny: ");
BigDecimal zmiana = sc.nextBigDecimal();
if(zmiana.compareTo(BigDecimal.ZERO) != 0) {
ogl.setCena(ogl.getCena().add(zmiana));
proxy.update(ogl);
System.out.println("Zapisano zmiany");
}
} catch (NieznanyRekord_Exception e) {
System.out.println(e.getMessage());
} catch (BladBazyDanych_Exception e) {
System.out.println("Inny błąd serwera: " + e);
} catch (Exception e) {
System.out.println("Inny błąd: " + e);
}
}
}
}
// alt+Enter intellij =~= Ctrl+1 w eclipse
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment