Cms Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 96

Project Report

On
“COLLEGE MANAGEMENT SYSTEM”
Report submitted fullfilment of the
requirements For the award of the degree in

BACHELOR OF COMPUTR
APPLICATIONS BANGALORE
NORTH UNIVERSITY
.

PRESENTED BY
PADMA NEERAJ KUMAR
(R2013630)

VURIBINDI GAYATHRI (R2013642)

UNDER GUIDANCE
Prof. K . Adisesha.
SJES COLLEGE OF MANAGEMENT STUDIES
BANGALORE NORTH UNIVERSITY-49
Page 1 of 96
Department of computer science – BCA-(BNU)

Jnana prabha campus,bidralli,Bangalore-560049

CERTIFICATE

This is to certify Mr Padma Neeraj Kumar bearing the Registration no . ( R2013630) , Mr


Vuribindi Gayathribearing the Registration no . ( R2013642) ) has done their project on “
COLLEGE MANAGEMENT SYSTEM “ submitted to the Bangalore North University in
the partial fullfilment for the award of the degree of the Bachelor of computer application is a
project of the confilde and the independent work carried out , under the guidance and
supervision of Prof. K . Adisesha. This report does not form part of any reports previosuly
submitted to this university or any other university for the award of degree.

GUIDE HOD PRINICIPAL

Page 2 of 96
DECLARATION

I do here by declare that the project work entitled “COLLEGE MANAGEMENT


SYSTEM” submitted to the Bangalore North University in the partial fulfilment of the
requirements for the award of degree of Bachelor of Computer Applications is a record of
confined and independent project work carried out by our team under the guidance of
Lecture Department of Bachelor of Computer Applications and this report does not form any
part of previous dissertations or reports previously submitted to this University or any other
Universities for the award of degree .

PADMA NEERAJ KUMAR (R2013630)

VURIBINDI GAYATHRI (R2013642)

Page 3 of 96
ACKNOWLEDGEMENT

1. First and foremost, we would like to thank almighty for standing by us through the
project and helping us to complete the same within the stipulated time. We would like
to express our sincere gratitude to our College Chairman Sri. Nagaraj and
Chairperson Smt. Rama Devi
2. Principal Dr. Lakshma Narsimha Reddy for providing us the best facilities & right
atmosphere for the completion of this project ,We are most grateful to HOD of BCA
Dr.K .Adiseha for his humble co-operation
3. This project work has been undertaken and completed under the excellent guidance of
Dr.K. Adisesha who with his valuable suggestions made this project work better
.Last but not the least,we would like to thank our parents, family members for their
encouragement and blessings which played a major role in the successful completion
of our Project .

Padma Neeraj Kumar (R2013630)


Vuribindi Gayathri (R2013642)

Date:
Place : : Bangalore

Page 4 of 96
INDEX
SLNO CONTENTS PAGE NO.
1 Introduction 1

2 Visual Programming Framework 2

3 .Net 3

4 Framework 3
5 VB.Net 4
6 Features 5
7
Crystal Reports 6
8
Requirements and Specification 7
9
Abstraction 10
10
System Design 11-13
11
Data Flow 14-15
12
Diagram ER 16-29
13
Diagram Screen 30-60
14
shots Coding 61-70
15
Reports 72
16
Conclusion 73

Bibiliography

Page 5 of 96
INTRODUCTION

The COLLEGE MANAGEMENT SYSTEM undertaken as a project is based on relevant


technologies. The main aim of this project is to develop software for College Management
System.

This project has been developed to carry out the processes easily and quickly, Which
is not possible with the manuals system, which are overcome by this Software.

This project is developed using VB.NET language. Requirements definition and management is
recognized as a necessary step in the delivery

Of successful system and software projects, discipline is also required by standards,


regulations, and quality improvement initiatives. Creating and managing requirements is a
challenge of IT , systems and product development projects or indeed for any activity
where

You have to manage a contractual relationship. Organization need to effectively define and
manage requirements to ensure they are meeting needs of the customer, while proving
compliance and staying on the schedule and within budge

The impact of a poorly expressed requirement can bring a business out of compliance or even
Cause injury or death. Requirements definition and management is an activity that can
Deliver a high, fast return on investment.

Page 6 of 96
VISUAL STUDIO 2022

Visual studio is a programming language and powerful Front-End tool for developing
window Application, the name suggest, programming with Visual studio is accomplished
visually.

Visual studio is based a Graphical User Interface(GUI), Visual studio is a programming


language

With inbuilt ability to create user interface quickly and easily. while wrting the programme,
you can

see how your program will look during runtime. This is the great advantage over other
programming language. In Visual studio you have available toolbox of these element.

You can create new windows called Forms. Programmer, create the (GUI) by
selecting an object ,

Setting the object properties to define the object appearance like Colour, Size and Image
etc.,And behaviour and write Code that respons to an event that occours in the interface.

These programmes work on the Text Mode using the extended character set to give the user a
feeling of Graphical Environment. Visual studio need programming under (GUI)
Environment easy and fast

THE PROGRAMMING PROCESS

1. Decide what your application is to do by creating an overall design.

2.Create the visual portion of your application(the screens and the menus that your users
will interact with).

3.Add visual studio programming language code to tie the visual elements together and
to automate the programme.

4.Test your application to locate and remove any bugs you find.

Page 7 of 96
.NET Framework

The .NET Framework is a new computing platform that simplifies application development in
the highly distributed environment of the Internet.
The .NET Framework is designed to fulfill the following objectives:

It provide a consistent object-oriented programming environment whether object code is


stored and executed locally, executed locally but Internet-distributed, or executed remotely.
 To provide a code-execution environment that minimizes software deployment and
versioning conflicts.
 To provide a code-execution environment that guarantees safe execution of code,
including code created by an unknown or semi-trusted third party.
 To provide a code-execution environment that eliminates the performance problems
of scripted or interpreted environments.
 To make the developer experience consistent across widely varying types
 of applications, such as Windows-based applications and Web-based applications.
 To build all communication on industry standards to ensure that code based on the
.NET Framework can integrate with any other code.

Front End:- Vb.Net


Visual Basic .NET (VB.NET) is an object-oriented computer programming
language implemented on the .NET Framework. Although it is an evolution
of classic Visual Basic language, it is not backwards-compatible with VB10,
and any code written in the old version does not compile under VB.NET.

Like all other .NET languages, VB.NET has complete support for object oriented concepts.
Everything in VB.NET is an object, including all of the
primitive types (Short, Integer, Long, String, Boolean, etc.) and user-defined types, events,
and even assemblies. All objects inherits from the base class Object.

Page 8 of 96
Features of VB.NET

 Modern, general purpose.


 Object oriented.
 Component oriented.
 Easy to learn.
 Structured language.
 It produces efficient programs.
 It can be compiled on a variety of computer platforms.
 Part of .Net Framework

BACK END:-MY SQL

SQL database is a powerful database management system .It is used for creating database
editing, uploading or deleting the records from the database .we can also specify data
integrity to the database by applying constraints. Relationship can also be specified to the
database
.Hence we have used My Sql database as backing software

Page 9 of 96
Page 10 of 96
CRYSTAL REPORT

Crystal Report is a officially a member of the Visual studio.Net product. It is included in all
major editions and ships in all languages available with Visual studio .Net Crystal Reports
.Net provides developers with the fastest , most productive way to create and integrate
presentation-quality, interactive reports that scale to meet the demands of the end users.

Crystal Reports .Net is a very powerful report writer, it offers a very well defined object
model that provides flexibility when integrating reports into windows and web applications.
It also comes with highly customizable viewer component that gives developers control how
their reports are presented to users.

Crystal Reports .Net provides developers with two different report viewing components. The
first can be used for displaying reports in Windows forms. The other is a component that can
be display reports in a Web environment. The beauty of these viewers is in their simplicity.
Viewing a report is as simple as setting Report source property of the respective viewer.

Page 11 of 96
HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE REQUIREMENTS

 PROCESSOR : Intel(R) Core(TM) i3 CPU @ 1.60GHz (Minimum)


 PROCESSOR SPEED : 1,80 GHz
 RAM : 4 GB
 HARD DISK : 256 GB

SOFTWARE REQUIREMENTS

 OPEARTING SYSTEM : WINDOWS 10 / 11


 FRONTEND : VB.NET
 BACKEND : My SQL

Page 12 of 96
ABSTRACT

The project named “ College Management System “ is written in VB.NET mainly because of
its suitability for this type of application . Its user-friendly nature and in-built documentation,
complication , error detection , binding facilities and interaction with other software packages
make it most powerful tool for software development . Moreover ,VB.NET consists of all the
technologies that help in creating and running robust , scalable and distributed package.

This project will have many different pages with an inbuilt authentication (user name and
password ). This project will contain many text boxes, label boxes and also many command
buttons etc. All the database work will be done in MY-SQL and it will be directly connected
with the database to get all the information about the user.

Assistance is provided to the user at each and every and every step so that no problem is
faced while using it. Further the details of every process and the user manuals are attached to
make the software and the report clear , simple and error free which makes it so special and
one of its kind.

Page 13 of 96
SYSTEM ANALYSIS

USE CASE DIAGRAM


Use Case Diagram is used to identify the “uses” or use cases of the new system-- in other
words, to identify how the system will be used. The Use Case Diagram is essentially an
extension of the Event Table.

USE CASE:
It describes an activity the system carries out in response to an event.

ACTOR:
In UML, the person involved is called an Actor. An Actor is always outside of the
Automation Boundary of the system.

CONNECTING LINE:
The arrow is used to show which Actors participate in which Use Cases.

USE CASE DIAGRAM NOTATIONS:

Use case

Connecting line Use case

Automation boundary

Actor

Page 14 of 96
DESCRIPTION:

The Object Oriented approach uses the term use case to describe an activity the system
carries out in response to an event. One can think of a use case as a case or situation where
the system is used for some purpose .A use case diagram is a convenient way to document the
functions that the system must support. Sometimes a single, comprehensive diagram is used
to describe the entire system. At other times, a set of smaller use case diagrams make up the
use case model.
USE- CASE DIAGRAM

Page 15 of 96
Page 16 of 96
SYSTEM DESIGN
DEPLOYMENT DIAGRAM:
A deployment diagram in the Unified Modeling Language models the physical deployment of
artifacts on nodes.[1] To describe a web site, for example, a deployment diagram would show
what hardware components ("nodes") exist (e.g., a web server, an application server, and a
database server), what software components ("artifacts") run on each node (e.g., web
application, database), and how the different pieces are connected (e.g. JDBC, REST, RMI).

The nodes appear as boxes, and the artifacts allocated to each node appear as rectangles
within the boxes. Nodes may have sub nodes, which appear as nested boxes. A single node in
a deployment diagram may conceptually represent multiple physical nodes, such as a cluster
of database
servers.

Hardware
College Management System

System

Database

Page 17 of 96
DATA FLOW DIAGRAM

Data flow diagrams are graphical representations of workflows of stepwise activities and
actions with support for choice, iteration and concurrency. In the Unified Modelling
Language, activity diagrams can be used to describe the business and operational step-by-step
workflows of components in a system. An Data flow diagram shows the overall flow of
control.

The most important shape types:


o Rounded rectangles represent activities;
o Diamonds represent decisions;
o Bars represent the start (split) or end (join) of concurrent activities;
o A black circle represents the start (initial state) of the workflow;
o An encircled black circle represents the end (final state).
o Arrows run from the start towards the end and represent
the order which activities happen.

Page 18 of 96
DATA FLOW DIAGRAM

Start

System checks
username & password

Login Screen

Enter username & password


Again

try

Invalid

Gives an error

Valid

Login successfully

Page 19 of 96
DATA FLOW DIAGRAM

Page 20 of 96
Page 21 of 96
ENTITY RELATIONSHIP DIAGRAM

The entity – relationship (ER) data model allows us to describe the data involved in a real
world enterprise in terms of object and their relationships and is widely used to develop an
initial database design.

The ER model is important primarily for its role in database design. It provides useful
concepts that allow us to move from an informal description of what users want from their
database to a more detailed and precise description that can be implemented in a DBMS. The
ER model is used in a phase called “Conceptual Database Design”. It should be noted that
many variations of ER diagrams are in use and no widely accepted standards prevail.

ER modelling is something regarded as a complete approach to design a logical database


schema. This is incorrect because the ER diagram is just an approximate description of data,
constructed through a very subjective evaluation of the information collected during
requirements analysis.

Entity:
An entity is an object in the real world that is distinguishable from other objects. Examples
include the following: The C++ language, the address of the manager of the institution. It is
often useful to identify a collection of similar entities. Such a collection is called as “Entity
set”. Note that entity set need not be disjoint.

Attributes:
An entity is described using a set of attributes. All entities in a given entity set have the same
attributes; this essentially what we mean by similar. Our choice of attributed reflects the level
of detail at which we wish to represent information in crisis.

Key:
Further, for each entity set we choose a key. A key is a minimal set of attributed whose values
uniquely identify an entity in the set. There could be more than one

Page 22 of 96
ER DIAGRAM

Page 23 of 96
Page 24 of 96
SCREEN SHOTS

Page 25 of 96
SPLASH-SCREEN

LOGIN-SCREEN

Page 26 of 96
Forgot Password

Page 27 of 96
ADMIN-DASHBOARD

USER DETAILS

Page 28 of 96
MENU BAR

ADMIN- ADD USER

Page 29 of 96
ADMIN – ADD STUDENT

ADMIN – VIEW USERS

Page 30 of 96
ADMIN – VIEW STUDENTS

ADMIN – SUBJECTS AND PROGRAMS MANAGEMENT

Page 31 of 96
ADMIN – ATTENDANCE MANAGEMENT

ADMIN – TIME TABLE MANAGEMENT

Page 32 of 96
Page 33 of 96
ADMIN – NOTICE MANAGEMENT

ADMIN – RECYCLE BIN

Page 34 of 96
FACULTY - DASHBOARD

FACULTY - ATTENDANCE

Page 35 of 96
FACULTY - TIMETABLE

Page 36 of 96
STUDENT - DASHBOARD

STUDENT- TIMETABLE

Page 37 of 96
coding

Page 38 of 96
SPLASHSCREEN

Imports Transitions

Public Class Splashscreen


'Progressbar timer For the splashscreen load Event
Dim login As New Login
Private Sub LoadingTimer_Tick(sender As Object, e As EventArgs) Handles LoadingTimer.Tick
splashProgressBar.Increment(5)
If splashProgressBar.Value = 101 Then
LoadingTimer.Stop()
Threading.Thread.Sleep(1000)
LoadingTimer.Dispose()
login.Show()
Me.Hide()
End If
End Sub

End Class

Page 39 of 96
LOGIN

Imports MySqlConnector

Imports System.IO

Public Class Login


Public usertype, username, fname, lname, phone, email As String
Dim countError As Integer = 1
Public img() As Byte

Dim su As New AddRemoveStudentStaff

Private Sub crossPb_Click(sender As Object, e As EventArgs) Handles CrossPictureBox.Click


Application.Exit()
End Sub

Private Sub signInBtn_Click(sender As Object, e As EventArgs) Handles SignInBtn.Click


Cursor = Cursors.WaitCursor
If (UserNameTextBox.Text = "") Then
loginErrorProvider.SetError(UserNameTextBox, "Please enter your username!!")
Else
loginErrorProvider.SetError(UserNameTextBox, String.Empty)
End If
If (PasswordTextBox.Text = "") Then
loginErrorProvider.SetError(PasswordTextBox, "Please enter your password!!")
Else
loginErrorProvider.SetError(PasswordTextBox, String.Empty)
End If
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("SELECT * FROM userTbl WHERE username= @a AND password =@b AND state = 1",
con)
cmd.Parameters.AddWithValue("@a", UserNameTextBox.Text)
cmd.Parameters.AddWithValue("@b", PasswordTextBox.Text)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable()
Dim a As String = " "

da.Fill(dt)
'Check if the given user exist
If (dt.Rows.Count > 0) Then
usertype = dt.Rows(0).Item("usertype")
img = dt.Rows(0).Item("image")
username = dt.Rows(0).Item("username")
fname = dt.Rows(0).Item("firstname")
lname = dt.Rows(0).Item("lastname")
phone = dt.Rows(0).Item("contact_no")
email = dt.Rows(0).Item("email")
Dim dash As New Dashboard(usertype, img, username, fname, lname, phone, email)
dash.Show()
Me.Hide()
Else
'Check if the student exist
Dim cmd2 As New MySqlCommand("SELECT * FROM stuTbl WHERE username= @a AND password =@b AND state = 1",
con)
cmd2.Parameters.AddWithValue("@a", UserNameTextBox.Text)
cmd2.Parameters.AddWithValue("@b", PasswordTextBox.Text)
Dim da2 As New MySqlDataAdapter(cmd2)
Dim dt2 As New DataTable()

Page 40 of 96
da2.Fill(dt2)

If (dt2.Rows.Count > 0) Then


usertype = dt2.Rows(0).Item("usertype")
img = dt2.Rows(0).Item("image")
username = dt2.Rows(0).Item("username")
fname = dt2.Rows(0).Item("fname")
lname = dt2.Rows(0).Item("lname")
phone = dt2.Rows(0).Item("phoneno")
email = dt2.Rows(0).Item("email")
Dim dash As New Dashboard(usertype, img, username, fname, lname, phone, email)
dash.Show()
Me.Hide()
Else
ErrorTimer.Start()
BunifuTransition1.ShowSync(ErrorMessagePanel)

End If
End If
Cursor = Cursors.Arrow
End Sub

Private Sub ErrorTimer_Tick(sender As Object, e As EventArgs) Handles ErrorTimer.Tick


countError = countError + 1
If (countError > 50) Then
ErrorMessagePanel.Visible = False
ErrorTimer.Dispose()
countError = 1
End If
End Sub

Private Sub ForgotPasswordLabel_Click(sender As Object, e As EventArgs) Handles ForgotPasswordLabel.Click


Dim forget As New EmailVerification()
forget.ShowDialog()
End Sub

End Class

Page 41 of 96
FORGOT PASSWORD

Imports MySqlConnector

Imports Transitions
Imports System.Text

Public Class forgetPass


Dim amm As New AddRemoveStudentStaff
Dim con As MySqlConnection = amm.dbConnect()
Public sqls As String
Private Sub CheckButton_Click(sender As Object, e As EventArgs) Handles CheckButton.Click
Dim cmd As New MySqlCommand("SELECT * FROM userTbl where email = @a", con)
cmd.Parameters.AddWithValue("@a", EmailCheckTextBox.Text)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
If (dt.Rows.Count > 0) Then
Transition.run(Me, "Height", 246, New TransitionType_EaseInEaseOut(100))
forgetPassPanel.Visible = True
forgetPassPanel.Enabled = True
sqls = "UPDATE userTbl SET password = @a WHERE email = @b"
Else
If (dt.Rows.Count = 0) Then
Dim cmd2 As New MySqlCommand("SELECT * FROM stuTbl where email = @a", con)
cmd2.Parameters.AddWithValue("@a", EmailCheckTextBox.Text)
Dim da2 As New MySqlDataAdapter(cmd2)
Dim dt2 As New DataTable()
da2.Fill(dt2)
If (dt2.Rows.Count > 0) Then
Transition.run(Me, "Height", 246, New TransitionType_EaseInEaseOut(100))
forgetPassPanel.Visible = True
forgetPassPanel.Enabled = True
sqls = "UPDATE stuTbl SET password = @a WHERE email = @b"
Else
Transition.run(Me, "Height", 108, New TransitionType_EaseInEaseOut(100))
forgetPassPanel.Visible = False
forgetPassPanel.Enabled = False
MsgBox("Email you entered doesnt exist!!")
End If
End If
End If
End Sub

Private Sub CancelButton_Click(sender As Object, e As EventArgs)


Me.Close()
End Sub

Sub updatePassword(sql As String)


Dim cmd As New MySqlCommand(sql, con)
cmd.Parameters.AddWithValue("@a", ReEnterPasswordTextBox.Text)
cmd.Parameters.AddWithValue("@b", EmailCheckTextBox.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
MsgBox("Your password has been successfully changed!!")
End Sub

Private Sub ChangeButton_Click(sender As Object, e As EventArgs) Handles ChangeButton.Click


updatePassword(sqls)
End Sub

Private Sub CrossPictureBox_Click(sender As Object, e As EventArgs) Handles CrossPictureBox.Click


Page 42 of 96
Me.Close()
End Sub

Private Sub forgetPass_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Transition.run(Me, "Height", 108, New TransitionType_EaseInEaseOut(100))
Bun.ShowAsyc(Me)
End Sub
End Class

Page 43 of 96
DASHBOARD

Imports Transitions
Imports MaterialSkin.Controls
Imports BunifuAnimatorNS
Imports System.IO
Imports MySqlConnector

Public Class Dashboard


'Dim ar As New AddRemoveStudentStaff
'Dim ps As New ProgramAndSubjects
'Dim a As New Attendance
'Dim feeManager As New frmFeeManager
'Dim setting As New Setting
'Dim result As New Result
'Dim notice As New Notice
'Dim bin As New RecycleBin
Public utypes, fnames, lnames, phones, emails, unames As String
Public imgs() As Byte
Dim su As New AddRemoveStudentStaff
Public userType As String

Sub unVisibleAll()
PcMgmtButton.Visible = False
RecycleBinButton.Visible = False
NoticeButton.Visible = False
ReportsButton.Visible = False
AddRemoveButton.Visible = False
AttendanceButton.Visible = False
ResultButton.Visible = False
End Sub
Sub userChecker()
userType = utypes
If (userType = "") Then
PcMgmtButton.Visible = True
RecycleBinButton.Visible = True
NoticeButton.Visible = True
ReportsButton.Visible = True

AddRemoveButton.Visible = True
AttendanceButton.Visible = True
ResultButton.Visible = True
Else
If (userType.Equals("Student")) Then
unVisibleAll()
ResultButton.Visible = True
HamburgerButton.Dock = DockStyle.Top
HomeButton.Dock = DockStyle.Top
ResultButton.Dock = DockStyle.Top

ElseIf (userType.Equals("Receptionist")) Then


unVisibleAll()
AddRemoveButton.Visible = True

HamburgerButton.Dock = DockStyle.Top
Page 44 of 96
HomeButton.Dock = DockStyle.Top
AddRemoveButton.Dock = DockStyle.Top
ElseIf (userType.Equals("Lecturer")) Then
unVisibleAll()
ResultButton.Visible = True
AttendanceButton.Visible = True
HamburgerButton.Dock = DockStyle.Top
HomeButton.Dock = DockStyle.Top
ResultButton.Dock = DockStyle.Top
AttendanceButton.Dock = DockStyle.Top

End If
End If

End Sub
Private Sub HamburgerButton_Click(sender As Object, e As EventArgs) Handles
HamburgerButton.Click

userDetail()
If (hamburgerPnl.Width < 250) Then
Transition.run(hamburgerPnl, "Width", 250, New
TransitionType_EaseInEaseOut(20))
Dim i As Integer = 0
Dim buttonArray() As Button = New Button() {HamburgerButton,
CloseButton, AddRemoveButton, RecycleBinButton, AttendanceButton, PcMgmtButton,
HomeButton, LogOutButton, ResultButton, NoticeButton, ReportsButton}
Dim textName As String() = {"MENU", "EXIT", "CRUD", "RECYCLER",
"ATTENDANCE", "FACULTY MGMT", "HOME", "LOG OUT", "TIMETABLE", "NOTICE",
"REPORTS"}
For Each values As Button In buttonArray
'values.Width = 250
Transition.run(values, "Width", 250, New
TransitionType_EaseInEaseOut(30))
values.Text = textName(i)
i = i + 1
Next
HamburgerButton.Width = 250
Else
Transition.run(hamburgerPnl, "Width", 45, New
TransitionType_EaseInEaseOut(20))
Dim buttonArray() As Button = New Button() {HamburgerButton,
CloseButton, AddRemoveButton, RecycleBinButton, AttendanceButton, PcMgmtButton,
HomeButton, LogOutButton, ResultButton, NoticeButton, ReportsButton}
For Each values As Button In buttonArray
'values.Width = 45
Transition.run(values, "Width", 45, New
TransitionType_EaseInEaseOut(30))
values.Text = ""
Next
End If
End Sub

'Transform picturebox into circular format


Sub circularImage(ByVal pb As PictureBox)
Dim gp As Drawing2D.GraphicsPath

Page 45 of 96
Dim rg As Region
gp = New Drawing2D.GraphicsPath
gp.AddEllipse(0, 0, pb.Width - 4, pb.Height - 4)
rg = New Region(gp)
pb.Region = rg
End Sub

Sub showRecycleBin()
Dim bin As New RecycleBin
'closeAll()
Cursor = Cursors.WaitCursor
bin.MdiParent = Me
MainPanel.Controls.Clear()
MainPanel.Controls.Add(bin)
bin.Dock = DockStyle.Fill
bin.Show()
bin.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
Cursor = Cursors.Arrow
End Sub

Sub showAddRemoveStudentUserPanel()
Dim ar As New AddRemoveStudentStaff
If (utypes = "Receptionist") Then
ar.UserStudentTabController.TabPages(0).Enabled = False
ar.UserStudentTabController.TabPages(1).Enabled = False
End If
'closeAll()
MainPanel.Controls.Clear()
ar.MdiParent = Me
MainPanel.Controls.Add(ar)
ar.Dock = DockStyle.Fill
ar.Show()
ar.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()

End Sub

Sub showCourseAndSubjects()
Dim ps As New ProgramAndSubjects
'closeAll()
MainPanel.Controls.Clear()
ps.MdiParent = Me
MainPanel.Controls.Add(ps)
ps.Dock = DockStyle.Fill
ps.Show()
ps.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showReports()
Dim ps As New Reports
'closeAll()

Page 46 of 96
MainPanel.Controls.Clear()
ps.MdiParent = Me
MainPanel.Controls.Add(ps)
ps.Dock = DockStyle.Fill
ps.Show()
ps.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showAttendance()
Dim a As New Attendance(utypes, fnames)
'closeAll()
MainPanel.Controls.Clear()
a.MdiParent = Me
MainPanel.Controls.Add(a)
a.Dock = DockStyle.Fill
a.Show()
a.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showSetting()
Dim setting As New Reports
'closeAll()
MainPanel.Controls.Clear()
setting.MdiParent = Me
MainPanel.Controls.Add(setting)
setting.Dock = DockStyle.Fill
setting.Show()
setting.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showResult()
Dim result As New Result(userType, unames, fnames)
'closeAll()
MainPanel.Controls.Clear()
result.MdiParent = Me
MainPanel.Controls.Add(result)
result.Dock = DockStyle.Fill
result.Show()
result.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showFeeMgmt()
Dim feeManager As New frmFeeManager
'closeAll()
MainPanel.Controls.Clear()
feeManager.MdiParent = Me
MainPanel.Controls.Add(feeManager)
feeManager.Dock = DockStyle.Fill

Page 47 of 96
feeManager.Show()
feeManager.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub showNotice()
Dim notice As New Notice
'closeAll()
MainPanel.Controls.Clear()
notice.MdiParent = Me
MainPanel.Controls.Add(notice)
notice.Dock = DockStyle.Fill
notice.Show()
notice.BringToFront()
MainPanel.Controls.Add(UserDetailPanel)
UserDetailPanel.BringToFront()
End Sub

Sub loadNotices()
Dim dt As New DataTable
Dim sql As String = "SELECT * FROM noticeTbl"
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand(sql, con)
Dim da As New MySqlDataAdapter(cmd)
Dim dts As New DataTable()
da.Fill(dts)
If (dts.Rows.Count > 0) Then
TTgrid.DataSource = dts
Else
TTgrid.Columns.Add("NO NOTICES", "NO NOTICES")
'TTgrid.Columns.Add("NOTICE", "NOTICE")
'Dim newRow As DataGridViewRow = New DataGridViewRow()

'' Set the values for the row's cells


'newRow.Cells.Add(New DataGridViewTextBoxCell() With {.Value = "NO
DATA"})
'newRow.Cells.Add(New DataGridViewTextBoxCell() With {.Value = "NO
DATA"})

'' Add the row to the DataGridView control


'TTgrid.Rows.Add(newRow)
End If

End Sub

Sub fullScreen()
Me.Top = 0
Me.Left = 0
Me.Height = Screen.PrimaryScreen.WorkingArea.Height
Me.Width = Screen.PrimaryScreen.WorkingArea.Width
End Sub
'Dim b As String
Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles

Page 48 of 96
MyBase.Load
AllNoticeListView.Visible = False
fullScreen()
userDetail()
profileDrop()
labelCenterer(NameLabel)
labelCenterer(PhoneNoLabel)
labelCenterer(EmailLabel)
userChecker()
loadNotices()
End Sub

Sub labelCenterer(ByVal a As Label)


a.Left = (a.Parent.Width \ 2) - (a.Width \ 2)
End Sub

Public Sub New(utype As String, img() As Byte, uname As String, fname As


String, lname As String, phone As String, email As String)
InitializeComponent()
utypes = utype
fnames = fname
lnames = lname
emails = email
phones = phone
unames = uname
imgs = img
End Sub

Sub profileDrop()
circularImage(ProfilePictureBox)
NameLabel.Text = fnames & " " & lnames
PhoneNoLabel.Text = phones
EmailLabel.Text = emails
Dim img() As Byte
img = imgs

If (img IsNot Nothing) Then


Try
Dim ms As New MemoryStream(img)
ProfilePictureBox.Image = Image.FromStream(ms)
Catch ex As Exception
Console.WriteLine("Image not found")
End Try

Else

End If

End Sub

Sub userDetail()
UserDetailPanel.BackColor = Color.FromArgb(125, Color.Black)
SlideDownButton.BackColor = Color.FromArgb(125, Color.Black)
End Sub

Page 49 of 96
Private Sub AddRemoveButton_Click(sender As Object, e As EventArgs) Handles
AddRemoveButton.Click
showAddRemoveStudentUserPanel()
userDetail()
End Sub

Private Sub AdminSettingButton_Click(sender As Object, e As EventArgs)


Handles PcMgmtButton.Click
showCourseAndSubjects()
userDetail()
End Sub

Private Sub RecycleBinButton_Click(sender As Object, e As EventArgs)


Handles RecycleBinButton.Click
showRecycleBin()
userDetail()
End Sub

Private Sub AttendanceButton_Click(sender As Object, e As EventArgs)


Handles AttendanceButton.Click
showAttendance()
userDetail()
End Sub

Private Sub CloseButton_Click(sender As Object, e As EventArgs) Handles


CloseButton.Click
Application.Exit()
End Sub

Private Sub ReportsButton_Click(sender As Object, e As EventArgs) Handles


ReportsButton.Click
showReports()
userDetail()
End Sub

Private Sub MainPanel_Paint(sender As Object, e As PaintEventArgs) Handles


MainPanel.Paint

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


SlideDownButton.Click

If (UserDetailPanel.Height < 19) Then


Transition.run(UserDetailPanel, "Height", 600, New
TransitionType_Acceleration(100))
SlideDownButton.Image = My.Resources.Collapse_Arrow_24px1
userDetail()
Else
Transition.run(UserDetailPanel, "Height", 18, New
TransitionType_EaseInEaseOut(100))
SlideDownButton.Image = My.Resources.Expand_Arrow_24px
userDetail()

Page 50 of 96
End If
End Sub

Private Sub LogOutButton_Click(sender As Object, e As EventArgs) Handles


LogOutButton.Click
Me.Close()
Dim login As New Login
login.Show()
End Sub

Private Sub HomeButton_Click(sender As Object, e As EventArgs) Handles


HomeButton.Click
MainPanel.Controls.Clear()
MainPanel.Controls.Add(UserDetailPanel)
MainPanel.Controls.Add(TTgrid)
UserDetailPanel.BringToFront()
TTgrid.BringToFront()
loadNotices()

End Sub

Private Sub ResultButton_Click(sender As Object, e As EventArgs) Handles


ResultButton.Click
showResult()
End Sub

'Private Sub BillButton_Click(sender As Object, e As EventArgs)


' showFeeMgmt()
'End Sub

Private Sub NoticeButton_Click(sender As Object, e As EventArgs) Handles


NoticeButton.Click
showNotice()
End Sub
End Class

Page 51 of 96
ADD, REMOVE AND VIEW STUDENTS AND STAFF

Imports Transitions
Imports System.IO
Imports System.Data.SqlClient
Imports System.Text
Imports System.Security.Cryptography
Imports MaterialSkin.Controls
Imports MetroFramework.Controls
Imports System.Net.Mail
Imports BunifuAnimatorNS
Imports System.Text.RegularExpressions
Imports System.Drawing.Imaging
Imports MySqlConnector

Public Class AddRemoveStudentStaff


Public userId, stuId As Integer
Dim state As Integer = 1
Dim userPhoto As String
Dim studentPhoto As String
Public studentUserType As String = "Student"
'Browse images

Sub imageChooser(ByVal a As String)


ImageOpenDialog.Filter = "Picture
Files(*.jpg;*.jpeg;*.png;*.bmp;*.gif)|*.jpg;*.jpeg;*.png;*.bmp;*.gif"
ImageOpenDialog.FilterIndex = 2
ImageOpenDialog.RestoreDirectory = True
If ImageOpenDialog.ShowDialog() = DialogResult.OK Then
If File.Exists(ImageOpenDialog.FileName) = False Then
MessageBox.Show("Sorry, The File You Specified Does Not
Exist.")
Else
If (a = "UserUploadBtn") Then
UserImage.ImageLocation = ImageOpenDialog.FileName
userPhoto = ImageOpenDialog.FileName
ElseIf (a = "StudentUploadBtn") Then
StudentImage.ImageLocation = ImageOpenDialog.FileName
studentPhoto = ImageOpenDialog.FileName
End If

End If
End If
End Sub

Private Sub UserImage_Click(sender As Object, e As EventArgs) Handles


UserImage.Click
imageChooser("UserUploadBtn")
End Sub

Private Sub StudentImage_Click(sender As Object, e As EventArgs) Handles


StudentImage.Click
imageChooser("StudentUploadBtn")
End Sub

Page 52 of 96
Private Function passvalid(pass As String)
Dim a As Char
Dim Caplet = False
Dim smalet = False
Dim spcar = False
Dim numcar = False
If (pass.Length >= 8) Then
For Each a In pass
If (Char.IsLetter(a.ToString(), 0)) Then
If Char.IsLower(a.ToString(), 0) Then
smalet = True
ElseIf Char.IsUpper(a.ToString(), 0) Then
Caplet = True
End If
ElseIf (Char.IsDigit(a.ToString(), 0)) Then
numcar = True
ElseIf (Char.IsLetterOrDigit(a.ToString(), 0)) Then
spcar = True
End If
Next
If (Caplet = True And smalet = True And spcar = True And numcar =
True) Then
Return True
Else
Return False
End If

Else
Return False
End If
End Function

Sub loadEverything()
Dim dt As DataTable = loadUsers("Select * FROM userTbl WHERE state =
1")
Dim dt2 As DataTable = loadUsers("Select * FROM stuTbl WHERE state =
1")
'for admin
AdminUserDataGridView.DataSource = dt
AdminUserDataGridView.Columns(15).Visible = False
AdminUserDataGridView.Columns(14).Visible = False
'For other users who just views
UserDataGridView.DataSource = dt
UserDataGridView.Columns(15).Visible = False
UserDataGridView.Columns(14).Visible = False
UserDataGridView.Columns(13).Visible = False
UserDataGridView.Columns(12).Visible = False
'for admin
AdminStudentDataGridView.DataSource = dt2
AdminStudentDataGridView.Columns(22).Visible = False
AdminStudentDataGridView.Columns(21).Visible = False
AdminStudentDataGridView.Columns(20).Visible = False
'For other users who just views
StudentDataGridView.DataSource = dt2

Page 53 of 96
StudentDataGridView.Columns(22).Visible = False
StudentDataGridView.Columns(21).Visible = False
StudentDataGridView.Columns(20).Visible = False
StudentDataGridView.Columns(19).Visible = False
StudentDataGridView.Columns(18).Visible = False
StudentDataGridView.Columns(17).Visible = False

PasswordTextBox.Text = GeneratePassword()
StudentPasswordTextBoxs.Text = GeneratePassword()
loadPrograms()
SUpdateButton.Enabled = False
SDeleteButton.Enabled = False
UUpdateButton.Enabled = False

UDeleteButton.Enabled = False
End Sub
'dashboard load method
Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
loadEverything()
'MsgBox(DobDateTimePicker.Text)
End Sub

'Connect the database


Function dbConnect()
Dim connStr As String =
"server=localhost;user=root;database=CMS;port=3306;Convert Zero Datetime=True"
Dim db As New MySqlConnection(connStr)
Return db
End Function

'Clear all the textbox users


Sub clearAll()
Dim textboxArray() As MaterialSingleLineTextField = New
MaterialSingleLineTextField() {FirstNameTextBox, LastNameTextBox,
MiddleNameTextBox, ContactNoTextBox, EmailTextBox, Address1TextBox,
Address2TextBox, UserNameTextBox, PasswordTextBox}
For Each values As MaterialSingleLineTextField In textboxArray
values.Text = ""
Next
UserIdTextBox.Text = ""
Dim radiobuttonArray() As MaterialRadioButton = New
MaterialRadioButton() {MaleRadioBtn, FemaleRadioBtn}
For Each values As MaterialRadioButton In radiobuttonArray
values.Checked = False
Next
Dim comboboxArray() As MetroComboBox = New MetroComboBox()
{UserTypeComboBox, MaritialStatusComboBox}
For Each values As MetroComboBox In comboboxArray
values.SelectedIndex = -1
Next
DobDateTimePicker.Value = DateTime.Today.ToString
UserImage.Image = My.Resources.user_male2_512
PasswordTextBox.Text = GeneratePassword()
End Sub

Page 54 of 96
Sub clearAllStudent()
Dim textboxArray() As MaterialSingleLineTextField = New
MaterialSingleLineTextField() {FirstNameTextBoxs, LastNameTextBoxes,
MiddleNameTextBoxs, CurrentAddressTextBoxs, PermanentAddressTextBoxs,
DistrictTextBoxs, PhoneNoTextBoxs, EmailAddressTextBoxs, GuardianNameTextBoxs,
GuardianContactTextBoxs, ReligionTextBoxs, LanguageTextBoxs,
StudentUsernameTextBoxs, StudentPasswordTextBoxs}
For Each values As MaterialSingleLineTextField In textboxArray
values.Text = ""
Next
StudentIdTextBox.Text = ""
Dim comboboxArray() As MetroComboBox = New MetroComboBox()
{CourseComboBoxs, MaritialStatusComboBoxs, GenderComboBoxs,
ScholarshipComboBoxs}
For Each values As MetroComboBox In comboboxArray
values.SelectedIndex = -1
Next
Dobs.Value = DateTime.Today.ToString
StudentImage.Image = My.Resources.user_male2_512
StudentPasswordTextBoxs.Text = GeneratePassword()
SSubmitButton.Enabled = True
End Sub
'load users in database
Public Function loadUsers(ByVal sql As String)
Dim con As MySqlConnection = dbConnect()
Dim cmd As New MySqlCommand(sql, con)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
Return dt
End Function

Sub refreshUsers()
Dim dt As DataTable = loadUsers("SELECT * FROM userTbl WHERE state =
1")
AdminUserDataGridView.DataSource = dt
UserDataGridView.DataSource = dt
End Sub

'Add to database => user


Private Sub finishBtn_Click(sender As Object, e As EventArgs) Handles
UFinishButton.Click
Dim gender As String
If (ContactNoTextBox.Text.Length <> 10) Then
MsgBox("Enter Proper Contact Number")
Return
End If
If Not passvalid(PasswordTextBox.Text) Then
MsgBox("Please Enter Correct Password Format with Min 8 Chars with
atkeast 1 smallchar, 1 CapitalChar, 1 Number, 1 special Char")
Return
End If

If (MaleRadioBtn.Checked) Then
gender = "Male"

Page 55 of 96
Else
gender = "Female"
End If
Try
insertUsers(useridtxt.Text, FirstNameTextBox.Text,
MiddleNameTextBox.Text, LastNameTextBox.Text, gender, ContactNoTextBox.Text,
Address1TextBox.Text, Address2TextBox.Text, UserTypeComboBox.Text,
DobDateTimePicker.Text, EmailTextBox.Text, MaritialStatusComboBox.Text,
UserNameTextBox.Text, PasswordTextBox.Text)

Catch ex As Exception
MsgBox(ex)

End Try
If (SendEmailCheckBox.Checked) Then
sendEmail()
End If
UserImage.Image = My.Resources.user_male2_512

'PasswordTextBox.Text = GeneratePassword()
refreshUsers()
End Sub

'Insert users to the database


Public Sub insertUsers(ByVal userId As String, ByVal fn As String, ByVal mn
As String, ByVal ln As String, ByVal gender As String, ByVal contactNo As
String, ByVal addressOne As String, ByVal addressTwo As String, ByVal userType
As String, ByVal dob As String, ByVal email As String, ByVal maritialStatus As
String, ByVal username As String, ByVal password As String)
Dim con As MySqlConnection = dbConnect()
Try
Dim cmd As New MySqlCommand("INSERT INTO userTbl
values(@userId,@firstname,@middlename,@lastname,@gender,@contact,@addressone,@a
ddresstwo,@usertype,@dob,@email,@maritialstatus,@username,@password,@loadimage,
@state)", con)
Dim tableName As String = fn & "_user_" & userType & "_" &
contactNo
cmd.Parameters.AddWithValue("@userId", userId)
cmd.Parameters.AddWithValue("@firstname", fn)
cmd.Parameters.AddWithValue("@middlename", mn)
cmd.Parameters.AddWithValue("@lastname", ln)
cmd.Parameters.AddWithValue("@gender", gender)
cmd.Parameters.AddWithValue("@contact", contactNo)
cmd.Parameters.AddWithValue("@addressone", addressOne)
cmd.Parameters.AddWithValue("@addresstwo", addressTwo)
cmd.Parameters.AddWithValue("@usertype", userType)
cmd.Parameters.AddWithValue("@dob", dob)
cmd.Parameters.AddWithValue("@email", email)
cmd.Parameters.AddWithValue("@maritialstatus", maritialStatus)
cmd.Parameters.AddWithValue("@username", username)
cmd.Parameters.AddWithValue("@password", password)
Dim imgData As Byte()
imgData = ImgToByteArray(UserImage.Image)
cmd.Parameters.AddWithValue("@loadimage", imgData)
cmd.Parameters.AddWithValue("@state", state)
con.Open()

Page 56 of 96
checkEmailFormat()
cmd.ExecuteNonQuery()
If (userType = "Cashier") Then
Dim cmd2 As New MySqlCommand("CREATE TABLE " & tableName & "(id
INT NOT NULL PRIMARY KEY IDENTITY,date NVARCHAR(50) NULL)", con)
cmd2.ExecuteNonQuery()
End If
con.Close()
clearAll()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
UFinishButton.Enabled = False
SUpdateButton.Enabled = True
SDeleteButton.Enabled = True
End Sub
'If password is not set generate random text and convert to MD5 version
Function GeneratePassword()
'Dim Bytes() As Byte
'Dim s As String =
"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0!1@2#3$4%5^6&7*89"
Dim s As String = "ABCDEFGHIJKLMNOPQRSUVWXYZ"
Dim r As New Random
Dim sb As New StringBuilder
For i As Integer = 1 To 8
Dim idx As Integer = r.Next(0, 25)
sb.Append(s.Substring(idx, 1))
Next
'Bytes = Encoding.Default.GetBytes(sb.ToString)
'Bytes = MD5.Create().ComputeHash(Bytes)
'For x As Integer = 0 To Bytes.Length - 1
' sb.Append(Bytes(x).ToString("x2"))
'Next
Return sb.ToString()
End Function

Protected Overrides Sub Finalize()


MyBase.Finalize()
End Sub

'Send email to the set area


Private Sub sendEmail()
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.UseDefaultCredentials = False
SmtpServer.Credentials = New
Net.NetworkCredential("vbcoder977@gmail.com", "iimscollege")
SmtpServer.Port = 587
SmtpServer.EnableSsl = True
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("vbcoder977@gmail.com")
mail.To.Add(EmailTextBox.Text)
mail.Subject = "Account Created"
mail.Body = "Your account have been created as a " &

Page 57 of 96
UserTypeComboBox.Text & "" & vbNewLine & "Username: " & UserNameTextBox.Text &
"" & vbNewLine & "Password: " & PasswordTextBox.Text
SmtpServer.Send(mail)
MsgBox("Mail has been successfully send to " & EmailTextBox.Text)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub

'load users
Private Sub UserDataGridView_RowHeaderMouseClick(sender As Object, e As
DataGridViewCellMouseEventArgs) Handles UserDataGridView.RowHeaderMouseClick
Dim img() As Byte
Try
img = UserDataGridView.CurrentRow.Cells(14).Value
Dim ms As New MemoryStream(img)
OnlyViewUserPictureBox.Image = Image.FromStream(ms)
Catch ex As Exception
Console.WriteLine("Image not found")

End Try

End Sub

'Search for users


Private Sub searchData(dtv As DataGridView, sql As String, searchTextBox As
MaterialSingleLineTextField, image As PictureBox, pass As
MaterialSingleLineTextField, clear As String)
Dim con As MySqlConnection = dbConnect()
Dim cmd As New MySqlCommand(sql, con)
cmd.Parameters.AddWithValue("@a", searchTextBox.Text + "%")
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
dtv.DataSource = dt
If (searchTextBox.Text = "") Then
image.Image = My.Resources.user_male2_512
If (clear = "searchUser") Then
clearAll()
Else
clearAllStudent()
End If
pass.Text = GeneratePassword()
End If
End Sub
'Searching method and set it to the textbox for user
Private Sub SearchTextBox_TextChanged(sender As Object, e As EventArgs)
Handles SearchTextBox.TextChanged
searchData(AdminUserDataGridView, "SELECT * FROM userTbl WHERE username
LIKE @a AND state = 1", SearchTextBox, UserImage, PasswordTextBox,
"searchUser")
End Sub

'show table data to view


Private Sub AdminUserDataGridView_CellMouseClick(sender As Object, e As
DataGridViewCellMouseEventArgs) Handles AdminUserDataGridView.CellMouseClick

Page 58 of 96
UUpdateButton.Enabled = True
UDeleteButton.Enabled = True
UFinishButton.Enabled = False
userId = AdminUserDataGridView.CurrentRow.Cells(0).Value.ToString()
UserIdTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(0).Value.ToString()
FirstNameTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(1).Value.ToString()
MiddleNameTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(2).Value.ToString()
LastNameTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(3).Value.ToString()
Dim gender As String =
AdminUserDataGridView.CurrentRow.Cells(4).Value.ToString()
If (gender = "Male") Then
MaleRadioBtn.Checked = True
Else
FemaleRadioBtn.Checked = True
End If
ContactNoTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(5).Value.ToString()
Address1TextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(6).Value.ToString()
Address2TextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(7).Value.ToString()
UserTypeComboBox.Text =
AdminUserDataGridView.CurrentRow.Cells(8).Value.ToString()
'DobDateTimePicker.Text =
AdminUserDataGridView.CurrentRow.Cells(9).Value.ToString()
EmailTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(10).Value.ToString()
MaritialStatusComboBox.Text =
AdminUserDataGridView.CurrentRow.Cells(11).Value.ToString()
UserNameTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(12).Value.ToString()
PasswordTextBox.Text =
AdminUserDataGridView.CurrentRow.Cells(13).Value.ToString()

Dim img() As Byte


img = AdminUserDataGridView.CurrentRow.Cells(14).Value
Try
Dim ms As New MemoryStream(img)
UserImage.Image = Image.FromStream(ms)
Catch ex As Exception
Console.WriteLine("Image error")
End Try

End Sub

'update method caller


Private Sub MetroButton1_Click(sender As Object, e As EventArgs) Handles
UUpdateButton.Click
Dim gender As String
If (ContactNoTextBox.Text.Length <> 10) Then
MsgBox("Enter Proper Contact Number")
Return

Page 59 of 96
End If
If Not passvalid(PasswordTextBox.Text) Then
MsgBox("Please Enter Correct Password Format with Min 8 Chars with
atkeast 1 smallchar, 1 CapitalChar, 1 Number, 1 special Char")
Return
End If
If (MaleRadioBtn.Checked) Then
gender = "Male"
Else
gender = "Female"
End If
updateUsers(FirstNameTextBox.Text, MiddleNameTextBox.Text,
LastNameTextBox.Text, gender, ContactNoTextBox.Text, Address1TextBox.Text,
Address2TextBox.Text, UserTypeComboBox.Text, DobDateTimePicker.Text,
EmailTextBox.Text, MaritialStatusComboBox.Text, UserNameTextBox.Text,
PasswordTextBox.Text)
If (SendEmailCheckBox.Checked) Then
sendEmail()
End If
UserImage.Image = My.Resources.user_male2_512
clearAll()
PasswordTextBox.Text = GeneratePassword()
loadUsers("Select * FROM userTbl WHERE state = 1")
End Sub
Public Shared Function ImgToByteArray(img As Image) As Byte()
Dim ms As New MemoryStream()
img.Save(ms, img.RawFormat)
Dim imageBuffer As Byte() = ms.GetBuffer
Return imageBuffer
End Function

'Method to update the existing users


Public Sub updateUsers(ByVal fn As String, ByVal mn As String, ByVal ln As
String, ByVal gender As String, ByVal contactNo As String, ByVal addressOne As
String, ByVal addressTwo As String, ByVal userType As String, ByVal dob As
String, ByVal email As String, ByVal maritialStatus As String, ByVal username
As String, ByVal password As String)
Dim con As MySqlConnection = dbConnect()
If (ContactNoTextBox.Text.Length <> 10) Then
MsgBox("Enter Proper Contact Number")
Return

End If
Try

Dim cmd As New MySqlCommand("UPDATE userTbl SET firstname =


@firstname,middlename = @middlename,lastname = @lastname,gender =
@gender,contact_no = @contact,address_1 = @addressone,address_2 =
@addresstwo,usertype = @usertype,dob = @dob,email = @email,marital_status =
@maritialstatus,username = @username,password = @password,image = @loadimage,
state=@state WHERE userId=@userId", con)

Dim tableName As String = fn & "_user_" & userType & "_" &
contactNo

cmd.Parameters.AddWithValue("@firstname", fn)

Page 60 of 96
cmd.Parameters.AddWithValue("@middlename", mn)
cmd.Parameters.AddWithValue("@lastname", ln)
cmd.Parameters.AddWithValue("@gender", gender)
cmd.Parameters.AddWithValue("@contact", contactNo)
cmd.Parameters.AddWithValue("@addressone", addressOne)
cmd.Parameters.AddWithValue("@addresstwo", addressTwo)
cmd.Parameters.AddWithValue("@usertype", userType)
cmd.Parameters.AddWithValue("@dob", dob)
cmd.Parameters.AddWithValue("@email", email)
cmd.Parameters.AddWithValue("@maritialstatus", maritialStatus)
cmd.Parameters.AddWithValue("@username", username)
cmd.Parameters.AddWithValue("@password", password)
Dim imgData As Byte()
imgData = ImgToByteArray(UserImage.Image)
cmd.Parameters.AddWithValue("@loadimage", imgData)
cmd.Parameters.AddWithValue("@state", state)
cmd.Parameters.AddWithValue("@userId", userId)
con.Open()
cmd.ExecuteNonQuery()

If (userType = "Cashier") Then


Dim cmd2 As New MySqlCommand("CREATE TABLE " & tableName & "(id
INT NOT NULL PRIMARY KEY IDENTITY,date NVARCHAR(50) NULL)", con)
cmd2.ExecuteNonQuery()
End If
con.Close()
refreshUsers()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

'Sub method to delete the selected user


Sub deleteUsers()
Try
Dim con As MySqlConnection = dbConnect()
Dim cmd As New MySqlCommand("UPDATE userTbl SET state = @state
WHERE userId=@userId", con)
Dim passive As Integer = 0
cmd.Parameters.AddWithValue("@state", passive)
cmd.Parameters.AddWithValue("@userId", userId)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

'Delete method caller


Private Sub DeleteBtn_Click(sender As Object, e As EventArgs) Handles
UDeleteButton.Click
deleteUsers()
refreshUsers()
UserImage.Image = My.Resources.user_male2_512
clearAll()

Page 61 of 96
PasswordTextBox.Text = GeneratePassword()
End Sub

'Çheck contact format


Sub contactNoChecker()
Dim chars() As Char = ContactNoTextBox.Text
If (ContactNoTextBox.TextLength > 10) Then
PhoneNoValidateLabel.Text = "Only 10 Digit phone number" +
vbNewLine + "Eg: 9808546858"
Else
PhoneNoValidateLabel.Text = ""
End If
For Each c As Char In chars
If Not IsNumeric(c) Then
PhoneNoValidateLabel.Text = "Numbers only allowed"
End If
Next
End Sub

Private Sub ContactNoTextBox_TextChanged(sender As Object, e As EventArgs)


Handles ContactNoTextBox.TextChanged
contactNoChecker()
End Sub

'Check email format


Sub checkEmailFormat()
Dim strMessage As String = ""
Dim regex As Regex = New Regex("^[_a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.
[a-z0-9-]+)*(.[a-z]{2,4})$")
Dim IsMatch As Boolean = regex.IsMatch(EmailTextBox.Text)
If IsMatch Then
EmailValidateLabel.Text = ""
Else
EmailValidateLabel.Text = "Invalid format"
If (EmailTextBox.Text = "") Then
EmailValidateLabel.Text = ""
End If
End If
End Sub

Private Sub EmailTextBox_TextChanged(sender As Object, e As EventArgs)


Handles EmailTextBox.TextChanged
checkEmailFormat()
End Sub

Private Sub AddUserTab_Click(sender As Object, e As EventArgs) Handles


AddUserTab.Click

End Sub

Private Sub ClearAllBtn_Click(sender As Object, e As EventArgs) Handles


UClearAllButton.Click
clearAll()
PasswordTextBox.Text = GeneratePassword()
center(OnlyViewUserPictureBox)
End Sub

Page 62 of 96
Sub center(ByVal a As PictureBox)
a.Left = (a.Parent.Width \ 2) - (a.Width \ 2)
End Sub

Sub refreshStudents()
Dim dt As DataTable = loadUsers("SELECT * FROM stuTbl WHERE state = 1")
AdminStudentDataGridView.DataSource = dt
End Sub

Private Sub SubmitButton_Click(sender As Object, e As EventArgs) Handles


SSubmitButton.Click
If (PhoneNoTextBoxs.Text.Length <> 10) Then
MsgBox("Enter Proper Contact Number")
Return
End If
If Not passvalid(StudentPasswordTextBoxs.Text) Then
MsgBox("Please Enter Correct Password Format with Min 8 Chars with
atkeast 1 smallchar, 1 CapitalChar, 1 Number, 1 special Char")
Return
End If
If (semcombo.SelectedIndex = -1 Or StudentIdTextBox.Text = "" Or
CourseComboBoxs.SelectedIndex = -1 Or StudentUsernameTextBoxs.Text = "" Or
StudentPasswordTextBoxs.Text = "") Then
MsgBox("Please fill Mandatory fields")
Else
insertStudent(StudentIdTextBox.Text, FirstNameTextBoxs.Text,
MiddleNameTextBoxs.Text, LastNameTextBoxes.Text, CurrentAddressTextBoxs.Text,
PermanentAddressTextBoxs.Text, DistrictTextBoxs.Text, PhoneNoTextBoxs.Text,
EmailAddressTextBoxs.Text, Dobs.Text, GenderComboBoxs.Text,
GuardianNameTextBoxs.Text, GuardianContactTextBoxs.Text, ReligionTextBoxs.Text,
MaritialStatusComboBoxs.Text, LanguageTextBoxs.Text, CourseComboBoxs.Text,
ScholarshipComboBoxs.Text, StudentUsernameTextBoxs.Text,
StudentPasswordTextBoxs.Text, semcombo.Text)

End If
End Sub
Public Sub insertStudent(ByVal Id As String, ByVal fn As String, ByVal mn
As String, ByVal ln As String, ByVal cadd As String, ByVal padd As String,
ByVal dis As String, ByVal phno As String, ByVal email As String, ByVal dob As
String, ByVal gender As String, ByVal gn As String, ByVal gcno As String, ByVal
reli As String, ByVal mstatus As String, ByVal lan As String, ByVal cour As
String, ByVal scholor As String, ByVal uname As String, ByVal pass As String,
ByVal sem As String)
Dim con As MySqlConnection = dbConnect()
Try
Dim cmd As New MySqlCommand("INSERT INTO stuTbl
values(@Id,@fname,@mname,@lname,@caddress,@paddress,@district,@phoneno,@email,@
dob,@gender,@gname,@gcontactno,@religion,@mstatus,@language,@course,@scholorshi
p,@username,@password,@state,@image,@usertype,@sem)", con)
cmd.Parameters.AddWithValue("@Id", Id)
cmd.Parameters.AddWithValue("@fname", fn)
cmd.Parameters.AddWithValue("@mname", mn)
cmd.Parameters.AddWithValue("@lname", ln)
cmd.Parameters.AddWithValue("@caddress", cadd)
cmd.Parameters.AddWithValue("@paddress", padd)

Page 63 of 96
cmd.Parameters.AddWithValue("@district", dis)
cmd.Parameters.AddWithValue("@phoneno", phno)
cmd.Parameters.AddWithValue("@email", email)
cmd.Parameters.AddWithValue("@dob", dob)
cmd.Parameters.AddWithValue("@gender", gender)
cmd.Parameters.AddWithValue("@gname", gn)
cmd.Parameters.AddWithValue("@gcontactno", gcno)
cmd.Parameters.AddWithValue("@religion", reli)
cmd.Parameters.AddWithValue("@mstatus", mstatus)
cmd.Parameters.AddWithValue("@language", lan)
cmd.Parameters.AddWithValue("@course", cour)
cmd.Parameters.AddWithValue("@scholorship", scholor)
cmd.Parameters.AddWithValue("@username", uname)
cmd.Parameters.AddWithValue("@password", pass)
cmd.Parameters.AddWithValue("@state", state)
Dim imgData As Byte()
imgData = ImgToByteArray(StudentImage.Image)
cmd.Parameters.AddWithValue("@image", imgData)
cmd.Parameters.AddWithValue("@usertype", studentUserType)
cmd.Parameters.AddWithValue("@sem", sem)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
SSubmitButton.Enabled = False
SUpdateButton.Enabled = True
SDeleteButton.Enabled = True
StudentPasswordTextBoxs.Text = GeneratePassword()
refreshStudents()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Sub loadPrograms()
Dim programData As DataTable = loadUsers("SELECT * FROM tblPrograms")
CourseComboBoxs.DataSource = programData
CourseComboBoxs.DataSource = programData
CourseComboBoxs.DisplayMember = "program_name"
CourseComboBoxs.ValueMember = "Id"
End Sub

Private Sub UpdateButton_Click(sender As Object, e As EventArgs) Handles


SUpdateButton.Click
If (PhoneNoTextBoxs.Text.Length <> 10) Then
MsgBox("Enter Proper Contact Number")
Return
End If
If Not passvalid(StudentPasswordTextBoxs.Text) Then
MsgBox("Please Enter Correct Password Format with Min 8 Chars with
atkeast 1 smallchar, 1 CapitalChar, 1 Number, 1 special Char")
Return
End If
updateStudent(FirstNameTextBoxs.Text, MiddleNameTextBoxs.Text,
LastNameTextBoxes.Text, CurrentAddressTextBoxs.Text,
PermanentAddressTextBoxs.Text, DistrictTextBoxs.Text, PhoneNoTextBoxs.Text,
EmailAddressTextBoxs.Text, Dobs.Text, GenderComboBoxs.Text,

Page 64 of 96
GuardianNameTextBoxs.Text, GuardianContactTextBoxs.Text, ReligionTextBoxs.Text,
MaritialStatusComboBoxs.Text, LanguageTextBoxs.Text, CourseComboBoxs.Text,
ScholarshipComboBoxs.Text, StudentUsernameTextBoxs.Text,
StudentPasswordTextBoxs.Text, semcombo.Text)
End Sub
Public Sub updateStudent(ByVal fn As String, ByVal mn As String, ByVal ln
As String, ByVal cadd As String, ByVal padd As String, ByVal dis As String,
ByVal phno As String, ByVal email As String, ByVal dob As String, ByVal gender
As String, ByVal gn As String, ByVal gcno As String, ByVal reli As String,
ByVal mstatus As String, ByVal lan As String, ByVal cour As String, ByVal
scholor As String, ByVal uname As String, ByVal pass As String, ByVal sem As
String)
Dim con As MySqlConnection = dbConnect()

Try
Dim cmd As New MySqlCommand("UPDATE stuTbl SET fname= @fname,mname=
@mname,lname= @lname,caddress= @caddress,paddress= @paddress,district=
@district,phoneno= @phoneno,email= @email,dob= @dob,gender= @gender,gname=
@gname,gcontactno= @gcontactno,religion= @religion,mstatus= @mstatus,language=
@language,course= @course,scholorship= @scholorship,username=
@username,password= @password,image=@image,sem=@sem WHERE userId = @stuId",
con)
cmd.Parameters.AddWithValue("@fname", fn)
cmd.Parameters.AddWithValue("@mname", mn)
cmd.Parameters.AddWithValue("@lname", ln)
cmd.Parameters.AddWithValue("@caddress", cadd)
cmd.Parameters.AddWithValue("@paddress", padd)
cmd.Parameters.AddWithValue("@district", dis)
cmd.Parameters.AddWithValue("@phoneno", phno)
cmd.Parameters.AddWithValue("@email", email)
cmd.Parameters.AddWithValue("@dob", dob)
cmd.Parameters.AddWithValue("@gender", gender)
cmd.Parameters.AddWithValue("@gname", gn)
cmd.Parameters.AddWithValue("@gcontactno", gcno)
cmd.Parameters.AddWithValue("@religion", reli)
cmd.Parameters.AddWithValue("@mstatus", mstatus)
cmd.Parameters.AddWithValue("@language", lan)
cmd.Parameters.AddWithValue("@course", cour)
cmd.Parameters.AddWithValue("@scholorship", scholor)
cmd.Parameters.AddWithValue("@username", uname)
cmd.Parameters.AddWithValue("@password", pass)
cmd.Parameters.AddWithValue("@stuId", stuId)
Dim imgData As Byte()
imgData = ImgToByteArray(StudentImage.Image)
cmd.Parameters.AddWithValue("@image", imgData)
cmd.Parameters.AddWithValue("@image", imgData)
cmd.Parameters.AddWithValue("@sem", sem)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
StudentPasswordTextBoxs.Text = GeneratePassword()
refreshStudents()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Page 65 of 96
'search method call to search for students
Private Sub SearchStudentsTextBox_Click(sender As Object, e As EventArgs)
Handles SearchStudentsTextBox.TextChanged
searchData(AdminStudentDataGridView, "SELECT * FROM stuTbl WHERE
username LIKE @a AND state = 1", SearchStudentsTextBox, StudentImage,
StudentPasswordTextBoxs, "searchStudent")
End Sub

Private Sub AdminStudentDataGridView_CellMouseClick(sender As Object, e As


DataGridViewCellMouseEventArgs) Handles AdminStudentDataGridView.CellMouseClick
SUpdateButton.Enabled = True
SDeleteButton.Enabled = True
SSubmitButton.Enabled = False
stuId = AdminStudentDataGridView.CurrentRow.Cells(0).Value.ToString()
StudentIdTextBox.Text =
AdminStudentDataGridView.CurrentRow.Cells(0).Value.ToString()
FirstNameTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(1).Value.ToString()
MiddleNameTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(2).Value.ToString()
LastNameTextBoxes.Text =
AdminStudentDataGridView.CurrentRow.Cells(3).Value.ToString()
CurrentAddressTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(4).Value.ToString()
PermanentAddressTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(5).Value.ToString()
DistrictTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(6).Value.ToString()
PhoneNoTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(7).Value.ToString()
EmailAddressTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(8).Value.ToString()
'Dobs.Text =
AdminStudentDataGridView.CurrentRow.Cells(9).Value.ToString().to
GenderComboBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(10).Value.ToString()
GuardianNameTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(11).Value.ToString()
GuardianContactTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(12).Value.ToString()
ReligionTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(13).Value.ToString()
MaritialStatusComboBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(14).Value.ToString()
LanguageTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(15).Value.ToString()
CourseComboBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(16).Value.ToString()
ScholarshipComboBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(17).Value.ToString()
StudentUsernameTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(18).Value.ToString()
StudentPasswordTextBoxs.Text =
AdminStudentDataGridView.CurrentRow.Cells(19).Value.ToString()
Try

Page 66 of 96
Dim img() As Byte
img = AdminStudentDataGridView.CurrentRow.Cells(21).Value
Dim ms As New MemoryStream(img)
StudentImage.Image = Image.FromStream(ms)
Catch ex As Exception
Console.WriteLine("Image is not found")
End Try

End Sub

Private Sub CourseComboBoxs_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles CourseComboBoxs.SelectedIndexChanged

End Sub

Private Sub CourseComboBoxs_MouseClick(sender As Object, e As


MouseEventArgs) Handles CourseComboBoxs.MouseClick
loadPrograms()
End Sub

Private Sub SDeleteButton_Click(sender As Object, e As EventArgs) Handles


SDeleteButton.Click
deleteStudents()
refreshStudents()
End Sub
Sub deleteStudents()
Try
Dim con As MySqlConnection = dbConnect()
Dim cmd As New MySqlCommand("UPDATE stuTbl SET state = @state WHERE
userId=@stuId", con)
Dim passive As Integer = 0
cmd.Parameters.AddWithValue("@state", passive)
cmd.Parameters.AddWithValue("@stuId", stuId)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
Dim r As RecycleBin = New RecycleBin
r.loadUsers()
End Try
End Sub

Private Sub MaterialTabSelector1_Click(sender As Object, e As EventArgs)


Handles MaterialTabSelector1.Click
Try
Dim dt As DataTable = loadUsers("select count(*) from stutbl")

Catch ex As Exception

End Try
End Sub

Private Sub AdminUserDataGridView_CellContentClick(sender As Object, e As

Page 67 of 96
DataGridViewCellEventArgs) Handles AdminUserDataGridView.CellContentClick

End Sub

Private Sub SClearAllButton_Click(sender As Object, e As EventArgs) Handles


SClearAllButton.Click
clearAllStudent()
End Sub
End Class

Page 68 of 96
PROGRAM AND SUBJECTS
Imports MySqlConnector

Public Class ProgramAndSubjects


Dim su As New AddRemoveStudentStaff
Dim con As MySqlConnection = su.dbConnect()

Public Sub New()

' This call is required by the designer.


InitializeComponent()

' Add any initialization after the InitializeComponent() call.

End Sub

Sub loadPrograms()
Dim programData As DataTable = su.loadUsers("SELECT * FROM tblPrograms")
ProgramDataGridView.DataSource = programData
ProgramComboBox.DataSource = programData
ProgramComboBox.DisplayMember = "program_name"
ProgramComboBox.ValueMember = "Id"
End Sub
Sub Loadfaculty()
Dim prgdata As DataTable = su.loadUsers("select * from usertbl where usertype like 'Lecturer'")
facultycombo.DataSource = prgdata
facultycombo.DisplayMember = "firstname"
facultycombo.ValueMember = "userId"

End Sub
Function checkIfProgramExist() As Boolean
Dim cmd As New MySqlCommand("SELECT * FROM tblPrograms WHERE program_name=@a", con)
cmd.Parameters.AddWithValue("@a", ProgramNameTextBox.Text)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
If (dt.Rows.Count > 0) Then
Return False
End If
Return True
End Function
Sub AddPrograms()
If (checkIfProgramExist() = True) Then
Dim cmd As New MySqlCommand("INSERT INTO tblPrograms VALUES(@a,@b)", con)
Dim cmd2 As New MySqlCommand("CREATE TABLE tbl" & ProgramNameTextBox.Text & "(subject_id NVARCHAR(50)
NULL,subject_name NVARCHAR(50) NOT NULL, subject_description NVARCHAR(50) NULL,facultyname NVARCHAR(50)
NULL,sem NVARCHAR(2) NOT NULL)", con)
cmd.Parameters.AddWithValue("@a", ProgramNameTextBox.Text)
cmd.Parameters.AddWithValue("@b", ProgramDetailRichTextBox.Text)
con.Open()
cmd.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
con.Close()
Else
MsgBox("Given course already exist")
End If
End Sub

Private Sub AddProgramBtn_Click(sender As Object, e As EventArgs) Handles AddProgramBtn.Click


AddPrograms()
loadPrograms()
End Sub
Private Sub ProgramAndSubjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load
loadPrograms()
Loadfaculty()

Page 69 of 96
End Sub
Sub loadSubjects()
Dim a As String = "SELECT * FROM tbl" & ProgramComboBox.Text
Dim cmd As New MySqlCommand(a, con)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
SubjectDataGridView.DataSource = dt
End Sub
Sub addSubjects()
Dim cmd As New MySqlCommand("INSERT INTO tbl" & ProgramComboBox.Text & " VALUES(@a,@b,@c,@d,@e)", con)
cmd.Parameters.AddWithValue("@a", SubjectIdTextBox.Text)
cmd.Parameters.AddWithValue("@b", SubjectNameTextBox.Text)
cmd.Parameters.AddWithValue("@c", SubjectDetailRichTextBox.Text)
cmd.Parameters.AddWithValue("@d", facultycombo.Text)
cmd.Parameters.AddWithValue("@e", semcombo.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
loadSubjects()
End Sub

Private Sub addsubjectbtn_click(sender As Object, e As EventArgs) Handles AddSubjectBtn.Click


addSubjects()
loadSubjects()
End Sub

Private Sub ProgramComboBox_Click(sender As Object, e As EventArgs) Handles ProgramComboBox.Click


loadSubjects()
End Sub

Private Sub Panel2_Paint(sender As Object, e As PaintEventArgs) Handles Panel2.Paint

End Sub

Private Sub ProgramComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


ProgramComboBox.SelectedIndexChanged

End Sub

Private Sub UpdateSubjectBtn_Click(sender As Object, e As EventArgs) Handles UpdateSubjectBtn.Click

End Sub

'Private Sub ProgramComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


ProgramComboBox.SelectedIndexChanged
' loadSubjects()
'End Sub
End Class

Page 70 of 96
ATTENDANCE
Imports MySqlConnector

Public Class Attendance


Dim Id As Integer
Dim su As AddRemoveStudentStaff = New AddRemoveStudentStaff
Dim utypes, fnames As String

Public Sub New(utype As String, fname As String)

' This call is required by the designer.


InitializeComponent()
utypes = utype
fnames = fname
If (utypes.Equals("Lecturer")) Then
UpdateButton.Visible = False
End If

' Add any initialization after the InitializeComponent() call.

End Sub

Sub loadsubs()
Dim cmd As String = "select subject_name from tbl" & AttenProgramComboBox.Text & " where facultyname ='" & fnames & "'
and sem =" & Semcombo.Text & ";"

Dim programData As DataTable = su.loadUsers(cmd)


daycombo.DataSource = programData
daycombo.DisplayMember = "subject_name"

End Sub
Sub searchID()
Dim sql As String = "SELECT * FROM attendanceTbl WHERE userId LIKE @a"
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand(sql, con)
cmd.Parameters.AddWithValue("@a", AttSearchTextBox.Text)
Dim da As New MySqlDataAdapter(cmd)
Dim dts As New DataTable()
da.Fill(dts)
AttendanceDataGridView.DataSource = dts
If (AttSearchTextBox.Text = "") Then
loadUsers()
End If
End Sub

Sub loadPrograms()
Dim programData As DataTable = su.loadUsers("SELECT * FROM tblPrograms")
AttenProgramComboBox.DataSource = programData
AttenProgramComboBox.DisplayMember = "program_name"
AttenProgramComboBox.ValueMember = "Id"
End Sub

Sub loadall()
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("SELECT * FROM attendanceTbl where userId = @a AND PA = @b", con)
cmd.Parameters.AddWithValue("@a", Id)
cmd.Parameters.AddWithValue("@b", "Present")
Dim da As New MySqlDataAdapter(cmd)
Dim dts As New DataTable()
da.Fill(dts)
If (dts.Rows.Count > 0) Then
PresentDaysLabel.Text = dts.Rows.Count & " days present"
End If
Dim cmd2 As New MySqlCommand("SELECT * FROM attendanceTbl where userId = @a AND PA = @b", con)

Page 71 of 96
cmd2.Parameters.AddWithValue("@a", Id)
cmd2.Parameters.AddWithValue("@b", "Absent")
Dim da2 As New MySqlDataAdapter(cmd2)
Dim dts2 As New DataTable()
da2.Fill(dts2)
If (dts2.Rows.Count > 0) Then
AbsentDaysLabel.Text = dts2.Rows.Count & " days absent"
End If
End Sub
Sub loadUsers()
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("SELECT * FROM attendanceTbl WHERE Date = @a AND program = @b AND sem = @c
AND period = @d", con)
cmd.Parameters.AddWithValue("@a", MetroDateTime1.Text)
cmd.Parameters.AddWithValue("@b", AttenProgramComboBox.Text)
cmd.Parameters.AddWithValue("@c", Semcombo.Text)
cmd.Parameters.AddWithValue("@d", periodcombo.Text)
Dim da As New MySqlDataAdapter(cmd)
Dim dts As New DataTable()
da.Fill(dts)
If (dts.Rows.Count > 0) Then
AttendanceDataGridView.Columns(0).Visible = False

AttendanceDataGridView.DataSource = dts
updated()
Else
Dim cmd2 As New MySqlCommand("Select userId,fname FROM stuTbl WHERE state = 1 AND course = @a AND sem = @b",
con)
cmd2.Parameters.AddWithValue("@a", AttenProgramComboBox.Text)
cmd2.Parameters.AddWithValue("@b", Semcombo.Text)
Dim da2 As New MySqlDataAdapter(cmd2)
Dim dts2 As New DataTable()
da2.Fill(dts2)
AttendanceDataGridView.DataSource = dts2
End If

End Sub
Sub updated()
For Each row As DataGridViewRow In AttendanceDataGridView.Rows
If (row.Cells("PA").Value = "Present") Then
row.Cells("PACheckBoxColumn").Value = True
Else
row.Cells("PACheckBoxColumn").Value = False
End If
Next
End Sub

Sub checkedAttendance()
For i = 0 To AttendanceDataGridView.RowCount - 1
AttendanceDataGridView.Rows(i).Cells(0).Value = True
Next
End Sub

Private Sub Attendance_Load(sender As Object, e As EventArgs) Handles MyBase.Load


loadPrograms()
loadUsers()

End Sub
Sub sendValue()

For Each row As DataGridViewRow In AttendanceDataGridView.Rows


Dim isSelected As Boolean = Convert.ToBoolean(row.Cells("PACheckBoxColumn").Value)
If isSelected Then

Page 72 of 96
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("INSERT INTO attendanceTbl VALUES(@a,@b,@c,@d,@e,@f,@g,@h)", con)
cmd.Parameters.AddWithValue("@a", row.Cells("userId").Value)
cmd.Parameters.AddWithValue("@b", row.Cells("fname").Value)
cmd.Parameters.AddWithValue("@c", "Present")
cmd.Parameters.AddWithValue("@d", MetroDateTime1.Text)
cmd.Parameters.AddWithValue("@e", AttenProgramComboBox.Text)
cmd.Parameters.AddWithValue("@f", Semcombo.Text)
cmd.Parameters.AddWithValue("@g", daycombo.Text)
cmd.Parameters.AddWithValue("@h", periodcombo.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Else
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("INSERT INTO attendanceTbl VALUES(@a,@b,@c,@d,@e,@f,@g,@h)", con)
cmd.Parameters.AddWithValue("@a", row.Cells("userId").Value)
cmd.Parameters.AddWithValue("@b", row.Cells("fname").Value)
cmd.Parameters.AddWithValue("@c", "Absent")
cmd.Parameters.AddWithValue("@d", MetroDateTime1.Text)
cmd.Parameters.AddWithValue("@e", AttenProgramComboBox.Text)
cmd.Parameters.AddWithValue("@f", Semcombo.Text)
cmd.Parameters.AddWithValue("@g", daycombo.Text)
cmd.Parameters.AddWithValue("@h", periodcombo.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End If

Next

End Sub

Private Sub MetroDateTime1_ValueChanged(sender As Object, e As EventArgs) Handles MetroDateTime1.ValueChanged


loadUsers()
End Sub

Private Sub Button1_Click_2(sender As Object, e As EventArgs)


updated()
End Sub

Sub updates()
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("UPDATE attendanceTbl SET PA = @a WHERE userId = @b AND Date = @c", con)
Dim pa As String
If (AttendanceDataGridView.CurrentRow.Cells(0).Value = True) Then
pa = "Present"
Else
pa = "Absent"
End If
cmd.Parameters.AddWithValue("@a", pa)
cmd.Parameters.AddWithValue("@b", Id)
cmd.Parameters.AddWithValue("@c", MetroDateTime1.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
loadUsers()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles UpdateButton.Click


updates()
End Sub

Private Sub AddButton_Click(sender As Object, e As EventArgs) Handles AddButton.Click

Page 73 of 96
If (AttenProgramComboBox.Text = "" Or Semcombo.Text = "" Or periodcombo.Text = "") Then
MsgBox("Please Select all the details!")
Else
sendValue()
loadUsers()
End If

End Sub

Private Sub MaterialRaisedButton1_Click(sender As Object, e As EventArgs) Handles MaterialRaisedButton1.Click


checkedAttendance()
End Sub

Private Sub AttendanceDataGridView_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles


AttendanceDataGridView.CellClick
Id = Convert.ToInt32(AttendanceDataGridView.CurrentRow.Cells(1).Value.ToString())
loadall()
End Sub

Private Sub AttenProgramComboBox_MouseClick(sender As Object, e As MouseEventArgs) Handles


AttenProgramComboBox.MouseClick
loadPrograms()
End Sub

Private Sub AttenProgramComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


AttenProgramComboBox.SelectedIndexChanged
loadUsers()
End Sub

Private Sub AttSearchTextBox_TextChanged(sender As Object, e As EventArgs) Handles AttSearchTextBox.TextChanged


searchID()
End Sub

Private Sub MaterialRaisedButton2_Click(sender As Object, e As EventArgs) Handles MaterialRaisedButton2.Click


If (AttenProgramComboBox.Text = "" Or Semcombo.Text = "" Or periodcombo.Text = "") Then
MsgBox("Please Select all the details to search")
Else
loadUsers()

End If
End Sub

End Class

Page 74 of 96
TIMETABLE

Imports System.Diagnostics.Eventing.Reader
Imports System.Threading
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports MetroFramework.Controls
Imports MySqlConnector

Public Class Result


Dim su As AddRemoveStudentStaff = New AddRemoveStudentStaff
Dim utypes, unames, stucourse, stusem, fnames As String
Private Sub Result_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
If (utypes = "Student") Then
Panel1.Visible = False
Dim con As MySqlConnection = su.dbConnect()
Dim cmd2 As New MySqlCommand("SELECT * FROM stuTbl WHERE username=
@a", con)
cmd2.Parameters.AddWithValue("@a", unames)
Dim da As New MySqlDataAdapter(cmd2)
Dim dt As New DataTable()
da.Fill(dt)
stucourse = dt.Rows(0).Item("course")
stusem = dt.Rows(0).Item("sem")
ElseIf (utypes = "Lecturer") Then
Panel1.Visible = False
Lecturer_load()

End If

loadPrograms()
loadsems()

End Sub

Sub Lecturer_load()

Dim query As String = "SELECT CONCAT(tblbca.subject_name, ' : ',


tblbca.sem, ' : ', 'BCA') AS subject_details,
day,
CASE
WHEN 1st = tblbca.subject_name THEN '1st'
WHEN 2nd = tblbca.subject_name THEN '2nd'
WHEN 3rd = tblbca.subject_name THEN '3rd'
WHEN 4th = tblbca.subject_name THEN '4th'
WHEN 5th = tblbca.subject_name THEN '5th'
WHEN 6th = tblbca.subject_name THEN '6th'
WHEN 7th = tblbca.subject_name THEN '7th'
ELSE ''
END AS period_time
FROM timetable
JOIN tblbca ON tblbca.facultyname = @fname AND (tblbca.subject_name = 1st OR
tblbca.subject_name = 2nd OR tblbca.subject_name = 3rd OR tblbca.subject_name =
4th OR tblbca.subject_name = 5th OR tblbca.subject_name = 6th OR

Page 75 of 96
tblbca.subject_name = 7th)
ORDER BY FIELD(period_time, '1st', '2nd', '3rd', '4th', '5th', '6th', '7th'),
FIELD(day, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
"

Dim conn As MySqlConnection = su.dbConnect()


Dim command As MySqlCommand = New MySqlCommand(query, conn)
command.Parameters.AddWithValue("@fname", fnames)

Try
conn.Open()
Dim adapter As MySqlDataAdapter = New MySqlDataAdapter(command)
Dim resultTable As DataTable = New DataTable()
adapter.Fill(resultTable)

' Create a new DataTable to hold the timetable data

' Assuming you have the query result stored in a DataTable named
"resultTable"
Dim days As String() = {"monday", "tuesday", "wednesday",
"thursday", "friday"}
Dim periods As String() = {"1st", "2nd", "3rd", "4th", "5th",
"6th", "7th"}

' Create a new DataTable to store the timetable data


Dim timetableTable As New DataTable()
timetableTable.Columns.Add("Period", GetType(String))
For Each day In days
timetableTable.Columns.Add(day, GetType(String))
Next

' Populate the timetable table with the data from the result set
For Each period In periods
Dim row As DataRow = timetableTable.NewRow()
row("Period") = period
For Each day In days
Dim matchingRows() As DataRow = resultTable.Select("day =
'" & day & "' AND period_time = '" & period & "'")
If matchingRows.Length > 0 Then
row(day) = matchingRows(0)("subject_details")
Else
row(day) = ""
End If
Next
timetableTable.Rows.Add(row)
Next

' Bind the timetable table to the DataGridView


TTgrid.DataSource = timetableTable

Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
Finally
conn.Close()
End Try

Page 76 of 96
End Sub

Sub LoadSubs()
'Dim sql As String = "SELECT subject_name from tbl" & coursetxt.Text &
" WHERE sem LIKE " & semtxt.Text
'Dim prgdata As DataTable = su.loadUsers(sql)
'cb1.DataSource = prgdata
'Dim cbs() = {cb1, cb2, cb3, cb4, cb5, cb6, cb7}
'For Each cb In cbs
' cb.DataSource = prgdata
' cb.DisplayMember = "subject_name"
'Next
Dim sql As String = "SELECT subject_name from tbl" & coursetxt.Text & "
WHERE sem LIKE " & semtxt.Text
Dim prgdata1, prgdata2, prgdata3, prgdata4, prgdata5, prgdata6,
prgdata7 As DataTable
prgdata1 = su.loadUsers(sql)
prgdata2 = su.loadUsers(sql)
prgdata3 = su.loadUsers(sql)
prgdata4 = su.loadUsers(sql)
prgdata5 = su.loadUsers(sql)
prgdata6 = su.loadUsers(sql)
prgdata7 = su.loadUsers(sql)
Dim prgs() = {prgdata1, prgdata2, prgdata3, prgdata4, prgdata5,
prgdata6, prgdata7}
Dim cbs() = {cb1, cb2, cb3, cb4, cb5, cb6, cb7}
Dim i As Integer
For i = 0 To 6
cbs(i).DataSource = prgs(i)
cbs(i).DisplayMember = "subject_name"
Next

End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles
Label1.Click

End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles Coursescombo.SelectedIndexChanged

End Sub

Sub loadPrograms()
If (utypes = "Student") Then
Coursescombo.Items.Add(stucourse)

Else
Dim programData As DataTable = su.loadUsers("SELECT * FROM
tblPrograms")
Coursescombo.DataSource = programData
Coursescombo.DisplayMember = "program_name"
Coursescombo.ValueMember = "Id"
End If

Page 77 of 96
End Sub
Sub loadsems()
If (utypes = "Student") Then
Semcombo.Items.Add(stusem)
Else
Semcombo.Items.Add(1)
Semcombo.Items.Add(2)
Semcombo.Items.Add(3)
Semcombo.Items.Add(4)
Semcombo.Items.Add(5)
Semcombo.Items.Add(6)
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
searchTT()

End Sub

Public Sub New(utype As String, uname As String, fname As String)

' This call is required by the designer.


InitializeComponent()
utypes = utype
unames = uname
fnames = fname

' Add any initialization after the InitializeComponent() call.

End Sub

Sub searchTT()
Dim days() As String = {"monday", "tuesday", "wednesday", "thursday",
"friday", "saturday"}
'Dim grids() = {Mongrid, Tuesgrid, Wedgrid, Thurgrid, Frigrid, Satgrid}
'Dim i As Integer
Dim sql As String = "SELECT UPPER(day) as
DAY,1st,2nd,3rd,4th,5th,6th,7th FROM timetable WHERE course LIKE @a and sem
LIKE @b"
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand(sql, con)
cmd.Parameters.AddWithValue("@a", Coursescombo.Text)
cmd.Parameters.AddWithValue("@b", Semcombo.Text)
'cmd.Parameters.AddWithValue("@c", days(i))
Dim da As New MySqlDataAdapter(cmd)
Dim dts As New DataTable()
da.Fill(dts)
TTgrid.DataSource = dts
If (Coursescombo.Text = "") Then
loadPrograms()
End If

Page 78 of 96
End Sub

Private Sub TTgrid_CellContentClick(sender As Object, e As


DataGridViewCellEventArgs) Handles TTgrid.CellContentClick

Try
coursetxt.Text = Coursescombo.Text
semtxt.Text = Semcombo.Text
daytxt.Text = TTgrid.CurrentRow.Cells(0).Value.ToString()
LoadSubs()
firsttxt.Text = TTgrid.CurrentRow.Cells(1).Value.ToString()
secondtxt.Text = TTgrid.CurrentRow.Cells(1).Value.ToString()
thirdtxt.Text = TTgrid.CurrentRow.Cells(2).Value.ToString()
fourthtxt.Text = TTgrid.CurrentRow.Cells(3).Value.ToString()
fifthtxt.Text = TTgrid.CurrentRow.Cells(4).Value.ToString()
sixthtxt.Text = TTgrid.CurrentRow.Cells(5).Value.ToString()
seventhtxt.Text = TTgrid.CurrentRow.Cells(6).Value.ToString()

Catch ex As Exception
MsgBox(ex)

End Try

End Sub

Private Sub TTgrid_CellClick(sender As Object, e As


DataGridViewCellEventArgs) Handles TTgrid.CellClick

Try
coursetxt.Text = Coursescombo.Text
semtxt.Text = Semcombo.Text
daytxt.Text = TTgrid.CurrentRow.Cells(0).Value.ToString()
LoadSubs()
firsttxt.Text = TTgrid.CurrentRow.Cells(1).Value.ToString()
secondtxt.Text = TTgrid.CurrentRow.Cells(1).Value.ToString()
thirdtxt.Text = TTgrid.CurrentRow.Cells(2).Value.ToString()
fourthtxt.Text = TTgrid.CurrentRow.Cells(3).Value.ToString()
fifthtxt.Text = TTgrid.CurrentRow.Cells(4).Value.ToString()
sixthtxt.Text = TTgrid.CurrentRow.Cells(5).Value.ToString()
seventhtxt.Text = TTgrid.CurrentRow.Cells(6).Value.ToString()

Catch ex As Exception
MsgBox(ex)

End Try

Page 79 of 96
End Sub

Private Sub cb1_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cb1.SelectedIndexChanged

Dim selectedRow As DataRowView = DirectCast(cb1.SelectedItem,


DataRowView)
firsttxt.Text = selectedRow("subject_name").ToString()
End Sub

Private Sub cb2_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cb2.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb2.SelectedItem,
DataRowView)
secondtxt.Text = selectedRow("subject_name").ToString()
End Sub
Private Sub cb3_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cb3.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb3.SelectedItem,
DataRowView)
thirdtxt.Text = selectedRow("subject_name").ToString()
End Sub
Private Sub cb4_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cb4.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb4.SelectedItem,
DataRowView)
fourthtxt.Text = selectedRow("subject_name").ToString()
End Sub

Private Sub Clear_Click(sender As Object, e As EventArgs) Handles


Clear.Click
coursetxt.Text = ""
daytxt.Text = ""
semtxt.Text = ""
firsttxt.Text = ""
secondtxt.Text = ""
thirdtxt.Text = ""
fourthtxt.Text = ""
fifthtxt.Text = ""
sixthtxt.Text = ""
seventhtxt.Text = ""
End Sub

Private Sub cb5_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cb5.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb5.SelectedItem,
DataRowView)
fifthtxt.Text = selectedRow("subject_name").ToString()
End Sub
Private Sub cb6_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cb6.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb6.SelectedItem,
DataRowView)
sixthtxt.Text = selectedRow("subject_name").ToString()
End Sub

Page 80 of 96
Private Sub cb7_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cb7.SelectedIndexChanged
Dim selectedRow As DataRowView = DirectCast(cb7.SelectedItem,
DataRowView)
seventhtxt.Text = selectedRow("subject_name").ToString()
End Sub

Private Sub Update_Click(sender As Object, e As EventArgs) Handles


Update.Click
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("UPDATE timetable SET 1st= @a,2nd=
@b,3rd=@c,4th=@d,5th=@e,6th=@f,7th=@g WHERE course LIKE @course and sem LIKE
@sem and day LIKE @day", con)
Dim pa As String
cmd.Parameters.AddWithValue("@a", firsttxt.Text)
cmd.Parameters.AddWithValue("@b", secondtxt.Text)
cmd.Parameters.AddWithValue("@c", thirdtxt.Text)
cmd.Parameters.AddWithValue("@d", fourthtxt.Text)
cmd.Parameters.AddWithValue("@e", fifthtxt.Text)
cmd.Parameters.AddWithValue("@f", sixthtxt.Text)
cmd.Parameters.AddWithValue("@g", seventhtxt.Text)
cmd.Parameters.AddWithValue("@course", coursetxt.Text)
cmd.Parameters.AddWithValue("@sem", semtxt.Text)
cmd.Parameters.AddWithValue("@day", daytxt.Text)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
searchTT()
End Sub

'Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Create_button.Click
' Dim days() As String = {"monday", "tuesday", "wednesday", "thursday",
"friday", "saturday"}
' Dim courses() = {"bca", "bba", "bcom"}
' Dim semesters() = {1, 2, 3, 4, 5, 6}
' Dim i As Integer
' For Each course In courses
' For Each sem In semesters
' For Each day In days
' Dim sql As String = "INSERT INTO timetable
values(@course,@sem,@day,NULL,NULL,NULL,NULL,NULL,NULL,NULL)"
' Dim con As MySqlConnection = su.dbConnect()
' Dim cmd As New MySqlCommand(sql, con)
' cmd.Parameters.AddWithValue("@course", course)
' cmd.Parameters.AddWithValue("@sem", sem)
' cmd.Parameters.AddWithValue("@day", day)
' Dim da As New MySqlDataAdapter(cmd)
' con.Open()
' cmd.ExecuteNonQuery()
' con.Close()

Page 81 of 96
' Next
' Next
' Thread.Sleep(5000)

' Next
' MsgBox("Insertion done")

'End Sub
End Class

Page 82 of 96
NOTICE
Imports MySqlConnector

Public Class Notice


Dim su As New AddRemoveStudentStaff
Dim con As MySqlConnection = su.dbConnect
Dim date_time As String = Now.ToLongTimeString + " " + Now.ToLongDateString
Sub publishNotice()
Dim cmd As New MySqlCommand("INSERT INTO noticeTbl VALUES(@a,@b,@c)", con)
cmd.Parameters.AddWithValue("@a", NoticeHeadingTextBox.Text)
cmd.Parameters.AddWithValue("@b", NoticeRichTextBox.Text)
cmd.Parameters.AddWithValue("@c", date_time)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Sub
Sub loadNotices()
Dim dt As New DataTable
dt = su.loadUsers("SELECT * FROM noticeTbl")
AllNoticeListView.DataSource = dt
AllNoticeListView.DisplayMember = "heading"
AllNoticeListView.ValueMember = "Id"
End Sub
Private Sub PublishButton_Click(sender As Object, e As EventArgs) Handles PublishButton.Click
publishNotice()
loadNotices()
End Sub

Private Sub Notice_Load(sender As Object, e As EventArgs) Handles MyBase.Load


loadNotices()
End Sub

Private Sub NDeleteButton_Click(sender As Object, e As EventArgs) Handles NDeleteButton.Click


Try

Dim selectedRow As DataRowView = AllNoticeListView.SelectedItem

' Extract the relevant values from the DataRowView object


Dim column1Value As String = selectedRow("heading").ToString()
Dim query As String = "delete from noticetbl where heading LIKE @a"
Dim cmd As MySqlCommand = New MySqlCommand(query, con)
cmd.Parameters.AddWithValue("@a", column1Value)
con.Open()
cmd.ExecuteNonQuery()

MsgBox("Deleted Notice!")
loadNotices()
con.Close()
Catch ex As Exception
MsgBox("Couldnt Delete Notice Because of folloing error " & ex.Message & "")
End Try

End Sub

End Class

Page 83 of 96
RECYCLE USERS OR STUDENTS
Imports MySqlConnector

Public Class RecycleBin


Dim su As AddRemoveStudentStaff = New AddRemoveStudentStaff
Sub loadUsers()
Dim dt As New DataTable
dt = su.loadUsers("Select * FROM userTbl WHERE state = 0")
UserDataGridView.DataSource = dt
UserDataGridView.Columns(14).Visible = False
UserDataGridView.Columns(15).Visible = False
UserDataGridView.Columns(16).Visible = False
Dim dt2 As New DataTable
dt2 = su.loadUsers("Select * FROM stuTbl WHERE state = 0")
StudentDataGridView.DataSource = dt2
StudentDataGridView.Columns(21).Visible = False
StudentDataGridView.Columns(22).Visible = False
End Sub

Private Sub RecycleBin_Load(sender As Object, e As EventArgs) Handles MyBase.Load


loadUsers()
End Sub

Private Sub UserDataGridView_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles


UserDataGridView.CellClick
If e.ColumnIndex = RestoreDataGridViewButtonColumn.Index Then
Dim userId As Integer = UserDataGridView.CurrentRow.Cells(1).Value
Try
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("UPDATE userTbl SET state = @state WHERE userId=@userId", con)
Dim active As Integer = 1
cmd.Parameters.AddWithValue("@state", active)
cmd.Parameters.AddWithValue("@userId", userId)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
loadUsers()
End Sub

Private Sub StudentDataGridView_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles


StudentDataGridView.CellClick
If e.ColumnIndex = SRestoreDataGridViewButtonColumn.Index Then
Dim stuId As Integer = StudentDataGridView.CurrentRow.Cells(1).Value
Try
Dim con As MySqlConnection = su.dbConnect()
Dim cmd As New MySqlCommand("UPDATE stuTbl SET state = @state WHERE userId=@stuId", con)
Dim active As Integer = 1
cmd.Parameters.AddWithValue("@state", active)
cmd.Parameters.AddWithValue("@stuId", stuId)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
loadUsers()
Page 84 of 96
End Sub

End Class

Page 85 of 96
REPORTS

Imports MySqlConnector
Imports System.Data
Imports CrystalDecisions
Imports CrystalDecisions.Windows.Forms.CrystalReportViewer
Imports System.Data.SqlClient
Imports System.IO

Public Class Reports


Dim su As New AddRemoveStudentStaff
Dim con As MySqlConnection = su.dbConnect()
Dim ds As New DataSet
Dim da As MySqlDataAdapter
Dim dt As DataTable
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
loadPrograms()
End Sub
Sub loadPrograms()
Dim programData As DataTable = su.loadUsers("SELECT * FROM tblPrograms")
CourseCombo.DataSource = programData
CourseCombo.DataSource = programData
CourseCombo.DisplayMember = "program_name"
CourseCombo.ValueMember = "Id"
End Sub

Public Sub reports(ByVal sql As String, ByVal rptname As String, ByVal crystalRpt As Object)
Try

con.Open()

Dim reportname As String


Dim cmd As New MySqlCommand(sql, con)

ds = New DataSet()
da = New MySqlDataAdapter(cmd)
da.Fill(ds)
reportname = rptname
Dim reportdoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim strReportPath As String
strReportPath = Application.StartupPath & "\reports\" & reportname & ".rpt"

If File.Exists(strReportPath) Then
reportdoc.Load(strReportPath)
reportdoc.SetDataSource(ds.Tables(0))
With crystalRpt
.ShowRefreshButton = False
.ShowCloseButton = False
.ShowGroupTreeButton = False
.ReportSource = reportdoc
End With
Else
MsgBox("Report file not found at path: " & strReportPath)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
da.Dispose()
End Sub

Private Sub AttendanceButton_Click(sender As Object, e As EventArgs) Handles AttendanceButton.Click


If (CourseCombo.Text = "" Or SemCombo.Text = "") Then
Page 86 of 96
MsgBox("Please select course and semester")
Else
Dim Sql As String = "SELECT

fname as Student_name,
(COUNT(CASE WHEN PA='Present' THEN 1 END)/COUNT(*))*100 AS Attendance
FROM
attendancetbl
WHERE
program = '" & CourseCombo.Text & "' AND sem = '" & SemCombo.Text & "'
GROUP BY
fname;

"
reports(Sql, "ATTENDANCE", CPV)
End If

End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CourseCombo.SelectedIndexChanged

End Sub

Private Sub StudentDetailsButton_Click(sender As Object, e As EventArgs) Handles StudentDetailsButton.Click


If (CourseCombo.Text = "" Or SemCombo.Text = "") Then
MsgBox("Please select course and semester")
Else
Dim Sql As String = "SELECT

CAST(userId as CHAR) as RegNo,fname as FirstName,mname as MiddleName,caddress as CurrentAddress,CAST(phoneno as


CHAR) as PhoneNo,gender as Gender

FROM
stutbl
WHERE
course = '" & CourseCombo.Text & "' AND sem = '" & SemCombo.Text & "'
GROUP BY
userId;

"
reports(Sql, "STUDENTDETAILS", CPV)
End If

End Sub

Private Sub FacultyDetailsButton_Click(sender As Object, e As EventArgs) Handles FacultyDetailsButton.Click


If (CourseCombo.Text = "" Or SemCombo.Text = "") Then
MsgBox("Please select course and semester")
Else
Dim Sql As String = "SELECT

facultyname as FacultyName,subject_name as SubjectName,sem as Semester


FROM
tblbca
WHERE
sem = '" & SemCombo.Text & "'
GROUP BY
subject_id;

"
reports(Sql, "FACULTYDETAILS", CPV)
End If

Page 87 of 96
End Sub
End Class

Page 88 of 96
reports

Page 89 of 96
COURSE AND SEMESTER WISE FACULTY REPORTS

COURSE AND SEMESTER WISE CLASS STUDENTS ATTENDANCE


REPORT

Page 90 of 96
COURSE AND SEMESTER WISE CLASS STUDENTS DETAILS REPORT

Page 91 of 96
TESTING

Testing Objectives
Testing is a process of executing a program with the intent of finding
an error or debug.
A good test case is one that has a high probability of finding yet not
discovered errors.

Unit Testing
Unit testing using white-box-testing to test each smallest unit or
component of the module like Interface, Local Data Structure, Boundary
Conditions, Independent and Error Handling Paths using appropriate test
cases.

Integration Testing
Integration Testing using Top-Down Integration to test data
and its value before and after flowing from one to another module
during and after integration of module.

Code Testing
The code testing examines the logic of the program. To
follow this testing we have developed test cases that result in
every instruction in the module; every path is specific
combination of conditions that is handled by the program.

Validation Testing
Validation testing to validate system functionalities, that they
are traceable to customer requirements.

System Testing
System testing to test efficiency with all minimum hardware
and software requirements of system after installation.

Page 92 of 96
FUTURE SCOPE
 Integration with other systems: The College Management System can be integrated with other
systems like library management, hostel management, and transportation management. This will help
in creating a centralized platform for managing various aspects of the college.

 Mobile application: A mobile application can be developed for the College Management System that
can be used by students, teachers, and parents to access information about the college. This will
provide a convenient and efficient way to access information on the go.

 Online payment: Online payment can be integrated into the College Management System for
payment of fees, fines, and other charges. This will eliminate the need for physical payment and
provide a secure and convenient payment method.

 Alumni network: A platform for alumni networking can be created within the College Management
System. This will help in connecting alumni with each other and with the college, and can be used
for mentoring and career guidance.

 Analytics and reporting: The College Management System can be enhanced with analytics and
reporting capabilities to provide insights into student performance, attendance, and other metrics.
This will help in making data-driven decisions and improving the overall performance of the college.

 Virtual classroom: The College Management System can be integrated with virtual classroom
software to provide online classes and lectures. This will provide flexibility in teaching and learning,
and can be used in situations where physical attendance is not possible.

 Artificial intelligence: Artificial intelligence can be integrated into the College Management System
for tasks like chatbots, automated grading, and student recommendations. This will provide a
personalized and efficient experience for students and teachers.

Page 93 of 96
CONCLUSION

In conclusion, our College Management System project in VB.NET has successfully achieved its objectives
of creating a comprehensive and efficient system for managing college operations. Throughout the project,
we have developed various features and functionalities that enable easy management of student, staff, and
administrative data.

We have developed a user-friendly interface that provides easy navigation and access to relevant
information for students, teachers, and administrators. Some of the key features we have implemented
include student registration and management, attendance tracking, timetable and report generation.

Despite some challenges faced during the project, such as technical difficulties and time constraints, we
were able to overcome these obstacles through effective teamwork and collaboration. We have learned
valuable lessons in project management, software development methodologies, and communication, which
will be useful for future projects.

In the future, there are several potential areas for further development of the College Management System,
such as integration with other systems, development of a mobile application, and implementation of artificial
intelligence. We believe that the system has the potential to further improve college operations and
contribute to the success of the college.

We would like to express our gratitude to all those who supported us throughout the project, including our
HOD K.ADISESHA . It has been a fulfilling experience for all of us, and we hope that our College
Management System will continue to serve the college community for years to come.

Page 94 of 96
REFERENCES / BIBLOGRAPHY

BIBLOGRAPHY :
 https://www.scribd.com/doc/92277607/COLLEGE-MANAGEMENT-SYSTEM-ON-
VISUAL-BASIC-BY-SANTOSH-KUMAR-IIMT-KARKARDOOMA#

REFERENCE :
1. Beginning with Vb.Net 2008 – Thearon Willis
2. System Analysis and Design-- Galgotia Publications.
3. Software Engineering By Roger S. Pressman, McGraw
Hill Publications.

Page 95 of 96
Page 96 of 96

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy