Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_20230801
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
alx_20230801
Commits
70e0d9c4
Commit
70e0d9c4
authored
Aug 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Klient wysyłający dane na serwer
parent
e5d5c32b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
Klient3_Edycja.java
...lient/src/main/java/ogloszenia/klient/Klient3_Edycja.java
+47
-0
No files found.
OgloszeniaKlient/src/main/java/ogloszenia/klient/Klient3_Edycja.java
0 → 100644
View file @
70e0d9c4
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment