Library Management System Part 11:Students Class+Display and Add Students

okay either guys this tutorial we are continuing on our library management system so last time we finished modifying student information right now we should work on removing the student okay so let’s go back to a project so here what do we have let’s go to the business components here we will find the student class to put it on that and let’s see we have all these now update problem this function is it was to remove a student record from TV okay so it’s the same style the same code there is nothing interesting in here okay so now I’m coming this well what I should have done is you create an interface for the business components and implement the interface because well what the interface does is it will give you the skeleton of the functions and you just need to fold them later on that’s all anyway so update okay so here we are locking the record okay so this one update this guy just to get the name of the tables so update student student so what’s the column name go here okay so the student student named to denton name actually okay ya know I I think about this maybe this will create a problem anyway I’ll leave it up to the attic as it is student named equal at zero this is going to be me dot all good didn’t name there you go okay we have work values change a problem with that and the mission on our okay if any kind of change happens we will cancel next what we have here is student students aware student named equal at zero there we go what do we have here is what old needle old student named there we go okay so we have this function this SQL statement this will lock the record for modification and this one will delete a record um anyway the problems that we need to lock the record maybe it will be much better later on at the end to to use another statement for locking the record but I I couldn’t rent a SQL for that huge Oilers select for update okay I’ll have to test that okay so let me go here go to the testa project and I will do some modification here this is a test project over here I will double click on this one and let’s go down down down down down there we go okay there we go so tested 121 remove student hopeful so you have I hope from DB okay this just one to one followed by just what you want okay so this is the test

part we will get here the test before we are creating this one we are adding a new student we are modifying the information and we are removing it later on so i will run that hopefully all will be working fine and wait a few seconds and go okay come on now field test piece and what about this come on come on okay so all is working fine I can’t remember why didn’t work that didn’t go back to this one I will comment this for a second here this is important thing I I want you guys to remember there is a statement called just like this select star from students for update okay this is for not from for update where student student ID equal something here it’s old student ID there we go this should have the effect of locking the record okay and and this is the one that you should use don’t you don’t use this one I think the reason i am using this technique is select for update is not supported for for the database SDF that i’m using so i’ll put a break point and i will run the test the project again and see if this works if so i’ll have to modify all the what you call them i’ll have to modify all the business components or move method okay so we have this one + f10 and we get an error and indeed do we have here talking ok doc online offset talking in error for ok so it doesn’t recognize for update and this is the reason why i use that I totally forgot who I anyway so this is it this is the reason why ok anyway if you are using SQL Server not SDF file or if you are using oracle database post-race use select for update ok so now we finish this one let’s go back we finished removing this guy okay so now what do we have we have to work on this blink student data grid view again we have something similar to this that created oh let’s go to show I think I created shirt function this one yep oh there we go this guy copy and let’s go to our student class this function is used to date a great view with little student information go okay so do we have to do select star from students there we go so what do we have to do next we need to change the headers so we have student ID or change student ID okay and what do we have to do all sauced student name this is the original call name should then i’m going to say name that’s it this just a header for the next one wait a second or do you have we have student cash then tier here we go so we have we have contact and email contact

email area so you finished these and this is pretty much all we need here I’m gonna save this so we finished this one we have to use this next one which is displaced students in combobox there we go I can save this let’s go to staff class staff okay um which one which one which one shelf glass shelf on phone there we go copy is used to full combo box with student on fall so here this function with student info ok so again sex star from students students now this one what we have to do is to this is going to be student brilliant name so now what I want to do is go and see if there is another add method combo box items don’t add okay so here we are just adding student names so instead of this full combo box with student names okay so this will fold the combo vocal student names okay as you can see I didn’t do much of a coding here just copied and pasted a function because the skeletons already there I just changed few tables and few select statements and all should be working fine let’s go back here this one’s done now as for searching for the student i will not do this one the reason is as you have seen previously for books I wrote a search function and I didn’t use it because i was using the Tegrity view and datagridview has not vertical at you I used a bindingsource unbending bindingsource allows you to do some search so the search function we created it’s like being useless ok so for this one I will not create one unless we need one ok so I will skip this one ok for testing we created this one and finally what we have here is what we have to do next is creating the graphical user interface or the secured ins okay so what I have to do now I’m going to stop this recording and start again okay okay so now we are going to continue with this we need to create the graphical user interface for the staff to view all the students now let me go into this one just to make sure type information what do we have person student type of information okay we have these we said talked about these it’s got the scenario we have student account management and these we already have the function for this yeah there we go so we have to work on this one there we go yeah that the okay 51% we finally skipped half of the development steps for the project so let’s go to the graphical user interface here this is the main window no not this one sorry like a let’s go to the client a project and set as a startup project here and let’s go to the main window okay so we have staff members we add the data entry okay and we will add another cat for students so here I’m going to say add tabs click in the middle and change the title into students enter ok

no problem with that I hope so inside that we will have to put another data grid I think we need only to put one datagridview right yeah I believe so so this is DG ve this tgb to this is the give you three and this is the G before and paste that take a great view for a problem okay so this is going to be for students what we need to do is click on this and so do we have here open database no problem the login okay the administrator the administrator should not be able to yeah the administrator should not be able to work with the students I suppose yeah this is going to be for others points okay so tap pages 1 and 2 will be removed okay as for this one the library employee will be able to work on the students and the books so as for the administration panel or tab this should be removed a problem next we’ll have to pull the data dgv for would student on phone now f not student class dot full dgv okay I notes1 naming a problem tgv for here tpms then let’s go what we have to say them as cheap msgbox error while displaying student information or by critical or okay only followed by error there we go and I can see and hear as for this what do you have this is okay sorry so this one is for the GV not with shell confirmation there’s a problem I will rename it the function should be with student student information okay now since because I copied the function I was using the same old name okay so I just fixed that so student class thoughtful datagridview with students on for this is what i just did I the rhenium function will go to the or or to the corrector project and would you fly the variable name okay so i will save this now and let us test this work I believe it should be Smith one two three go no okay since I forgot the values available and go to the staff and the show table data so do we have we have Smith 99 and the password is one two three so this is Smith 99 one two three go what am i doing wrong wait just right second I think cherry this snap 99 1 2 3 error displaying student information okay to work angry ok so here um let’s go back to this guy the login was successful ok so I’ll press f11 over here ok what do we have full sex are from student ok

so this one worked I think now we’re gay we’re going to get an error here no problem here or students contact ok so this one was triggering an error so s UD s tu de NT contact st you DNT ok so mrs. felling this what happens when you misspell something e.n.t ok there we go and so let’s get the students so ID okay so we have student identification I didn’t change the header for that I’ll pass good student i DNT to the identification ok okay it’s like the passport number or something like that let’s go go soo Jin’s okay so ID name identification your contact email so this one’s done this once finished let’s go back here we finish this guy now the staff should be able to add a new student which means we will need to create a dialogue to add another student here so where would that be let’s go back here no not here so we have add book form at cell phone all right wait second yeah it should be something similar to this so I’m gonna create ad and windows form okay so this should be dialogue and the name will be ad student forum good let’s go to this one I will need to copy some of these styles ok I wanted to be the same size everything the same so kind of lazy there we go okay so this one will be what the student ID will not be full by you it will be auto-generated okay so this is going to be what a student named there we go and the text but text box will be okay student name that’s good we have student named next one will be what we will have a student identification we will need the year and we will need what come on okay there we go and contact an email contact and email come on okay there we go done okay so this one student named next one is student identification let’s go down down down identification okay this is going to be here year ok so now for this one I think it will be much easier if we use a combo box here okay so this is going to be student here and basically what this is going to be wait a second where’s the style they fit

the style there we go so the style is a drop-down list now let’s go back click on this little thing edit items so what you want to do is put the possible years so this is maybe student 2012 okay or you could either use pay the year or you could say 14 which means the first year to the second year in college 30 or 40 ok so maybe only four years maybe you assign 506 for you know other levels or like that anyway so now thinking about it maybe the year itself and some other information is needed but anyway for the sake of examples just put 124 okay so student here and after student here what do we have we have contact right so we have student named student identification here contact an email so this is going to be seated and contact ok this is the name of the text box is you didn’t contact and the last one hopefully student email enter and this is going to be student email okay then email the textbox name cannot contain spaces because it’s a variable name okay put this one like that okay and the form add I think this is going to be student okay so this is a forum so basically wait a second I remember something here there is the stud Center pay aren’t good a problem so for canceled there is nothing here to be done for pressing ok we need to verify all these values so now this button is used this method method runs when the ok button is used okay that’s very well yes but I’m used to write comments even the very subtle ones but anyway ok so first perform validation so if a student named the text dota trim equals nothing and if you didn’t enter a student name msgbox you should enter a student name followed by confirmation or ok only error there we go I think instead of information you just need to output critical ok what’s critical here and student name dot focus followed by exit so ok next one F student and okay i forgot the xbox one the text does a trim equals nothing man now what’s text one it’s the identification field which I forgot to rename this diagonal Cashin you can see the name is text box one so i will modify this into ID&T there we go let’s go back to our code and it just might have corrected it okay so if if this one is empty we will have something similar c control v you should enter an identification and identification number for the student for example passport number something like that and i dint dot focus and exit sub nice next one let’s go back and work

with the year f student here the text is nothing you should select select the year for the student okay and next student here dot focus and what we have we have plus two we have the contact and the email so this is one for the contact and one for the email so student contact student email okay you should enter contact information for student contact on formation or student okay and you didn’t contact there we go and you should enter an email an email for students there we go um student email okay so if all this fine what we need to do next is to create the object okay so create the student object and fall out and follow it so the nation student obj as news to the library management system dot student the class okay so this creates an object now we need to fold it so student obj dot sets student name this is going to be student named the text dota trim trimming for removing spaces it’s do a student here dot set said that gosh what I do student obj dot set student identification and it’s going to be i dint the tags got a student obj dot set the year this cannot be a student here go text i need for dodge ram student obj dot set contact student contact the text of the tram and student obj dot set what do we have we have the email student email the tags gotta charm ok so we are treated here we just we just got all this information now all is ready what we need to do is perform the insertion so if not student obj dot insert into DB is going to be what main I think it’s dbms all right mainwindow dbms there we go we will use the same database connection and this is going to be true then so if there’s any kind of error msgbox enable of adding student unable of adding student or say error while adding student and this is going to be critical or okay only and this is going to be error and exits up otherwise if all goes well we will get okay i will save this here and let’s go to our words that is our main window so we have the book here we will click and say student okay and we will say add the new student add a new student okay so we’re going to double click this one used to add new student so what we have

to do is dimension when okay as a new ad student forum so f when dot show dialogue equals ok then all i need to do is refill the student graphical user interface so basically what which one is that that that ok let’s go show ok I think I put function call here right there we go ok f inserting this insert a student okay now if the insert process is successful then what we have to do if answers process successful then just a display display downfall again a problem I will say this this should be it let me check something here what’s this one called this is called student toolstrip menu item Delta click here where’s the admin we have student toolstrip menu item both visible equal false why because we don’t want the administrator to access the student menu I will set this and I were on ok so now this is going to be Smith 99 one two three and go go to students there is none none none ok so let student name and so ok so this is going to be Michael identification ok so the tab order is wrong as you can see I will fix that in a second student identification 99 example by ear here the first year student a soothing compact um ok oh that makes no sense anyway so here you put the address and this is the email or whatever a @ hotmail.com for example and press ok and you get information so it’s working perfectly well close this let me just fix this for in a second the top order here tell or tab index so this is going to be zero next one this is going to be one this is going to be what tab index tab index is going to be too this is going to be three and there’s going to be four and i will click here now check what am I clicking okay so where’s that tabindex five and now this one is tabindex 6 next one step in dec seven okay so just pay attention you must give the box that surround these two bottles at tab index okay now i will run this and this is going to be sniffed 99 1 2 3 go go to adding your students so i will use the tab I think you can see now that it’s working perfectly fine the order is I mean the order so Todd second year contact the land of rule rule @ gmail.com for example enter there we go so um yeah so this is how we do it close

this I’ll save this one and I suppose that okay so one of the things that we need to do next is modifying the student and removing the student i will not do this now i will do this in the next tutorial and hopefully hopefully hopefully the tutorial after that we will start working with the web user interface and things will get a little bit different and they’re okay but i think you’ll find it very interesting okay so that will be all for today so thank you for watching this tutorial if you want to download the source code it will be available on the website just check the link in the description if you have any questions send them to knotts at MK so calm if i don’t answer right away it’s basically because I check the emails every once in a while basically almost every week I assigned number of hours just to check all the emails and yeah but because if I check it every day it would be a little bit you know I don’t have enough time I’m fine okay so if you have any suggestion any question let me know about them and thank you for watching