E-Book Management System ( VB )
An electronic book (variously, e-book,
ebook, digital book, or even e-edition) is a book-length
publication in digital form, consisting of text, images, or both, and produced
on, published through, and readable on computers or other electronic devices.Sometimes the equivalent of a conventional printed book,
e-books can also be born digital. The Oxford
Dictionary of English defines the e-book as "an electronic version
of a printed book,"but e-books can and do exist without any printed equivalent. E-books are
usually read on dedicated e-book
readers or tablets using e-reader
applications. Personal computers and many mobile
phones (smart phones) can also be used to
read e-books.
SOURCE CODE
LOGIN
Imports System.Data.SqlClient
Imports System.IO
Partial Class Login
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Public
open As String
Protected
Sub Button1_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button1.Click
Try
cmd = New SqlCommand("select
* from login where uname='" & Trim(TextBox1.Text) & "' and pword='" &
Trim(TextBox2.Text) & "'",
con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read
TextBox1.Text =
rs(0)
TextBox2.Text =
rs(1)
End While
LinkButton2.Visible
= True
Else
Label1.Visible = True
End If
rs.Close()
con.Close()
Catch
ex As Exception
'MsgBox(ex.Message())
End
Try
Session("uname") = TextBox1.Text
End
Sub
Protected
Sub LinkButton1_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles LinkButton1.Click
Response.Redirect("create.aspx")
End
Sub
Protected
Sub LinkButton2_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles LinkButton2.Click
Response.Redirect("search.aspx")
End
Sub
End Class
ADMIN LOGIN
Partial Class alogin
Inherits
System.Web.UI.Page
Protected
Sub Button1_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button1.Click
If
TextBox1.Text = "admin" And TextBox2.Text = "admin"
Then
Panel1.Visible = True
Label2.Visible = True
Else
Label1.Visible = True
End
If
End
Sub
Protected
Sub Button3_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button3.Click
Response.Redirect("search.aspx")
End
Sub
Protected
Sub Button4_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button4.Click
Response.Redirect("user.aspx")
End
Sub
Protected
Sub Button5_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button5.Click
Response.Redirect("accounts.aspx")
End
Sub
Protected
Sub Button2_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button2.Click
Response.Redirect("upload.aspx")
End
Sub
Protected
Sub Button6_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button6.Click
Response.Redirect("advance.aspx")
End
Sub
End Class
ACCOUNTS
Partial Class accounts
Inherits
System.Web.UI.Page
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
End
Sub
End Class
ADVANCE SEARCH
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data
Imports System.Linq
Partial Class advance
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Public
open As String
Dim
a(100), d(100) As Date
Dim
bn(1000) As String
Dim
b As Integer =
0
Protected
Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles
GridView1.SelectedIndexChanged
Dim
x
x =
GridView1.SelectedRow.Cells(1).Text
Try
cmd = New SqlCommand("select
* from upload where bid='" & x & "'",
con)
con.Open()
rs = cmd.ExecuteReader
If
rs.HasRows Then
While rs.Read
TextBox3.Text =
Trim(rs(0).ToString)
Session("bid") = TextBox3.Text
End While
End
If
rs.Close()
con.Close()
Catch
ex As Exception
con.Close()
MsgBox(ex.Message(),
MsgBoxStyle.Critical, "Process Aborted")
End
Try
msg()
End
Sub
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
TextBox4.Text = Session("uname")
TextBox2.Text =
DateTime.Today.ToString("dd-MM-yyyy")
Try
cmd = New SqlCommand("select
* from upload ", con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read
b = b + 1
bn(b) = rs(2)
a(b) =
Trim(rs(3)).ToString()
End While
End
If
con.Close()
rs.Close()
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
For
j = 1 To b
Dim
k As Integer =
DateDiff("d", a(j), TextBox2.Text)
If
k > 10 Then
Try
cmd = New SqlCommand("delete
from upload where fname='" & Trim(bn(j).ToString()) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
Finally
con.Close()
End Try
End
If
Next
End
Sub
Private
Sub msg()
Dim
x
x =
GridView1.SelectedRow.Cells(1).Text
If
TextBox4.Text <= "" Then
x = MsgBox("Login First", MsgBoxStyle.OkCancel, "Login")
Response.Redirect("login.aspx")
End
If
x = MsgBox("You interested to buy this book",
MsgBoxStyle.OkCancel, "Select Book")
If
x = 1 Then
Response.Redirect("payment.aspx")
End
If
End
Sub
End Class
CREATE NEW ACCOUNT
Imports System.Data.SqlClient
Imports System.IO
Partial Class create
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Public
open As String
Protected
Sub Button1_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button1.Click
Try
cmd = New SqlCommand("insert
into createacc values('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "' ,'" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Label1.Visible = True
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
Try
cmd = New SqlCommand("insert
into login values('" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Label1.Visible = True
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
End
Sub
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
Dim
idd As Integer
Try
cmd = New SqlCommand("select
* from uid", con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read
idd = rs(0)
End While
End
If
con.Close()
rs.Close()
idd += 1
TextBox1.Text = "UID" & idd
cmd = New SqlCommand("update
uid set uid='" & Trim(idd) & "'",
con)
con.Open()
cmd.ExecuteReader()
con.Close()
Catch
ex As Exception
MsgBox(ex.Message())
Finally
con.Close()
End
Try
End
Sub
End Class
PAYMENT
Imports System.Data.SqlClient
Imports System.IO
Imports System
Imports System.Security
Imports
System.Security.Cryptography
Imports System.Diagnostics
Partial Class payment
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
TextBox6.Text = Session("bid")
TextBox11.Text = Session("uname")
Try
cmd = New SqlCommand("select
* from upload where bid='" & Trim(TextBox6.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read()
TextBox2.Text =
Trim(rs(1))
TextBox1.Text =
Trim(rs(2))
TextBox3.Text =
Trim(rs(3))
TextBox7.Text =
Trim(rs(4))
TextBox4.Text =
Trim(rs(5))
TextBox5.Text =
Trim(rs(6))
End While
End
If
con.Close()
rs.Close()
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
End
Sub
Protected
Sub Button2_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button2.Click
Try
cmd = New SqlCommand("insert
into payment values('" & Trim(TextBox11.Text) & "','" & Trim(TextBox6.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox8.Text) & "','" & Trim(TextBox9.Text) & "','" & Trim(TextBox3.Text) & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
Label1.Visible = True
Button5.Visible = True
End
Sub
Protected
Sub Button4_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button4.Click
Dim
sum As Integer
sum =
Val(Trim(TextBox4.Text)) * Val(Trim(TextBox8.Text))
TextBox9.Text = sum
End
Sub
Protected
Sub Button5_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button5.Click
DownloadFile(Server.MapPath("~/images/"))
End
Sub
Dim
destdir, filename, destpath, fn, strFileToDecrypt As
String
Public
Sub DownloadFile(ByVal
FilePath As String)
filename = TextBox1.Text
destdir = Server.MapPath("~/images/")
destpath = destdir &
filename
fn = TextBox1.Text
strFileToDecrypt =
Server.MapPath("images\.\") &
fn.ToString()
Process.Start("explorer.exe", fn.ToString())
End
Sub
End Class
VIEW OR SEARCH
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data
Imports System.Linq
Partial Class search
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Public
open As String
Dim
a(100), d(100) As Date
Dim
bn(1000) As String
Dim
b As Integer =
0
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
TextBox4.Text = Session("uname")
TextBox2.Text =
DateTime.Today.ToString("dd-MM-yyyy")
Try
cmd = New SqlCommand("select
* from upload ", con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read
b = b + 1
bn(b) = rs(2)
a(b) =
Trim(rs(3)).ToString()
End While
End
If
con.Close()
rs.Close()
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
For
j = 1 To b
Dim
k As Integer =
DateDiff("d", a(j), TextBox2.Text)
If
k > 10 Then
Try
cmd = New SqlCommand("delete
from upload where fname='" & Trim(bn(j).ToString()) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
Finally
con.Close()
End Try
End
If
Next
End
Sub
Private
Sub msg()
Dim
x
x =
GridView1.SelectedRow.Cells(1).Text
If
TextBox4.Text <= "" Then
x = MsgBox("Login First", MsgBoxStyle.OkCancel, "Login")
Response.Redirect("login.aspx")
End
If
x = MsgBox("You interested to buy this book",
MsgBoxStyle.OkCancel, "Select Book")
If
x = 1 Then
Response.Redirect("payment.aspx")
End
If
End
Sub
Protected
Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles
GridView1.SelectedIndexChanged
Dim
x
x = GridView1.SelectedRow.Cells(1).Text
Try
cmd = New SqlCommand("select
* from upload where bid='" & x & "'",
con)
con.Open()
rs =
cmd.ExecuteReader
If rs.HasRows Then
While rs.Read
TextBox3.Text =
Trim(rs(0).ToString)
Session("bid") = TextBox3.Text
End While
End If
rs.Close()
con.Close()
Catch
ex As Exception
con.Close()
MsgBox(ex.Message(),
MsgBoxStyle.Critical, "Process Aborted")
End
Try
msg()
End
Sub
Protected
Sub LinkButton1_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles LinkButton1.Click
Response.Redirect("advance.aspx")
End
Sub
End Class
UPLOAD
Imports System.Data.SqlClient
Imports System.IO
Partial Class upload
Inherits
System.Web.UI.Page
Dim
con As New
SqlConnection(ConfigurationManager.ConnectionStrings("pattern").ConnectionString)
Public
cmd As SqlCommand
Public
rs As SqlDataReader
Public
open As String
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
Dim
idd As Integer
Try
cmd = New SqlCommand("select
* from eid", con)
con.Open()
rs = cmd.ExecuteReader()
If
rs.HasRows Then
While rs.Read
idd = rs(0)
End While
End
If
con.Close()
rs.Close()
idd += 1
TextBox1.Text = "BID" & idd
cmd = New SqlCommand("update
eid set eid='" & Trim(idd) & "'",
con)
con.Open()
cmd.ExecuteReader()
con.Close()
Catch
ex As Exception
MsgBox(ex.Message())
Finally
con.Close()
End
Try
TextBox3.Text =
DateTime.Today.ToString("dd-MM-yyyy")
End
Sub
Dim
destdir, filename, destpath As String
Protected
Sub Button2_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Button2.Click
destdir = Server.MapPath("~/images/")
filename =
FileUpload1.FileName
destpath = destdir &
filename
FileUpload1.PostedFile.SaveAs(destpath)
TextBox6.Text = filename
Try
cmd = New SqlCommand("insert
into upload values('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox6.Text) & "','" & Trim(TextBox3.Text) & "','" & Trim(DropDownList1.Text)
& "','" &
Trim(TextBox4.Text) & "','"
& Trim(TextBox5.Text) & "')",
con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Label1.Visible = True
Catch
ex As Exception
MsgBox(ex.Message())
End
Try
TextBox2.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End
Sub
End Class
VIEW USER ACCOUNT
Partial Class user
Inherits
System.Web.UI.Page
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
End
Sub
End Class

No comments:
Post a Comment