1
00:00:00,510 --> 00:00:01,650
Hello, my friends.

2
00:00:02,640 --> 00:00:12,210
So we have now arrived at a time where we are going to activate the employee or how to add employees

3
00:00:12,450 --> 00:00:13,530
into our program.

4
00:00:13,530 --> 00:00:13,890
Right.

5
00:00:15,660 --> 00:00:19,350
So we're going to begin working on our new employee functionality.

6
00:00:20,790 --> 00:00:26,580
So when we want to add a new employee, we have to enter an ID first name, last name, a department

7
00:00:26,580 --> 00:00:27,480
and a position.

8
00:00:28,710 --> 00:00:33,150
And as you can see, these are the same features that we have in our header list from our table.

9
00:00:34,560 --> 00:00:40,080
So for that, we're just going to create a new class which incorporates all those fields.

10
00:00:41,640 --> 00:00:51,090
So we're going to go to Maine and new python class and the class name, which would kind of be employee

11
00:00:51,090 --> 00:00:51,870
add info.

12
00:00:55,190 --> 00:00:57,980
And click next and finish.

13
00:01:06,570 --> 00:01:10,950
Now here I'm going to copy the name because I have to insert it and make it visible.

14
00:01:16,040 --> 00:01:19,310
Cool, so of course, you already knew that, but.

15
00:01:23,950 --> 00:01:30,790
So all this class is going to have is first I.D. name, last name, department and position.

16
00:01:39,630 --> 00:01:42,330
So self-taught ideas is equal to idie.

17
00:01:44,960 --> 00:01:50,400
Self doubt name is equal to name, self-taught, last name is equal to last name.

18
00:01:55,160 --> 00:02:01,490
Self-taught department is equal to department, self-taught position is equal to position.

19
00:02:02,880 --> 00:02:04,380
So we'll go to our new employee.

20
00:02:07,370 --> 00:02:09,860
Let's set employee to none.

21
00:02:09,980 --> 00:02:13,790
So set that employee info equals nut.

22
00:02:18,490 --> 00:02:21,700
And let's call in the buttons.

23
00:02:22,150 --> 00:02:28,480
So we've got a save button, self-taught UI dot save button that clicked that connect.

24
00:02:29,560 --> 00:02:32,650
If we're going to create the function, save button clicked.

25
00:02:38,230 --> 00:02:42,840
So death save button clicked self pass.

26
00:02:44,590 --> 00:02:49,570
Now, are buttons ready, so we'll implement it on say button clicked.

27
00:02:49,750 --> 00:02:52,750
We have to set the ad briefly.

28
00:02:54,500 --> 00:03:00,170
Self-doubt, employee info is equal to a new employee and info.

29
00:03:01,890 --> 00:03:05,160
And let's type the arguments so it could be.

30
00:03:56,400 --> 00:04:00,220
And let's see, we add every bit of it.

31
00:04:00,240 --> 00:04:01,560
Yeah, I guess so, so.

32
00:04:03,090 --> 00:04:09,210
Afterwards, we'll just self not accept, except and this dialogue will be saved.

33
00:04:17,760 --> 00:04:23,130
From employee and info import employee at info.

34
00:04:31,610 --> 00:04:39,110
So we'll go to our database and create a query which will insert into our database.

35
00:04:39,890 --> 00:04:42,440
So we'll continue with inserting a new employee.

36
00:04:43,160 --> 00:04:51,760
So let's define the function def, add new employee self and the employee and invoke.

37
00:04:55,680 --> 00:04:59,160
Query, which is equal to CU SQL query.

38
00:05:02,270 --> 00:05:08,060
And we need to use a prepared statement here, because we're going to use some variables in place of

39
00:05:08,060 --> 00:05:08,720
values.

40
00:05:09,960 --> 00:05:11,460
Query dot, prepare.

41
00:05:12,660 --> 00:05:17,850
And the resource statement will look like this insert into employee.

42
00:05:20,270 --> 00:05:21,950
So now we can specify the fields.

43
00:05:42,080 --> 00:05:47,450
From employee and info import employee at info.

44
00:05:48,550 --> 00:05:53,830
And let's bind the values query that bind value ID comma.

45
00:06:01,160 --> 00:06:03,590
Query, not bind, value, name, comma.

46
00:06:09,280 --> 00:06:11,770
Employee ad info got name.

47
00:06:27,540 --> 00:06:33,480
Queried that bind value last name, comma, employee add info, dot last name.

48
00:06:38,430 --> 00:06:43,250
Query, not bind value, department employee add info dot I.D..

49
00:06:52,060 --> 00:07:00,340
Comma, employee ad info, dot department query dot bind value position, comma, employee add info,

50
00:07:00,460 --> 00:07:01,600
dot position.

51
00:07:04,220 --> 00:07:05,810
So now let's control the fields.

52
00:07:07,270 --> 00:07:07,540
All right.

53
00:07:08,230 --> 00:07:09,170
Everything seems OK.

54
00:07:11,150 --> 00:07:12,500
Let's try executing a query.

55
00:07:13,500 --> 00:07:15,120
Query dot, execute.

56
00:07:16,830 --> 00:07:22,830
Now let's go back to manage employee, and if the result is accepted, let's get employee info.

57
00:07:26,260 --> 00:07:33,970
Sounds go back to manage employee for new button clicked and if the result is equal to accepted.

58
00:07:38,000 --> 00:07:47,610
Self-taught Dyball add new employee and the employee info is retrieved from self-taught employee dialogued

59
00:07:47,660 --> 00:07:49,040
employee info.

60
00:07:57,080 --> 00:07:59,930
Let's see if this works for you, so we're going to run the program.

61
00:08:03,180 --> 00:08:06,390
Let's go to manage employee quick new first name.

62
00:08:07,520 --> 00:08:07,880
All right.

63
00:08:07,910 --> 00:08:13,550
That's the first name, the last name department will choose, position and save.

64
00:08:15,020 --> 00:08:17,060
So now we've got to check the database file.

65
00:08:34,580 --> 00:08:42,020
So the table is filled correctly, which is the EITE first name, last name, department position Load's

66
00:08:42,020 --> 00:08:42,390
correctly.

67
00:08:42,410 --> 00:08:42,680
Cool.

68
00:08:42,830 --> 00:08:47,540
So we've inserted the employee successfully in your our table.

69
00:08:48,110 --> 00:08:57,680
My you know, until we're all one here anyway, we'll need to do this with just pre initializing the

70
00:08:57,680 --> 00:08:58,130
tables.

71
00:08:59,120 --> 00:09:02,720
But we can do that after we create our filters.

72
00:09:04,150 --> 00:09:10,900
So when I say filters, I'm actually referring to these filters because we can search an employee by

73
00:09:10,900 --> 00:09:15,220
an I.D. or first name and department name, just for example.

74
00:09:16,000 --> 00:09:20,620
That's because we can change some of the queries to be able to put some of the conditions.

75
00:09:22,830 --> 00:09:24,000
Very cool, so that's it.

76
00:09:24,840 --> 00:09:30,690
We've now successfully activated how to add an employee in our program, and we've actually added a

77
00:09:30,690 --> 00:09:31,500
new employee.

78
00:09:33,960 --> 00:09:40,200
Then I started to get a little bit excited there, but first we got to do something else.

79
00:09:40,230 --> 00:09:45,840
OK, so in our next lesson, we've got to add leave to our employees.

80
00:09:46,050 --> 00:09:48,510
They've got to be able to take a vacation after all right.

81
00:09:48,720 --> 00:09:50,460
So I want to see in the next lesson.

82
00:09:51,420 --> 00:09:52,590
Until then, have a nice day.
