Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
mvahes
/
Lennubroneerimis_tarkvara
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2d8be98e
authored
Mar 19, 2023
by
krmaet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
4cb8780c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
319 additions
and
0 deletions
changedata.c
changedata.c
0 → 100644
View file @
2d8be98e
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <mysql/mysql.h>
#include <ncurses.h>
#include "changedata.h"
#include "main.h"
int
optionMenu
(
char
*
options
[],
int
count
,
char
buffer
[
STR_MAX
],
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
noecho
();
int
i
;
int
choice
;
int
highlight
=
0
;
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
mvwprintw
(
menu_win
,
2
,
1
,
"%s"
,
buffer
);
mvwprintw
(
menu_win
,
2
,
1
,
"Choose what to change:"
);
while
(
1
)
{
//Print out the list with the current selection highlighted
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
i
==
highlight
)
{
wattron
(
menu_win
,
A_REVERSE
);
mvwprintw
(
menu_win
,
i
+
3
,
1
,
"%s"
,
options
[
i
]);
wattroff
(
menu_win
,
A_REVERSE
);
}
else
{
mvwprintw
(
menu_win
,
i
+
3
,
1
,
"%s"
,
options
[
i
]);
}
}
//Read if arrow up or down was pressed
choice
=
wgetch
(
menu_win
);
switch
(
choice
){
case
UP_KEY
:
highlight
--
;
if
(
highlight
==
-
1
)
{
highlight
=
0
;
}
break
;
case
DOWN_KEY
:
highlight
++
;
if
(
highlight
==
count
)
{
highlight
=
count
-
1
;
}
break
;
default:
break
;
}
//If a choice was selected, break loop
if
(
choice
==
ENTER_KEY
)
{
break
;
}
}
delwin
(
menu_win
);
wrefresh
(
menu_win
);
return
highlight
;
}
void
CheckIn
(
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
noecho
();
int
i
,
choice
;
int
highlight
=
0
;
char
bookingNum
[
BOOKING_NUM
];
char
*
options
[
2
]
=
{
"Yes"
,
"No"
};
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
mvwprintw
(
menu_win
,
1
,
1
,
"Enter booking number"
);
mvwprintw
(
menu_win
,
2
,
1
,
"--------------------"
);
echo
();
mvwscanw
(
menu_win
,
3
,
1
,
"%s"
,
bookingNum
);
noecho
();
//Check if booking exists!!!
// SIIA LÄHEB SQL KÜSIMINE NUMNBRI JA CHECK IN KOHTA
mvwprintw
(
menu_win
,
5
,
1
,
"Person checked in?"
);
while
(
1
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
if
(
i
==
highlight
)
{
wattron
(
menu_win
,
A_REVERSE
);
mvwprintw
(
menu_win
,
i
+
6
,
1
,
"%s"
,
options
[
i
]);
wattroff
(
menu_win
,
A_REVERSE
);
}
else
{
mvwprintw
(
menu_win
,
i
+
6
,
1
,
"%s"
,
options
[
i
]);
}
}
choice
=
wgetch
(
menu_win
);
switch
(
choice
){
case
UP_KEY
:
highlight
--
;
if
(
highlight
==
-
1
)
{
highlight
=
0
;
}
break
;
case
DOWN_KEY
:
highlight
++
;
if
(
highlight
==
2
)
{
highlight
=
2
-
1
;
}
break
;
default:
break
;
}
if
(
choice
==
ENTER_KEY
)
{
break
;
}
}
//~ mvwprintw(menu_win, 2 + 4, 1, "Your choice was: %s", options[highlight]);
// SIIA LÄHEB SQL MUUTMINE
wrefresh
(
menu_win
);
}
void
CheckBooking
(
char
*
bookingNumber
,
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
char
temp
[
STR_MAX
];
int
bookingCheck
=
1
;
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
mvwprintw
(
menu_win
,
1
,
1
,
"Enter booking number"
);
mvwprintw
(
menu_win
,
2
,
1
,
"--------------------"
);
echo
();
mvwscanw
(
menu_win
,
3
,
1
,
"%s"
,
temp
);
noecho
();
// SIIA LÄHEB SQL BOOKING KÜSIMINE
if
(
bookingCheck
==
1
)
{
strcpy
(
bookingNumber
,
temp
);
}
else
{
mvwprintw
(
menu_win
,
5
,
1
,
"Booking number does not exist!"
);
mvwprintw
(
menu_win
,
6
,
1
,
"Press any key to continue!"
);
wgetch
(
menu_win
);
}
wrefresh
(
menu_win
);
delwin
(
menu_win
);
}
void
ChangeName
(
char
*
booking
,
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
char
newName
[
STR_MAX
];
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
//Display booking number
mvwprintw
(
menu_win
,
1
,
1
,
"Booking number"
);
mvwprintw
(
menu_win
,
2
,
1
,
"--------------"
);
mvwprintw
(
menu_win
,
3
,
1
,
"%s"
,
booking
);
// SIIA LÄHEB SQL NIME KÜSIMINE
//Display current name associated with the booking number
mvwprintw
(
menu_win
,
5
,
1
,
"Name"
);
mvwprintw
(
menu_win
,
6
,
1
,
"----"
);
mvwprintw
(
menu_win
,
7
,
1
,
"%s"
,
"Mari Mets"
);
//Change the name associated with the booking number
mvwprintw
(
menu_win
,
9
,
1
,
"Change name"
);
mvwprintw
(
menu_win
,
10
,
1
,
"----"
);
echo
();
mvwscanw
(
menu_win
,
11
,
1
,
"%s"
,
newName
);
noecho
();
// SIIA LÄHEB SQL NIME MUUTMINE
wrefresh
(
menu_win
);
delwin
(
menu_win
);
}
void
ChangeDocument
(
char
*
booking
,
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
char
newNumber
[
STR_MAX
];
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
//Display booking number
mvwprintw
(
menu_win
,
1
,
1
,
"Booking number"
);
mvwprintw
(
menu_win
,
2
,
1
,
"--------------"
);
mvwprintw
(
menu_win
,
3
,
1
,
"%s"
,
booking
);
// SIIA LÄHEB SQL DOKUMENDI KÜSIMINE
//Display current name associated with the booking number
mvwprintw
(
menu_win
,
5
,
1
,
"Document number"
);
mvwprintw
(
menu_win
,
6
,
1
,
"---------------"
);
mvwprintw
(
menu_win
,
7
,
1
,
"%s"
,
"A51567"
);
//Change the name associated with the booking number
mvwprintw
(
menu_win
,
9
,
1
,
"Change nunber"
);
mvwprintw
(
menu_win
,
10
,
1
,
"----"
);
echo
();
mvwscanw
(
menu_win
,
11
,
1
,
"%s"
,
newNumber
);
noecho
();
// SIIA LÄHEB SQL DOKUMENDI MUUTMINE
wrefresh
(
menu_win
);
delwin
(
menu_win
);
}
void
ChangeBaggage
(
char
*
booking
,
int
*
row
,
int
*
col
)
{
WINDOW
*
menu_win
;
clear
();
refresh
();
int
i
,
choice
;
char
*
options
[
3
]
=
{
"Non priority Carry-On"
,
"Prioriy Carry-On"
,
"Check-In"
};
int
highlight
=
0
;
menu_win
=
create_newwin
(
28
,
100
,
1
,
*
col
/
2
-
100
/
2
);
//Display booking number
mvwprintw
(
menu_win
,
1
,
1
,
"Booking number"
);
mvwprintw
(
menu_win
,
2
,
1
,
"--------------"
);
mvwprintw
(
menu_win
,
3
,
1
,
"%s"
,
booking
);
// SIIA LÄHEB SQL PAGASI KÜSIMINE
//Display current name associated with the booking number
mvwprintw
(
menu_win
,
5
,
1
,
"Current baggage"
);
mvwprintw
(
menu_win
,
6
,
1
,
"---------------"
);
mvwprintw
(
menu_win
,
7
,
1
,
"%s"
,
"Carry-On"
);
//Change the name associated with the booking number
mvwprintw
(
menu_win
,
9
,
1
,
"Change baggage"
);
mvwprintw
(
menu_win
,
10
,
1
,
"----"
);
while
(
1
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
highlight
)
{
wattron
(
menu_win
,
A_REVERSE
);
mvwprintw
(
menu_win
,
i
+
11
,
1
,
"%s"
,
options
[
i
]);
wattroff
(
menu_win
,
A_REVERSE
);
}
else
{
mvwprintw
(
menu_win
,
i
+
11
,
1
,
"%s"
,
options
[
i
]);
}
}
choice
=
wgetch
(
menu_win
);
switch
(
choice
){
case
UP_KEY
:
highlight
--
;
if
(
highlight
==
-
1
)
{
highlight
=
0
;
}
break
;
case
DOWN_KEY
:
highlight
++
;
if
(
highlight
==
3
)
{
highlight
=
3
-
1
;
}
break
;
default:
break
;
}
if
(
choice
==
ENTER_KEY
)
{
break
;
}
}
// SIIA LÄHEB SQL PAGASI MUUTMINE
wrefresh
(
menu_win
);
delwin
(
menu_win
);
}
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