You are on page 1of 16

9.

APPENDIX
9.1 SCREENSHOT
Login user create
4.6 TABLE DESIGN

TABLE DESIGN

Table Name : product_Detail

Description : To store the Product Details

Primary key : p_code

Name Data Type Size Constrains Description


p_code varchar 10 primary key The unique id
p_name varchar 20 not null Product name
descript Text 50 not null Product description
p_price Int 05 not null Descript price
p_qty Int 03 not null Descript quantity

Table Name : customer_Detail

Description : To store the Customer Details

Primary key : cus_code

Name Data Type Size Constrains Description


cus_code varchar 10 primary key The unique id
cus_name varchar 20 not null Customer name
Address Text 50 not null Customer Address
phone Int 10 not null Customer Phone
Email varchar 25 not null Customer Email id
Table Name : supplier_Detail

Description : To store the supplier Details

Primary key : sup_code

Name Data Type Size Constrains Description


sup_code varchar 10 primary key The unique id
sup_name varchar 20 not null Customer name
Address Text 50 not null Customer Address
phone Int 10 not null Customer Phone
Email varchar 25 not null Customer Email id

Table Name : sal_Detail

Description : To store the sales Details

Primary key : sel_code

Secondary key : cus_code

Name Data Type Size Constrains Description


Sel_code varchar 10 primary key The unique id
cus_code varchar 10 secondary key The unique id
cus_name varchar 20 not null Customer name
Address Text 50 not null Customer Address
phone Int 10 not null Customer Phone
p_code varchar 10 secondary key The unique id
p_name varchar 20 not null Product name
p_price Int 05 not null Product price
p_qty Int 03 not null Product quantity
Total Int 04 not null Total
Table Name : purchase_Detail

Description : To store the purchase Details

Primary key : pur_code

Secondary key : sup_code

Name Data Type Size Constrains Description


pur_code varchar 10 primary key The unique id
sup_code varchar 10 secondary key The unique id
sup_name varchar 20 not null Customer name
Address Text 50 not null Customer Address
phone Int 10 not null Customer Phone
p_code varchar 10 secondary key The unique id
p_name varchar 20 not null Product name
p_price Int 05 not null Product price
p_qty Int 03 not null Product quantity
Total Int 04 not null Total

Table Name : product_Detail

Description : To store the Product Details

Foreign key : p_code

Name Data Type Size Constrains Description


p_code varchar 10 Foreign key The unique id
p_name varchar 20 not null Product name
descript Text 50 not null Product description
p_price Int 05 not null Descript price
p_qty Int 03 not null Descript quantity
Logs details
Customer record
Supplier entry
Product entry details
Stock entry detail
4.4 ENTITY RELATIONSHIP

l_id
Login Sup_name
phone
pwd
phn
c_id sup_id
Address

SSSS
Customer Manag Supplier
e

c_id p_id

Billing
s_id
Insert

Sales
rate
Sup_na
me P_wt

Invoice p_name
Purchase

prod_wt rate qty


pur_id
prod_name
qty Insert

Stock
s_id

pro_id
p_name
P_wt

Production Manag
e
SOURCE CODE

Imports System.Data.SqlClient
Public Class frmLogin

Private Sub frmLogin_FormClosing(ByVal sender As Object, ByVal e As


System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End
End Su

Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles

End Sub

Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.LinkLabelLinkClickedEventArgs)

End Sub

Private Sub login_button_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles login_button.Click
If Len(Trim(UserName.Text)) = 0 Then
MessageBox.Show("Please enter user name", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
UserName.Focus()
Exit Sub
End If
If Len(Trim(Password.Text)) = 0 Then
MessageBox.Show("Please enter password", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
Password.Focus()
Exit Sub
End If
Try
Dim myConnection As SqlConnection
myConnection = New SqlConnection("Data Source=DESKTOP-3G2TMM7;Initial
Catalog=SI_DB.MDF;Persist Security Info=True;User ID=sa;Password=sql;")

Dim myCommand As SqlCommand

myCommand = New SqlCommand("SELECT Username,password FROM Users


WHERE username = @username AND password = @UserPassword", myConnection)

Dim uName As New SqlParameter("@username", SqlDbType.NChar)


Dim uPassword As New SqlParameter("@UserPassword", SqlDbType.NChar)

uName.Value = UserName.Text

uPassword.Value = Password.Text

myCommand.Parameters.Add(uName)

myCommand.Parameters.Add(uPassword)

myCommand.Connection.Open()

Dim myReader As SqlDataReader =


myCommand.ExecuteReader(CommandBehavior.CloseConnection)

Dim Login As Object = 0

If myReader.HasRows Then

myReader.Read()

Login = myReader(Login)

End If

If Login = Nothing Then

MsgBox("Login is Failed...Try again !", MsgBoxStyle.Critical, "Login Denied")


UserName.Clear()
Password.Clear()
UserName.Focus()

Else

ProgressBar1.Visible = True
ProgressBar1.Maximum = 5000
ProgressBar1.Minimum = 0
ProgressBar1.Value = 4
ProgressBar1.Step = 1

For i = 0 To 5000
ProgressBar1.PerformStep()
Next

FrmMain.ToolStripStatusLabel2.Text = UserName.Text
Me.Hide()

FrmMain.Show()

End If

Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
End
End Sub

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.Hide()
frmChangePassword.Show()
frmChangePassword.UserName.Text = ""
frmChangePassword.OldPassword.Text = ""
frmChangePassword.NewPassword.Text = ""
frmChangePassword.ConfirmPassword.Text = ""
frmChangePassword.UserName.Focus()
End Sub

Private Sub LinkLabel2_LinkClicked_1(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
Me.Hide()
frmPasswordRecovery.Show()
End Sub
End Class

If Len(Trim(B_Address.Text)) = 0 Then
MessageBox.Show("Please enter address", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
B_Address.Focus()
Exit Sub
End If
If Len(Trim(B_City.Text)) = 0 Then
MessageBox.Show("Please enter city", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
B_City.Focus()
Exit Sub
End If
If Len(Trim(B_State.Text)) = 0 Then
MessageBox.Show("Please select state", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
B_State.Focus()
Exit Sub
End If
If Len(Trim(B_ZipCode.Text)) = 0 Then
MessageBox.Show("Please enter zip/post code", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
B_ZipCode.Focus()
Exit Sub
End If
If Len(Trim(S_name.Text)) = 0 Then
MessageBox.Show("Please enter name", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
S_name.Focus()
Exit Sub
End If

If Len(Trim(S_Address.Text)) = 0 Then
MessageBox.Show("Please enter address", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
S_Address.Focus()
Exit Sub
End If
If Len(Trim(S_City.Text)) = 0 Then
MessageBox.Show("Please enter city", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
S_City.Focus()
Exit Sub
End If
If Len(Trim(S_State.Text)) = 0 Then
MessageBox.Show("Please select state", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
S_State.Focus()
Exit Sub
End If
If Len(Trim(S_ZipCode.Text)) = 0 Then
MessageBox.Show("Please enter zip/post code", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
S_ZipCode.Focus()
Exit Sub
End If
If Len(Trim(txtMobileNo.Text)) = 0 Then
MessageBox.Show("Please enter mobile no.", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
txtMobileNo.Focus()
Exit Sub
End If

Try
auto()
con = New SqlConnection(cs)
con.Open()
Dim ct As String = "select customerno from customer where customerno=@find"

cmd = New SqlCommand(ct)


cmd.Connection = con
cmd.Parameters.Add(New SqlParameter("@find", System.Data.SqlDbType.NChar, 20,
"customerno"))
cmd.Parameters("@find").Value = txtCustomerNo.Text
rdr = cmd.ExecuteReader()

If rdr.Read Then
MessageBox.Show("Distributor ID Already Exists", "Input Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)

If Not rdr Is Nothing Then


rdr.Close()
End If

You might also like