In the dynamic world of software and IT technologies, aspiring developers often find themselves on a quest to enhance their skills. One effective way to learn is by delving into practical projects with source code. In this blog post, we'll explore an intriguing project – the "Create Book Inventory" system, providing a comprehensive understanding of its features, user interface, and underlying code.
Overview of Previous Projects:
Before we dive into the intricacies of the Book Inventory project, let's take a quick look at some previous projects available for download:
- Stock Management System Project With Source Code
- Library Management System Project With Source Code
- Reminder Application Project With Source Code
- Book Inventory Project With Source Code
- School Management System Project With Source Code
These projects serve as valuable resources for beginners to gain hands-on experience in various software development domains
Create Book Inventory Project: Unveiling the Interface
The star of our exploration is the "Create Book Inventory" project – a simple yet powerful initiative for understanding database operations. The user interface, as depicted in the accompanying images, showcases a clean and intuitive design.
The primary functionality of the Book Inventory project revolves around storing and retrieving book information from a database. The data is presented in a tabular format using a Gridview, providing an organized view of the stored information.
Key Features:
The "Create Book Inventory" project allows users to perform the following actions:
- Create new book entries.
- Edit existing book information.
- Update book details.
- Delete book records.
The heart of the project lies in its database structure. The SQL script for creating the 'Book' table is provided below:
USE [master]
GO
/****** Object: Table [dbo].[Book] Script Date: 03/30/2015 22:44:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Book]undefined
[Book_Id] [nvarchar]undefined5) NULL,
[Book_name] [nvarchar]undefined50) NULL,
[Book_author] [nvarchar]undefined30) NULL,
[Book_Publisher_name] [nvarchar]undefined50) NULL,
[Book_Published_date] [nvarchar]undefined30) NULL
) ON [PRIMARY]
GO
HTML Code for User Interface:
The user interface is crafted using HTML, allowing for a seamless interaction between the user and the application. The HTML code defines the structure of the input forms, buttons, and the presentation of data in the Gridview.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BookForm.aspx.cs" Inherits="BookForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="display_success" class="display_success" visible="false" runat="server"></div>
<div id="display_warning" class="display_warning" runat="server"></div>
<div id="display_info" class="display_info" runat="server"></div>
<div id="displau_error" class="display_error" runat="server"></div>
<div>
</div>
<table class="table">
<tr>
<th colspan="2">Create Book Inventory</th>
</tr>
<tr>
<td>Book ID : </td><td><asp:TextBox ID="txtBookId" CssClass="textbox" runat="server" MaxLength="5"></asp:TextBox> <asp:Button
ID="BtnGet" runat="server"
Text="Get" Visible="false" onclick="BtnGet_Click" /></td></tr><tr>
<td>Book Name : </td><td><asp:TextBox ID="txtBookName" CssClass="textbox" runat="server"></asp:TextBox></td></tr><tr>
<td>Book Author : </td><td><asp:TextBox ID="txtBookAuthor" CssClass="textbox" runat="server"></asp:TextBox></td></tr><tr>
<td>Book Publisher Name : </td><td><asp:TextBox ID="txtBookPublisherName" CssClass="textbox" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button CssClass="button" ID="BtnCreateBookInvSubmit" runat="server"
Text="Submit" onclick="BtnCreateBookInvSubmit_Click" />
<asp:Button CssClass="button" ID="BtnCreateBookInvUpdate" runat="server"
Text="Update" Visible="false" onclick="BtnCreateBookInvUpdate_Click" />
<asp:Button CssClass="button" ID="BtnCreateBookInvDelet" runat="server"
Text="Delete" Visible="false" onclick="BtnCreateBookInvDelet_Click" />
<asp:Button CssClass="button" ID="BtnCreateBookInvEdit" runat="server"
Text="Edit" onclick="BtnCreateBookInvEdit_Click" />
<asp:Button CssClass="button" ID="BtnCreateBookInvCancel" runat="server"
Text="Cancel" onclick="BtnCreateBookInvCancel_Click" />
</td>
</tr>
</table>
</div>
<div style="margin:20px -250px 0px -90px;">
<asp:GridView ID="gridview_book" runat="server" AutoGenerateColumns="False"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="2">
<Columns>
<asp:BoundField DataField="Book_id" HeaderText="Book ID" />
<asp:BoundField DataField="Book_name" HeaderText="Book Name" />
<asp:BoundField DataField="Book_author" HeaderText="Book Author">
</asp:BoundField>
<asp:BoundField DataField="Book_Publisher_name"
HeaderText="Book Publisher Name">
</asp:BoundField>
<asp:BoundField DataField="Book_Published_date"
HeaderText="Book Published Date">
</asp:BoundField>
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
</div>
</form>
</body>
</html>
CSS Style:
The visual appeal of the project is enhanced through carefully crafted CSS styles. These styles ensure a consistent and pleasing look, making the user experience enjoyable.
.body
{
margin:50px 250px 0px 500px;
}
.table
{
border-collapse:collapse;
padding:10px 10px 10px 10px;
}
.table th, td
{
border:1px solid #ccc;
}
.table th
{
background-color:#0066cc;
color:#fff;
padding:5px 5px 5px 5px;
}
.table td
{
padding:2px 5px 2px 5px;
}
.textbox
{
background:#9999FF;
width:190px;
border:1px solid #0066cc;
padding:3px 3px 3px 3px;
}
.textbox:hover
{
background:#0066cc;
width:190px;
border:1px solid #ff0000;
padding:3px 3px 3px 3px;
color:#fff;
}
.button
{
background:#000000;
color:#fff;
padding:10px 15px 10px 15px;
border-collapse:collapse;
border:1px solid #000000;
}
.button:hover
{
background:#0066cc;
color:#fff;
padding:10px 15px 10px 15px;
border-collapse:collapse;
border:1px solid #0066cc;
}
.display_success, dispaly_warning, display_error, display_info{
border:1px solid;
margin: 10px 0px;
padding:15px 10px 15px 50px;
background-repeat: no-repeat;
background-position: 10px center;
}
.display_info {
color: #00529B;
background-color: #BDE5F8;
background-image: url('info.png');
}
.display_success {
color: #4F8A10;
background-color: #DFF2BF;
background-image:url('~/Images/success-lg.gif');
width:310px;
}
.display_warning {
color: #9F6000;
background-color: #FEEFB3;
background-image: url('warning.png');
}
.display_error {
color: #D8000C;
background-color: #FFBABA;
background-image: url('error.png');
}
C# Coding: Bringing Functionality to Life
The C# code behind the project is responsible for executing essential functionalities. Key sections of the C# code include:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
void Get_Book_Details()
{
sqlquery = "Select * from Book";
cmd=new SqlCommandundefinedsqlquery, con);
con.Openundefined);
gridview_book.DataSource = cmd.ExecuteReaderundefined);
gridview_book.DataBindundefined);
con.Closeundefined);
}
protected void BtnCreateBookInvSubmit_Click(object sender, EventArgs e)
{
sqlquery = "Insert into BookundefinedBook_id, Book_name, Book_author, Book_Publisher_name, Book_Published_date) Valuesundefined'" + txtBookId.Text + "', '" + txtBookName.Text + "', '" + txtBookAuthor.Text + "', '" + txtBookPublisherName.Text + "', '" + datetime + "')";
cmd = new SqlCommandundefinedsqlquery, con);
con.Openundefined);
cmd.ExecuteNonQueryundefined);
con.Closeundefined);
display_success.Visible = true;
display_success.InnerHtml = "Insert Successfully...";
Get_Book_Detailsundefined);
}
protected void BtnCreateBookInvEdit_Click(object sender, EventArgs e)
{
display_success.Visible = false;
display_success.InnerHtml = string.Empty;
txtBookId.Text = string.Empty;
txtBookId.Attributes["placeholder"] = "Please Enter Book ID";
txtBookName.Visible = false;
txtBookAuthor.Visible = false;
txtBookPublisherName.Visible = false;
BtnCreateBookInvSubmit.Visible = false;
BtnGet.Visible = true;
BtnCreateBookInvEdit.Visible = false;
BtnCreateBookInvUpdate.Visible = true;
BtnCreateBookInvDelet.Visible = true;
}
protected void BtnCreateBookInvUpdate_Click(object sender, EventArgs e)
{
sqlquery = "Update Book set Book_name='" + txtBookName.Text + "', Book_author='" + txtBookAuthor.Text + "', Book_Publisher_name='" + txtBookPublisherName.Text + "', Book_Published_date='" + System.DateTime.Today.ToStringundefined) + "' where book_id='" + txtBookId.Text + "'";
cmd = new SqlCommandundefinedsqlquery, con);
con.Openundefined);
cmd.ExecuteNonQueryundefined);
con.Closeundefined);
display_success.Visible = true;
display_success.InnerHtml = "Update Successfully...";
Get_Book_Detailsundefined);
}
protected void BtnCreateBookInvDelet_Click(object sender, EventArgs e)
{
sqlquery = "delete Book where book_id='" + txtBookId.Text + "'";
cmd = new SqlCommandundefinedsqlquery, con);
con.Openundefined);
cmd.ExecuteNonQueryundefined);
con.Closeundefined);
Get_Book_Detailsundefined);
}
void enable()
{
txtBookAuthor.Visible = true;
txtBookName.Visible = true;
txtBookPublisherName.Visible = true;
}
protected void BtnCreateBookInvCancel_Click(object sender, EventArgs e)
{
display_success.Visible = false;
display_success.InnerHtml = string.Empty;
txtBookId.Attributes["placeholder"] = string.Empty;
txtBookId.Text = string.Empty;
txtBookAuthor.Text = string.Empty;
txtBookAuthor.Visible = true;
txtBookName.Text = string.Empty;
txtBookName.Visible = true;
txtBookPublisherName.Text = string.Empty;
txtBookPublisherName.Visible = true;
BtnGet.Visible = false;
BtnCreateBookInvSubmit.Visible = true;
BtnCreateBookInvEdit.Visible = true;
BtnCreateBookInvUpdate.Visible = false;
BtnCreateBookInvDelet.Visible = false;
}
Web.Config for Database Connection:
The 'Web.Config' file contains the crucial database connection string, ensuring seamless communication between the application and the underlying database.
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<connectionStrings>
<add name="RCCon" connectionString="Server=.; Database = master; Trusted_Connection = Yes;"/>
</connectionStrings>
</configuration>
Download Project Source Code
For those eager to delve into the details, the source code for the "Create Book Inventory" project is available for download. Click here to unlock the potential of this hands-on learning opportunity.
Conclusion
In conclusion, the "Create Book Inventory" project stands as a beacon for beginners in the world of software development. By exploring its features and dissecting the source code, aspiring developers can gain valuable insights into database management, user interface design, and C# programming. Download the source code, embark on your coding journey, and unlock the secrets of effective inventory management in the digital age. Happy coding.
0 Comments