Submitted By : JINENDRA : JINENDRA SHAILESH SHAH (BCA-118186666) BCA-118186666)
Under The Guidance Of: Mr. Viki N. Patel (MCA) Subject Code: BCS (P)-064 Submittion Time : Mar-2015. Study Center Code: 0902 Regional Center Code : 09.
Online Book Store SUBMITED BY: Submitted By:Jinendra S. Shah (BCA-118186666)
Mr. Viki N. Patel(MCA) Patel(MCA)
Submitted to the School of Computer and Information Sciences, IGNOU in partial fulfillment of the requirements requirements for the degree of
This is to certify that the project report entitled ________________________________ submitted to requirement for
in partial fulfilment of the the
award of the degree of is an authentic authentic and and original original work carried out out by Mr. / Ms._________________________________ with enrolment no. ___________under my guidance. _______________________ The matter embodied in this project is genuine work done by the student and has not been submitted whether to this University or to any other University / Institute for the fulfillment of the requirements of any course of study.
……………………….
...…………………….
Signature of the Student:
Signature of the Guide
Date:………………..
Date:…………………
Name and Address
Name, Designation
of the student
and Add. of the Guide:
Enrolment No…………
A C K N O W L E G E M E N T I have taken efforts in this project. However, it would not have been possible without the kind support and help of many individuals and organizations. I would like to extend my sincere thanks to all of them. I am highly indebted to Mr. Viki N Patel for their guidance and constant supervision as well as for providing necessary information regarding the project & also for their support in completing the project. I would like to express my gratitude towards my parents & member of ONLINE BOOK STORE for their kind co-operation and encouragement which help me in completion of this project. I would like to express my special gratitude and thanks to industry persons for giving me such attention and time. My thanks and appreciations also go to my colleague in developing the project and people who have willingly helped me out with their abilities.
PLACE : VADODARA (TRULY YOUR’S)
[1]
Title Of Project Online Book Store
[2] Introduction & Objective of the Project
Introduction:-
Online Book Store is a ecommerce website for bookstore which provides online books shopping for user customers and customers can view the orders and the status of the order using login dashboards. This website has option of administrator who can add books, view orders and update the status of the orders which customers can see through his login order page. Using the system users or customers can view the store’s available books and can place orders through shopping cart. On checkout time user can register or existing user can use their existing credentials proceed the checkout. There will be different payment options to choose to place the orders. Using login section, Customers can view placed orders and the status of the orders whether it is delivered or still processing from admin side. This system has administration section where admin can access all orders, add/view/edit books to the shopping portal. As of now, the system offers only cash on delivery and DD/Chq. on delivery options.
Background :Online Book Store: An ecommerce website for bookstore is based on B2C project. This project has been composed on three major strands: Data collection from customer, administrative process for delivery and revision of report. This online store is mainly a shopping cart for customers and real time inventory control for admin with administration panel. Admin has proper report on orders and inventory. As per the follow-up to the project after the implementing multiple online-payment options through Google Checkout, PayPal and etc.
Objective:
Proposed online Book Store Management system provides very easy of buying Books.
It is more comfortable and flexible rather than offline System.
It takes very less time for processing of various tasks.
From any place user can get more information about various categories of books.
The advertisement work as an ideal task because through it people come to know about existing and upcoming books’ categories.
It can handle all the tasks very easily and accurately.
The process to store the data about customer and books is done by computer system so it provides much more accuracy and security.
process
[3] Project Category
Project Category: Internet / Intranet / RDBMS
[4] Feasibility Study
Feasibility Study :The feasibility study of Online- Book-Store the “TELOS” model which stand for Technical, Economic, Legal, Operational and Schedule feasibility was adopted. The feasibility study should answer the following questions: 1. Technic al and system Feasibi lity: does the technology exist to implement the proposed system? Is it a practical proposition? 2. Economic Feasibility: is the system cost-effective? Do benefits outweigh costs? 3. Legal Feasibilit y: is there any conflict between the proposed system and legal requirements? 4. Operational Feasibilit y: are the current work practices and procedures adequate to support the new system? 5. Schedule Feasibilit y: can the system be developed in time?
4.1 Technical and System Feasibility :The assessment is based on an outline design of system requirements in terms of Input, Processes, Output, Fields, Programs, and Procedures. This can be quantified in terms of volumes of data, trends, frequency of updating, etc. in order to estimate whether the new system will perform adequately or not. The following questions had been taken consider for the technical feasibility study for Online Book Store. A brief description of the business to assess more possible factor/s which could affect the study The part of the business being examined The human and economic factor The possible solutions to the problems •
• • •
To implement Online Book Store, commonly available technologies and platforms may be used and no new technology or platform is required. The networking is likely to fairly simple and single vendor may implement the whole system. The user and admin is required Broadband Internet connectivity with at least 60 Kbps speed with minimum system and browser software as client-side.
4.2 Economic Feasibility :Economic analysis is the most frequently used method for evaluating the effectiveness of a new system. More commonly known as cost/benefit analysis, the procedure is to determine the benefits and savings that are expected from a candidate system and compare them with costs. If benefits outweigh costs, then the decision is made to design and implement the system. An entrepreneur must accurately weigh the cost versus benefits before taking an action. Cost-based study: A broadband infrastructure is already available in all the branches. Use of Internet based network would thus minimize the expenses as no separate WAN will be required. Open source technology could easily be adopted to further minimize the cost of software. The client computers would merely be ordinary PCs connected to the Internet, which all the formations already have. The only thing required would be a database server, which is likely to cost not more than Rs.2 Lake, and is quite affordable. The benefits derived from the system far outweigh the cost. Time-based study: Installation of the entire application is have two parts. Front-end installation which needs to be add the files in server which may take more then half and hour and installing the database structure in the MICROSOFT SQL database which may require 10 minutes. Thus, the Online Book Store is economically feasible.
4.3 Legal Feasibility :Using this feasible study, we d etermine whether the proposed system conflicts with legal requirements. 1. All the user data and privacy will be safe. Our system have secured password algorithm to secure user data such as password, email and personal information. 2. At any time user can delete/remove their account from our application, which will remove entire data of the user. 3. Email addresses are not been used for any other purpose except the Online Book Store application. 4. Spam emails are not been sent to user’s email address only promotional emails will be sent to user’s email that too agreed users only. Thus, the Online Book Store is economically feasible.
4.4 Operational Feasibility :Operational feasibility is a measure of how well a proposed system solves the problems, and takes advantage of the opportunities identified during scope definition and how it satisfies the requirements identified in the requirements analysis phase of system development. All the data is stored in database, user can track their data using user’s panel. After checkout ordered books will be sent from admin to user’s delivery address and payment slip will be provided directly and the amount/cash will be collected directly as per the system. Thus, the Online Book Store is economically feasible.
4.5 Schedule Feasibilit y :Using SDLC approach the estimated project duration is 20 weeks approx. which comes to 5 months. It has been planned in a modular manner and one module may be developed more or less in parallel to another. Further, object orientation and code-reuse will be adopted during the development process. It is estimated that about 5 man months will be required to develop and implement the system, given the technology. Thus, it is feasible to complete the project as per the required schedule.
Nature of Feasib ilit y
Whether Feasibl e
Reason
Technical Feasibility
Does the technology exist to implement the proposed system? Is it a practical proposition?
FEASIBLE. Although the users of the system are spread over a wide area, due to the use of broadband internet at the locations and commonly available technologies, the project is technically feasible
Economic Feasibility
Is the system costeffective? Do benefits outweigh costs?
FEASIBLE. Use of cheap broadband internet, open source technology, low cost server and existing PCs as clients, the benefit derived from the system far outweighs the cost, making it economically feasible
Legal Feasibility
Is there any conflict between the proposed system and legal requirements?
FEASIBLE. As the operation is under the existing protocol to the Treaty of Transit and broad agreement between two governments to amend the protocol as per requirement and due to legal binding of the importers to adhere to the treaty, the system is legally feasible
Are the current work practices and procedures adequate to support the new system?
FEASIBLE. Procedures are based on the manual system described in the Protocol to Indo-Nepal Treaty of Transit, suitably amended to suit computerized processing and hence the system automates a known process. Users are not required to be trained on procedural aspects. Hence it is Operationally Feasible
Can the system be developed in time?
FEASIBLE. The system is required to be implemented in 5 months time while it is estimated to be developed in 5 man months if object orientation and code reuse are adopted. Hence it is feasible to complete the system as per required schedule
Operational Feasibility
Schedule Feasibility
[5] Software Requirement Specification (SRS)
5.1 Scope of the solution :Online Book Store is a web based online store portal, which sells books online. This system requires web application which includes shopping cart, members management and administration section. Vendors who are also selling books can use this application to sell their books through ‘Online Book Store’. This application deal with three types of users
Vendors Buyer Super user/Administrator Online Book Store allows user to view/browse the list of books and the user can add their books to shopping cart. Using the shopping cart section, user can purchase books online. When user is purchasing books through ‘Online Book Store’, user will be asked to enter their details with username and password. Once user purchased books successfully through Online Book Store application, My account section for user will be created. User can login his/her my account section using the username/password.
Purchase books online In user’s my account system contains the order history of the particular customer. Using the login section, member/user can add books to ‘wish-list’ which store the books details in the members my account section to purchase afterwards. Vendors who are selling books through can add their books details using vendors login/account section. After admin review, the details will be displayed in the Online Book-Store application. When user purchase the vendors books, the details will be immediately sent to vendors. Vendors will deliver the books to user/customers. Vendors section contains many other features such as
Books management – Add, view and delete books details Order management – View purchased books and set status of the order
Super user is the administrator of the site who has the access to view or edit or delete the entire system.
5.2 Software Requirements Specifications :Frond end: ASP.NET - ASP.NET is a widely used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Back end: Microsoft SQL - Microsoft SQL Enterprise Server software is the most reliable, secure and up-to-date version of Microsoft SQL for cost-effectively delivering Ecommerce, Online Transaction Processing (OLTP), and multi-terabyte Data Warehousing applications. It is a fully integrated transaction-safe, ACID compliant database with full commit, rollback, and crash recovery and row level locking capabilities. Microsoft SQL delivers the ease of use, scalability, and performance that has made Microsoft SQL the world's most popular open source database. Web Server: Asp.Net Server - The Asp.Net HTTP Server Project is a collaborative software development effort aimed at creating a robust, commercial-grade and freelyavailable source code implementation of an HTTP (Web) server. The project is jointly managed by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop the server and its related documentation.ASP.NET - ASP.NET is a widely used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. SOFTWARE REQUIREMENTS(RECOMMENDED) AT SERVER SIDE
Web Browser Server Requirements
:Standard web browser like Internet Explorer, Mozilla firebox etc :ASP.NET 5.0, Microsoft SQL server
HARDWARE REQUIREMENTS TO RUN THE APPLICATIONS
Operating System Processor RAM Hard-disk
: : : :
Windows OS INTEL I-3 2.9 GHZ 4GB DDR3 250 GB
HARDWARE USED WHILE DEVELOPING APPLICATION
Processor Ram Hard-disk
: : :
Intel Pentium IV 1.80 GHz. 1GB 250 GB
SOFTWARE USED WHILE DEVELOPING APPLICATION
OS Front tool Back End
: : :
Windows 7 and higher Asp.Net SERVER (Frame Work 4.0) Microsoft SQLSERVER 2008
MINIMUM HARDWARE AND SOFTWARE REQUIRED AT CLIENT LEVEL • •
Any browser, which is XHTML 1.0 compatible like Microsoft Internet 6.0. Any hardware which support above said browser.
5.3 Software Engineering Paradigm : As the application domains of software are becoming complicated and design of big software without a systematic approach is virtually impossible, the field of software engineering is increasingly gaining importance. It is now developing like an industry. The waterfall model provides a systematic and sequential approach to software development and is better than the build and fix approach. But the requirements should be available at the time of commencement of the project. There is no method to judge the problems of software in between different phases. The waterfall model with feedback is as follows:
Requirement Analysis
System Design
Coding
Testing
Maintenance
[6] Requirement of Analysis
6.1 Data Flow Diagram:-
Context Level Diagram: Search Book
Place Order Make Payment
Customer
Get Customer Details
Get Book, Bill,Receipt
Online Book Store Management System
Get Payment
Get BookDetails
Dispetch Order
Admin
1st Level Diagram of Online Book Store System: Manage Master Table
Admin
1.0
Get Update Data For Master Table
Admin
Order the Book Make the Payment
Customer Get Books Get Reports
2.0
Get & Receive Customer details
G e t & R e ce S a le s D iv e t h e e ta il s
Send Book Details
3.0
Order to Purchase Book
Purchase Make the Payment
s e i l s h c r a P u D e t e k h d t B o o n e r S e h s i l b t h e P u S e n d e t a i ls l ie r D p p u S S e n d t h e B o o k P u rc h s e D e t a il s
Get the Receipt
4.0 Print The reports
Reports
Get Report
Book
Book Sales
Get Book
Admin
Sales
a l e s S e h t S e n d D e t a i ls B o o k
S e n d t h e P u b li s D e ta i ls h e r
Supplier
Customer
s e h c r P u e t h d t e p o r n S e R r O r d e e h t S e n d p o r ts R e S e P a y m n d t h e e n t R e po r t
Publisher
Supplier
Purchase
Order
Payment
Send the Sales Report Send the Customer Report
2nd Level Diagram of Onli ne Book Store System: Fill the form
Customer Send the customer details
1.1 Customer Details
Customer
Search the data Receive the Data Categories 1.2 Book Search
r e e m o t s u C o T r e v i l e D
Get the data
G e P u b t t h e l i c Publication a D e t i o t n a i l s
Order of books
Fetch the Order Order detail Deatils Order s e nd t h e o r r d a t a de S e n d t Order h 1.3
e d e a s t a t t i l s u s
Order Payment Confirm the Order r e d r o f o s e l i t a d e h t t e G
Admin
Book
1.5 Dispatch
Order Status 1.4 Payment
Payment Deatils
Payment
3rd Level Diagram of Onli ne Book Store System: Store Publication data Store Book data Store Categories data Store Customer data Fill the Table Data
Admin Send the customer details
2.1 Table Selection
Customer
Search the table data Receive the Data Categories 2.2
r e s U o t m r i f n o C
Table Manage
Get the data
G e t P u b l i c a t i o n G Publication e t d a t a o r d e r G e t d e t O a i r d l s e r Order d a Deatils a G G t
Correct the data
2.3 DataEntry
e e t t P O r d a e y m r e n S t t a t D u s e t a i l s
Validate the Data
2.5
Book
Order
Order Status
2.4
Store the data
Validation Payment
Storage Store Payment data Store Order Status data Store Order data
Store Order Details data
4th Level Diagram of Onli ne Book Store System:
Admin
Fill the Report Form
4.1 Report Selection
t n i r P t r o p e R m r i f n o C
Prepare Report Datat
4.2 Report Prepration
Finally report Check & Print
4.3
t a i l Customer e d r t o m e s u C G e t G e t C a ta Categories g o r ie s D G e e t ai ls t B o
o k D e G e t a i t P l s u b l i c a G t i o n e t D a O t a r d e r G D e t e t a i o l s r d e r D a t G a e t O r d G e e r t S P t a a t u y s m e n t D e t a il s
Book
Publication
Order Details
Order
Order Status
Report Print Payment
[7] Process Logic
Process Logic :1. Admin Side Algor ithm : Step 1: Start Step 2: Check User is Register or Not Step 3: If (User is not Register) then; Call Regis ter(); else Login(); Enter UserName Enter Password End step 4: Stop.
Manage Choice Of Master Algorithm : Step 1: Start Step 2: Select Admin Process 1. Book 2. Order 3. Payment 4. Publication 5. Purchase 6. Supplier step 3: Select Choice Step 4: Do Accept Process Step 5: Stop.
Manage Book Master Al gori thm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) BookAdd(); Enter Book_Id Enter Book_Nm Enter Search_Keyword Search Image
Select Category_Id Enter Status Option:-
Validate data Store data
Book Modify(); Search Book_Id Option:Update record Store data Book Delete(); Search Book_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Order Master Algo rit hm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) OrderAdd(); Enter Order_Id Enter Order_date Enter Description Enter Totquantity Enter Stock_Id Option:-
Validate data Store data
Order Modify(); Search Order_Id Option:-
Update record Store data
Order Delete(); Search Order_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Payment Master Al gor ith m: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PaymentAdd();
Enter Slip_No Enter Payment_type Enter TotPayment Enter Bank_Nm Enter Branch_Nm Enter Date_Of_Payment Enter Cheque_No Enter Cheque_Date Enter Cust_Id Enter Courier_Id Enter Book_Id Option:-
Validate data Store data
Payment Modify(); Search Slip_No Option:-
Update record Store data
Payment Delete(); Search Slip_No Delete the record. Do u Want to Delete? step 3: Stop.
Manage Publi cation Master A lgor ithm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PublicationAdd(); Enter Pub_Id Enter Pub_Nm Enter Price Enter Address Enter Email_Id Enter Contact_No Option:-
Validate data Store data Publication Modify (); Search Pub_Id Option:-
Update record Store data
Publication Delete(); Search Pub_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Purchase Master Algorithm : Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PurchaseAdd(); Enter Pur_Id Enter Pur_Nm Enter Order_Id Enter Totpayment Enter Totquantity Enter Sup_Id Enter Date_of_Purchase Option:Validate data Store data Purchase Modify(); Search Pur_Id Option:Update record Store data Purchase Delete(); Search Pur_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Supplier Master Algorithm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) SupplierAdd(); Enter Sup_Id Enter Sup_Nm Enter ContactPerson_Nm Enter Address Enter Contact_No Enter Mobile_No Enter Email_Id Enter Gender
Enter Country_Id Enter State_Id Enter City_Id Enter Zipcode Option:-
Validate data Store data
Supplier Modify(); Search Sup_Id Option:-
Update record Store data
Suppli er Delete(); Search Sup_Id Delete the record. Do u Want to Delete? step 3: Stop.
2. Client Side Algorithm: Step 1: Start Step 2: Display the Home Page. Step 3: If (User is not Register) then; Client Register(); Enter Id Enter User_Nm Enter Password Enter User_type Enter Email_Id Enter First_Nm Enter Middle_Nm Enter Last_Nm Enter Contact_No Enter Address Enter Gender Enter Country_Id Enter State_Id Enter City_Id Enter ZipCode Option:-Validate data Store data else Login(); Enter UserName Enter Password
End step 4: Stop.
Manage Client Side Purc hase Process: Step 1: Start Step 2: Show the Book Menu Step 3: Display The Book Name Step 4: Search the Book Step 5: Add the Cart Step 6: Place the Order Step 7: Paid the Amount Step 8: Stop.
Manage Client Side Order Process: Step 1: Start Step 2: Show the Book Menu Step 3: Display the Book Name Step 4: Search the Book Key Word Step 5: Show the Book & Price with Publication Name & Author Name. Step 6: If (User Purchase Book) Add the Cart Place the Order Paid the Amount Finish Else Finish End Step 7: Stop.
[8] Data Structure
Data Structure:Chapter 6: Data Structure
1.Admin: FieldName Id User_Nm Password User_type Email_Id First_Nm Middle_Nm Last_Nm Contact_No Address Gender Country_Id State_Id City_Id ZipCode
Size 10 30 18 20 50 20 20 20 12 50 10 10 10 10 10
DataType Numeric Varchar Varchar Varchar Varchar Varchar Varchar Varchar Numeric Varchar Char Numeric Numeric Numeric Numeric
Validation PrimaryKey Not null Not null Not null Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null
DatType Numeric Varchar Numeric Varchar Numeric Numeric
Validation PrimaryKey Not null Not null Not Null Foreign Key Not null
Size 10 30 30
DataType Numeric Varchar Varchar
Validation PrimaryKey Not null Not null
Size 10 30 10
DataType Numeric Varchar Numeric
Validation PrimaryKey Not null Foreignkey
2.Book: FieldName Book_Id Book_Nm Search_Keyword Image Cate_Id Status
Size 10 30 10 50 10 10
3.Category: FieldName Cate_Id Cate_Nm Description
4.City: FieldName City_Id City_Nm State_Id
5.Country: FieldName Country_Id Country_Nm Country_Alias
Size 10 30 15
DataType Numeric Varchar Varchar
Validation PrimaryKey Not null Not null
Size 10 30 10 10 30 30
DataType Numeric Varchar Date Date Varchar Varchar
Validation Primarykey Not null Not null Not null Not null Not null
Size 10 20 20 20 12 50 50 10 10 10 10 10 10
Datatype Numeric Varchar Varchar Varchar Numeric Varchar Varchar Numeric Numeric Numeric Numeric Date Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null Not null Not null
Size 10 10 10 30 30
Datatype Numeric Numeric Date Varchar Varchar
Validation Primarykey Foreignkey Not null Not null Not null
Size 10 10 30 10 10
Datatype Numeric Date Varchar Numeric Numeric
Validation Primarykey Not null Not null Not null Foreignkey
6.Courier : FieldName Courier_Id Courier_Nm Delivery_date Receiving_date Source Destination
7.Customer: Fieldname Cust_Id First_Nm Middle_Nm Last_Nm Contact_No. Email_Id Address Country_Id State_Id City_Id Zipcode Date_of_purchase Status
8.Delivery_Status: Fieldname Status_Id Courier_Id Date_Of_Purchase Source Destination
9.Order Master: Fieldname Order_Id Order_date Description Totquantity Stock_Id
10.Order_Detail: Fieldname Order_Id Book_id Totquantity Price TotAmount
Size 10 10 10 10 10
Datatype Numeric Numeric Numeric Numeric Numeric
Validation Foreignkey Foreignkey Not null Not null Not null
Size 10 10 10 30 30 10 10 20 10 10 10
Datatype Numeric Varchar Numeric Varchar Varchar Date Date Varchar Numeric Numeric Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey
Size 10 30 10 50 20 10
Datatype Numeric Varchar Numeric Varchar Varchar Numeric
Validation Primarykey Not null Not null Not null Not null Not null
11.Payment: Fieldname Slip_No Payment_type Totpayment Bank_Name Branch_Name Date_Of_Payment Cheque_date Cheque_No Cust_Id Courier_Id Book_Id
12.Publication: Fieldname Pub_Id Pub_Nm Price Address Email_Id Contact_No
13.Purchase: Fieldname Pur_Id Pur_Nm Order_Id Totpayment Totquantity Cust_Id Sup_Id Date_Of_Purchase
Size 10 30 10 10 10 10 10 10
Datatype Numeric Varchar Numeric Numeric Numeric Numeric Numeric Date
Validation Primarykey Not null Foreignkey Not null Not null Foreignkey Foreignkey Not null
14.Purchase_Detail: Fieldname Trans_Id Pur_Id Book_Id Quantity Price
Size 10 10 10 10 10
Datatype Numeric Numeric Numeric Numeric Numeric
Validation Primarykey Foreignkey Foreignkey Not null Not null
Size 10 30 10
Datatype Numeric Varchar Numeric
Validation Primarykey Not null Foreignkey
Size 10 10 10
Datatype Numeric Numeric Numeric
Validation Primarykey Foreignkey Not null
Size 10 30 30 10
Datatype Numeric Varchar Varchar Numeric
Validation Primarykey Not null Not null Foreignkey
15.State: Fieldname State_Id State_Nm Country_Id
16.Stock: Fieldname Stock_Id Book_Id Totquantity
17.Subject: Fieldname Sub_Id Sub_Nm Author_Nm Pub_Id
18.Supplier: Fieldname Sup_Id Sup_Nm Contactperson_Nm Address Contact_No Mobile_No Email_Id Gender Country_Id State_Id City_Id Zipcode
Size 10 30 30 50 10 10 30 10 10 10 10 10
Datatype Numeric Varchar Varchar Varchar Numeric Numeric Varchar Char Numeric Numeric Numeric Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null
[9] Data Model / Schema Diagram
Data Model Diagram:Country PK,I1 Country_Id
Country_Nm Country_Alias
Book PK,I1 Book_Id
Book_Nm Search_Keyword
State PK,I3
State_Id
State_Nm FK1,I2,I1 Country_Id
Courier
Customer
PK Courier_Id
PK,I5
Cust_Id
I6 FK2,I4,I3 FK3,I8,I7 FK1,I1,I2
First_Nm Middle_Nm Last_Nm Contact_No Em ail_ Id Address Gender Country_Id State_Id City_ID Purchase_Date
City PK,I1
Courier_Nm Delivery_Date Receiving_Date Source Destination
Payment
Stock PK,I2 Stock_Id
PK
Slip _No
FK1,I1 Book_Id Totquantity
FK3,I6,I5 FK2,I4,I3 FK1,I2,I1
Payment_Type TotPayment Bank_Nm Branch_Nm Date_Of_Payment Cheque_Date Cheque_No Cust_Id Courier_Id Book_Id
Order PK,I1
Order_Id
FK1,I3,I2
Order_Date Description Totquantity Stock_Id
City_Nm FK1,I3,I2 State_Id
Admin
Delivery_Status PK,I 4
Status_Id
I1 FK1,I3,I2
C ou ri er _I d Date_Of_Purchase Source Destination Cust_Id
Order_Detail
Cit y_Id
P K, I6
Id
I5 FK2,I4,I3 FK3,I8,I7 FK1,I2,I1 I9
User_Nm Password User_type Em ail_ Id First_Nm Middle_Nm Last_Nm Contact_No Address Gender Country_Id State_Id City_Id Zipcode
Purchase PK,I5
Pur_Id
FK2,I4,I3 FK1,I2,I1 FK3,I7,I6
Pur_Nm Order_Id TotPayment Totquantity Cust_Id Sup_Id Date_Of_Purchase
Category FK2,I4,I3 FK1,I2,I1
Order_Id Book_Id Totquantity Price TotAmount
Purchase_Details PK,I5
Trans_Id
FK2,I4,I3 FK1,I2,I1
Pur_Id Book_Id Quantity Price
PK,I1 Cate_Id
Cate_Nm Description
Publication PK,I6
Pub_Id
I5 FK2,I4,I3 FK3,I8,I7 FK1,I2,I1 I9
Pub_Nm Price Address Ema il_ Id Contact_No Mobile_No Country_Id State_Id City_Id Zipcode
Supplier PK,I5 Sup_Id
Subject PK,I3
Sub_Id
Sub_Nm Author_Nm FK1,I2,I1 Pub_Id
I3 I2 I4 I1 I6
Sup_Nm ContactPerson_Nm Address Contact_No Mobile_No E ma il _I d Gender Country_Id S ta te _I d C it y_ Id Z ip co de
[10] Input / Output (Screen Shot)
City(save)
City(update)
city (delete)
Stock(save)
stock(update)
Stock(delete)
[11] Coding
11.1 Coding:using using using using
System; System.Collections; System.Configuration; System.Data;
using using using using using using using using
System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_login : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); con.Open(); Txtpswd.TextMode = TextBoxMode.Password; } } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); }
protectedvoid btnlogin_Click(object sender, EventArgs e) { SqlCommand cmd = newSqlCommand("select * from Admin where User_name='" + Txtusrnm.Text + "' and Password='" + Txtpswd.Text + "'", con); cmd.CommandType = CommandType.Text; SqlDataReader red = cmd.ExecuteReader(); if (red.Read()) { Session["unm"] = Txtusrnm.Text; Response.Redirect("welcomepage.aspx"); } else { Label1.Text = "UserName And Password are Wrong...."; Txtusrnm.Text = ""; Txtpswd.Text = ""; } red.Close(); cmd.Dispose(); }
protectedvoid lbnfrgtpswd_Click(object sender, EventArgs e) { Response.Redirect("forgotpassword.aspx"); } protectedvoid lbnchngpswd_Click(object sender, EventArgs e) { Response.Redirect("changepassword.aspx"); } }
using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient;
publicpartialclassAdmin_Default : System.Web.UI.Page { protectedvoid Page_Load(object sender, EventArgs e) { } protectedvoid LinkButton1_Click(object sender, EventArgs e) { Response.Redirect("book.aspx"); } protectedvoid LinkButton2_Click(object sender, EventArgs e) { Response.Redirect("Category.aspx"); } protectedvoid LinkButton3_Click(object sender, EventArgs e) { Response.Redirect("Country.aspx"); } protectedvoid LinkButton4_Click(object sender, EventArgs e) { Response.Redirect("Customer.aspx"); } protectedvoid LinkButton5_Click(object sender, EventArgs e) { Response.Redirect("OrderMaster.aspx"); } protectedvoid LinkButton6_Click(object sender, EventArgs e) { Response.Redirect("publication.aspx"); } protectedvoid LinkButton7_Click(object sender, EventArgs e) { Response.Redirect("state.aspx"); } protectedvoid LinkButton8_Click(object sender, EventArgs e) { Response.Redirect("city.aspx"); } protectedvoid LinkButton9_Click(object sender, EventArgs e) { Response.Redirect("Subject.aspx"); } protectedvoid LinkButton10_Click(object sender, EventArgs e)
{ Response.Redirect("Supplier.aspx"); } protectedvoid LinkButton11_Click(object sender, EventArgs e) { Response.Redirect("Purchase.aspx"); } protectedvoid lbncourier_Click(object sender, EventArgs e) { Response.Redirect("Courier.aspx"); } protectedvoid lbndelstatus_Click(object sender, EventArgs e) { Response.Redirect("Deliverystatus.aspx"); } protectedvoid lbnodrdetl_Click(object sender, EventArgs e) { Response.Redirect("OrederDetail.aspx"); } protectedvoid lbnpymnt_Click(object sender, EventArgs e) { Response.Redirect("Payment.aspx"); } protectedvoid lbnprchsdetl_Click(object sender, EventArgs e) { Response.Redirect("PurchseDetail.aspx"); } }
using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; System.Net.Mail; System.Data;
publicpartialclassAdmin_forgotpassword : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); // con.Open(); bindadmin(); // clear(); } }
protectedvoid opneconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); }
protectedvoid closeconn() { con.Close(); }
protectedvoid bindadmin() { SqlCommand cmd = newSqlCommand("SP_Readadmin", con); cmd.CommandType = CommandType.StoredProcedure; opneconn(); drpscrtquesn.DataSource = cmd.ExecuteReader(); drpscrtquesn.DataTextField = "Secret_question"; drpscrtquesn.DataBind(); closeconn(); } protectedvoid btnsbmit_Click(object sender, EventArgs e) {
} protectedvoid btnback_Click(object sender, EventArgs e) { Response.Redirect("loginpage.aspx"); } protectedvoid btnsbmit_Click1(object sender, EventArgs e) { try { DataSet ds = newDataSet(); { con.Open(); SqlCommand cmd = newSqlCommand("select * from Admin where User_name='" + Txtusrnm.Text + "' and Secret_question='" + drpscrtquesn.SelectedValue + "'", con); SqlDataAdapter da = newSqlDataAdapter(cmd); da.Fill(ds); con.Close(); } if (ds.Tables[0].Rows.Count > 0) { MailMessage Msg = newMailMessage(); Msg.From = newMailAddress(Txtusrnm.Text); Msg.To.Add(Txtusrnm.Text); Msg.Subject = "Your Password Details"; Msg.Body = "Hi,
Please check your Login Detailss
Your Username: " + ds.Tables[0].Rows[0]["UserName"] + "
Your Password: " + ds.Tables[0].Rows[0]["Password"] + "
"; Msg.IsBodyHtml = true; SmtpClient smtp = newSmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("
[email protected]", "094386099"); smtp.EnableSsl = true; smtp.Send(Msg); lblmsg.Text = "Your Password Details Sent to your mail"; Txtusrnm.Text = ""; } else { lblmsg.Text = "The Email you entered not exists."; } } catch (Exception ex)
{ Console.WriteLine("{0} Exception caught.", ex); } } }
using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient;
publicpartialclassAdmin_changepassword : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) {
if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); con.Open(); } } protectedvoid Button1_Click(object sender, EventArgs e) { string strg = "select count(*) from Admin where User_name='" + Txtusrnm.Text + "' and Password='" + Txtpswd.Text + "'"; SqlCommand cmd = newSqlCommand(strg, con); if (Convert.ToString(cmd.ExecuteScalar()) == "0") { Label1.Text = "Wrong User Name and Pass "; } else { if (Txtnewpswd.Text == Txtcnfrmpswd.Text) { string strgs = "Update Admin set Password='" + Txtcnfrmpswd.Text Txtusrnm.Text + "'"; SqlCommand cmds = newSqlCommand(strgs, con); if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); cmds.ExecuteNonQuery(); Label2.Text = "your password is changed"; con.Close(); }
} } }
+
"'
where
User_name='"
+
using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox; System.IO;
publicpartialclassAdmin_BOOK : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); Bindgrid(); bindcategory(); } } publicvoid bindcategory() { SqlCommand cmd = newSqlCommand("SP_ReadCategorys", con); cmd.CommandType = CommandType.StoredProcedure; OpenConn(); drpcatenm.DataSource = cmd.ExecuteReader(); drpcatenm.DataTextField = "Cate_name"; drpcatenm.DataValueField = "Cate_id"; drpcatenm.DataBind(); CloseConn(); } protectedvoid Bindgrid() { SqlCommand cmd = newSqlCommand("SP_ReadBooks", con); cmd.CommandType = CommandType.StoredProcedure; OpenConn(); GridView1.DataSource = cmd.ExecuteReader(); GridView1.DataBind(); CloseConn(); } protectedvoid OpenConn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid CloseConn() { con.Close(); } protectedvoid Save_Click(object sender, EventArgs e) { if (btnsave.Text == "Save")
{ try { string filenames1 = System.IO.Path.GetFileName(FileUpload1.FileName.ToString()); FileUpload1.SaveAs(Server.MapPath("~/Images/" +filenames1.ToString())); SqlCommand cmd = newSqlCommand("SP_InsertBooks", con); cmd.CommandType = CommandType.StoredProcedure; OpenConn(); SqlParameter prm = newSqlParameter("@BOOKNAME", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbooknm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@SEARCHKEYWORD", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtserachkeywrd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@IMAGENAME", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = FileUpload1.FileName.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@CATEGORYID", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcatenm.SelectedValue.ToString(); cmd.Parameters.Add(prm); string Stat = ""; if (Active.Checked) Stat = "Yes"; else Stat = "No.";
prm = newSqlParameter("@PUBLICATIONID", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drppubnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@STATUS", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm); prm = newSqlParameter("@SUBJECT", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm); prm = newSqlParameter("@AUTHORDETAIL", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery();
CloseConn(); MessageBox.Show("Data has been saved"); Bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
else { try { string filenames1 = System.IO.Path.GetFileName(FileUpload1.FileName.ToString()); FileUpload1.SaveAs(Server.MapPath("~/Images/" + filenames1.ToString())); SqlCommand cmd = newSqlCommand("SP_updatebooks", con); cmd.CommandType = CommandType.StoredProcedure; OpenConn(); SqlParameter prm = newSqlParameter("@BOOKNAME", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbooknm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@SEARCHKEYWORD", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtserachkeywrd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@IMAGENAME", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = FileUpload1.FileName.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@CATEGORYID", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcatenm.SelectedValue.ToString(); cmd.Parameters.Add(prm); string Stat = ""; if (Active.Checked) Stat = "Yes"; else Stat = "No.";
prm = newSqlParameter("@PUBLICATIONID", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drppubnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@STATUS", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm);
prm = newSqlParameter("@SUBJECT", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsub.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@AUTHORDETAIL", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtauthrnm.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@BOOKID", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Book_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery();
CloseConn(); MessageBox.Show("Data updated"); Bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } } protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Book_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editbooks", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@bookid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); OpenConn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtbooknm.Text = red["Book_name"].ToString(); Txtserachkeywrd.Text = red["Search_keyword"].ToString(); drpcatenm.SelectedItem.Text = red["Cat_id"].ToString(); drppubnm.SelectedItem.Text = red["Pub_id"].ToString(); Txtsub.Text = red["Subject"].ToString(); Txtauthrnm.Text = red["Author_Detail"].ToString();
} btnsave.Text = "Update"; CloseConn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletebooks", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@bookid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString();
cmd.Parameters.Add(prm); OpenConn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); Bindgrid(); CloseConn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } Bindgrid(); } } protectedvoid GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit");
lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtbooknm.Text = ""; Txtserachkeywrd.Text = ""; drpcatenm.SelectedIndex = 0; drppubnm.SelectedIndex = 0; Active.Text = ""; Txtsub.Text = ""; Txtauthrnm.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Category : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); }
} publicvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_ReadCategorys", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); GridView1.DataSource = cmd.ExecuteReader(); GridView1.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Categorys", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@categoryname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcatnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@description", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtdscptn.Text; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updateCategorys", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@categoryname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcatnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@description", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input;
prm.Value = Txtdscptn.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@categoryid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Cate_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } } protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Cate_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editCategorys", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@categoryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtcatnm.Text = red["Cate_name"].ToString(); Txtdscptn.Text = red["Description"].ToString(); } btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deleteCategorys", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@categoryid", SqlDbType.Int);
prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); }
}
protectedvoid btnreset_Click(object sender, EventArgs e) { Txtcatnm.Text = ""; Txtdscptn.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Country : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid();
} } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("Sp_Readcountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_country.DataSource = cmd.ExecuteReader(); Grid_country.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("Sp_Insertcountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@countryname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntrynm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryalias", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntryalias.Text; cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Country Registered"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("Sp_updatecountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@countryname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntrynm.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@countryalias", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntryalias.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Country_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Country updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_country_RowCommand(object sender, { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
GridViewCommandEventArgs e)
ViewState["Country_id"] = id;
SqlCommand cmd = newSqlCommand("Sp_editcountry", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@Countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtcntrynm.Text = red["Country_name"].ToString(); Txtcntryalias.Text = red["Country_alias"].ToString();
} btnsave.Text = "Update"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("Sp_deletecountry", con);
cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_country_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtcntrynm.Text = ""; Txtcntryalias.Text = ""; } }
City coding c# using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_City : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) {
if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindstate(); } } publicvoid bindstate() { SqlCommand cmd = newSqlCommand("SP_ReadState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpstatenm.DataSource = cmd.ExecuteReader(); // drpstatenm.DataTextField = "State_name"; drpstatenm.DataValueField = "State_id"; drpstatenm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_ReadCity", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_City.DataSource = cmd.ExecuteReader(); Grid_City.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("Sp_insertcity", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@cityname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcitynm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstatenm.Text; cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data Saved");
bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updateCity", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@cityname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcitynm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstatenm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@cityid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["City_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("CITY Update"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_City_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try { ViewState["City_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editCity", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@city_id", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader();
while (red.Read()) { Txtcitynm.Text = red["City_name"].ToString(); drpstatenm.SelectedItem.Text = red["State_id"].ToString();
} btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deleteCity", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@City_id", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_City_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtcitynm.Text = ""; drpstatenm.SelectedIndex = 0; } }
Stock coding c# using System; using System.Collections;
using using using using using using using using using using using using
System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_stock : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindbook();
}
} protectedvoid bindbook() { SqlCommand cmd = newSqlCommand("SP_ReadBooks", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpbooknm.DataSource = cmd.ExecuteReader(); drpbooknm.DataTextField = "Book_name"; drpbooknm.DataValueField = "Book_id"; drpbooknm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readstock", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_stock.DataSource = cmd.ExecuteReader(); Grid_stock.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Insertstock", con);
cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@bookid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@totalquantity", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updatestock", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@bookid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@totalquantity", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@stockid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Stock_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_stock_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Stock_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editstock", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@stockid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { drpbooknm.SelectedItem.Text = red["Book_id"].ToString(); Txttotqun.Text = red["Tot_quantity"].ToString();
} btnsave.Text = "Update"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletestock", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@stockid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_stock_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e)
{ drpbooknm.SelectedIndex = 0; Txttotqun.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassCourier : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); } } publicvoid bindgrid() { SqlCommand cmd = newSqlCommand("Sp_ReadCourier", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_courier.DataSource = cmd.ExecuteReader(); Grid_courier.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try {
SqlCommand cmd = newSqlCommand("Sp_Insertcourier", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@couriername", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcouriernm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@deliverydate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdlvrydt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@receivingdate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtrecvngdt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@source", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsource.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@destination", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtdstntn.Text; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } else { try { SqlCommand cmd = newSqlCommand("SP_updatecourier", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@couriername", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcouriernm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@deliverydate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdlvrydt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@receivingdate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtrecvngdt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@source", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsource.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@destination", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtdstntn.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@courierid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Courier_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} }
} protectedvoid Grid_courier_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Courier_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editcourier", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@courierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtcouriernm.Text = red["Courier_name"].ToString(); Txtdlvrydt.Text = red["Delivery_date"].ToString(); Txtrecvngdt.Text = red["Receiving_date"].ToString(); Txtsource.Text = red["Source"].ToString(); Txtdstntn.Text = red["Destination"].ToString(); } btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletecourier", con);
cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@courierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_courier_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtcouriernm.Text = ""; Txtdlvrydt.Text = ""; Txtrecvngdt.Text = ""; Txtdstntn.Text = ""; Txtsource.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Customer : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid();
bindcountry(); bindstate(); bindcity(); } } publicvoid bindcountry() { SqlCommand cmd = newSqlCommand("Sp_Readcountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcntry.DataSource = cmd.ExecuteReader(); drpcntry.DataTextField = "Country_name"; drpcntry.DataValueField = "Country_id"; drpcntry.DataBind(); closeconn(); } publicvoid bindstate() { SqlCommand cmd = newSqlCommand("SP_ReadState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpstate.DataSource = cmd.ExecuteReader(); drpstate.DataTextField = "State_name"; drpstate.DataValueField = "State_id"; drpstate.DataBind(); closeconn(); } publicvoid bindcity() { SqlCommand cmd = newSqlCommand("SP_ReadCity", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcity.DataSource = cmd.ExecuteReader(); drpcity.DataTextField = "City_name"; drpcity.DataValueField = "City_id"; drpcity.DataBind(); closeconn();
} protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readcoustomers", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_customer.DataSource = cmd.ExecuteReader(); Grid_customer.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") {
try { SqlCommand cmd = newSqlCommand("SP_Insertcoustomers", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@firstname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtfstnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@middlename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtmdlnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@lastname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtlastnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectno", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntcno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntry.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstate.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@cityid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcity.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@zipcode", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtzipcode.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@dateofpurchase", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm); string Stat = ""; if (Active.Checked) Stat = "Yes"; else Stat = "No."; prm = newSqlParameter("@status", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updatecoustomers", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@firstname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtfstnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@middlename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtmdlnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@lastname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtlastnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectno", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntcno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntry.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstate.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@cityid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcity.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@zipcode", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtzipcode.Text;
cmd.Parameters.Add(prm);
prm = newSqlParameter("@dateofpurchase", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm); string Stat = ""; if (Active.Checked) Stat = "Yes"; else Stat = "No."; prm = newSqlParameter("@status", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Stat; cmd.Parameters.Add(prm); prm = newSqlParameter("@customerid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Cust_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Customer updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtfstnm.Text = ""; Txtmdlnm.Text = ""; Txtlastnm.Text = ""; Txtcntcno.Text = ""; Txtemailid.Text = ""; Txtadd.Text = ""; drpcntry.SelectedIndex = 0; drpstate.SelectedIndex = 0; drpcity.SelectedIndex = 0; Txtzipcode.Text = ""; Txtdop.Text = ""; Active.Text = ""; } protectedvoid Grid_customer_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Cust_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editcoustomers", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@customerid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtfstnm.Text = red["First_name"].ToString(); Txtmdlnm.Text = red["Middle_name"].ToString(); Txtlastnm.Text = red["Last_name"].ToString(); Txtcntcno.Text = red["Contect_no"].ToString(); Txtemailid.Text = red["Email_id"].ToString(); Txtadd.Text = red["Address"].ToString(); drpcntry.SelectedItem.Text = red["Country_id"].ToString(); drpstate.SelectedItem.Text = red["State_id"].ToString(); drpcity.SelectedItem.Text = red["City_id"].ToString(); Txtzipcode.Text = red["Zip_code"].ToString(); Txtdop.Text = red["Date_of_purchase"].ToString();
} btnsave. btnsave.Text Text = "Update"; "Update"; closeconn(); } catch (Exception ex) { MessageBo MessageBox.Show(ex x.Show(ex.Message. .Message.ToString( ToString()); )); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletecoustomers", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@coustomerid", SqlDbType.Int); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = id.To id.ToString(); String(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); bindgrid bindgrid(); (); closeconn(); } catch (Exception ex) { MessageBo MessageBox.Show(ex x.Show(ex.Message. .Message.ToString( ToString()); )); } bindgrid( bindgrid(); ); }
} protected protectedvoid void Grid Grid_customer _customer_RowCreat _RowCreated(object ed(object sender, GridViewRo GridViewRowEventArg wEventArgs s e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString();
} } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpar publicpartialclass tialclassAdmin_Ord Admin_OrderMaster erMaster : System.W System.Web.UI.Pag eb.UI.Page e { publicsta publicstaticSqlCon ticSqlConnection nection con; con; protected protectedvoid void Page Page_Load(obj _Load(object ect sende sender, r, EventAr EventArgs gs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid( bindgrid(); );
} } protected protectedvoid void bind bindgrid() grid() { SqlCommand cmd = newSqlCommand("SP_Readordermaster", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_ordrmaster.DataSource = cmd.ExecuteReader(); Grid_ordrmaster.DataBind(); closeconn(); } protected protectedvoid void open openconn() conn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protected protectedvoid void clos closeconn() econn() { con.Close(); } protected protectedvoid void btns btnsave_Click ave_Click(object (object sender, sender, EventArgs EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Insertordermaster", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@orderdate", SqlDbType.DateTime);
prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = Txtor Txtordrdt.Text; drdt.Text; cmd.Parameters.Add(prm); prm = newSqlParam newSqlParameter("@des eter("@description" cription", , SqlDbTy SqlDbType.VarCha pe.VarChar); r); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = Txtds Txtdscpsn.Text; cpsn.Text; cmd.Parameters.Add(prm);
prm = newSqlParam newSqlParameter("@tot eter("@totalquantit alquantity", y", SqlDb SqlDbType.Int) Type.Int); ; prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Value = Txttot Txttotqun.Text; qun.Text; cmd.Parameters.Add(prm);
prm = newSqlParam newSqlParameter("@sto eter("@stockid", ckid", SqlDbType.I SqlDbType.Int); nt); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = drpst drpstocknm.Sele ocknm.SelectedValue ctedValue.ToString .ToString(); (); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBo MessageBox.Show("O x.Show("OrderMaste rderMaster r registe register"); r"); bindgrid bindgrid(); (); } catch (Exception ex) { MessageBo MessageBox.Show(ex x.Show(ex.Message. .Message.ToString( ToString()); )); } } else { try { SqlCommand cmd = newSqlCommand("SP_updateordermaster", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@orderdate", SqlDbType.DateTime); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = Txtor Txtordrdt.Text; drdt.Text; cmd.Parameters.Add(prm); prm = newSqlParam newSqlParameter("@des eter("@description" cription", , SqlDbTy SqlDbType.VarCha pe.VarChar); r); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = Txtds Txtdscpsn.Text; cpsn.Text; cmd.Parameters.Add(prm);
prm = newSqlParam newSqlParameter("@tot eter("@totalquantit alquantity", y", SqlDb SqlDbType.Int) Type.Int); ; prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = Txtto Txttotqun.Text; tqun.Text; cmd.Parameters.Add(prm);
prm = newSqlParam newSqlParameter("@sto eter("@stockid", ckid", SqlDbType.I SqlDbType.Int); nt); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = drpst drpstocknm.Sele ocknm.SelectedValue ctedValue.ToString .ToString(); (); cmd.Parameters.Add(prm); prm = newSqlParam newSqlParameter("@ord eter("@orderid erid ", SqlDbType. SqlDbType.Int); Int); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = ViewS ViewState["Orde tate["Order_id"].To r_id"].ToString(); String(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery();
closeconn(); MessageBo MessageBox.Show("O x.Show("OrderMaste rderMaster r update" update"); ); bindgrid bindgrid(); (); } catch (Exception ex) { MessageBo MessageBox.Show(ex x.Show(ex.Message. .Message.ToString( ToString()); )); } } } protected protectedvoid void btnr btnreset_Clic eset_Click(object k(object sender, EventArgs EventArgs e) e) { Txtordrdt.Text = ""; Txtdscpsn.Text = ""; Txttotqun.Text = ""; drpstocknm.SelectedIndex = 0; } protected protectedvoid void Grid Grid_ordrmast _ordrmaster_RowCom er_RowCommand(objec mand(object t sender, GridViewC GridViewCommandEven ommandEventArgs tArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState ViewState["Order_i ["Order_id"] d"] = id;
SqlCommand cmd = newSqlCommand("SP_editordermaster", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Dire prm.Direction ction = ParameterDi ParameterDirection.I rection.Input; nput; prm.Valu prm.Value e = id.To id.ToString(); String(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtordrdt.Text = red["Order_date"].ToString(); Txtdscpsn.Text = red["Description"].ToString(); Txttotqun.Text = red["Tot_quntity"].ToString(); drpstocknm.SelectedItem.Text = red["Stock_id"].ToString();
} btnsave. btnsave.Text Text = "Update"; "Update"; closeconn(); } catch (Exception ex) { MessageBo MessageBox.Show(ex x.Show(ex.Message. .Message.ToString( ToString()); )); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deleteordermaster", con);
cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_ordrmaster_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassOrederDetail : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindbook(); } } protectedvoid bindbook() { SqlCommand cmd = newSqlCommand("SP_ReadBooks", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpbooknm.DataSource = cmd.ExecuteReader(); drpbooknm.DataTextField = "Book_name";
drpbooknm.DataValueField = "Book_id"; drpbooknm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readorderdetail", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_orderdetail.DataSource = cmd.ExecuteReader(); Grid_orderdetail.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try {
SqlCommand cmd = newSqlCommand("SP_Insertorderdetail", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@bookid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@totalquantity", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@price", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtprice.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalamount", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotamnt.Text; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } else { try { SqlCommand cmd = newSqlCommand("SP_updateorderdetail", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@bookid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@totalquantity", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@price", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtprice.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalamount", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotamnt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@orderid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Order_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } } protectedvoid Grid_orderdetail_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Order_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editorderdetail", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString();
cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { drpbooknm.SelectedItem.Text = red["Book_id"].ToString(); Txttotqun.Text = red["Tot_quantity"].ToString(); Txtprice.Text = red["Price"].ToString(); Txttotamnt.Text = red["Total_amount"].ToString(); } btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deleteorderdetail", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_orderdetail_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { drpbooknm.SelectedIndex = 0; Txttotqun.Text = ""; Txtprice.Text = ""; Txttotamnt.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassPayment : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindcustomer(); bindcourier(); bindbook(); } } protectedvoid bindcustomer() { SqlCommand cmd = newSqlCommand("SP_Readcoustomers", con); cmd.CommandType = CommandType.StoredProcedure; opneconn(); drpcstmrnm.DataSource = cmd.ExecuteReader(); drpcstmrnm.DataTextField = "Cust_id"; drpcstmrnm.DataBind(); closeconn(); } protectedvoid bindcourier() { SqlCommand cmd = newSqlCommand("Sp_ReadCourier", con); cmd.CommandType = CommandType.StoredProcedure; opneconn(); drpcouriernm.DataSource = cmd.ExecuteReader(); drpcouriernm.DataTextField = "Courier_name"; drpcouriernm.DataValueField = "Courier_id"; drpcouriernm.DataBind(); closeconn(); } protectedvoid bindbook() { SqlCommand cmd = newSqlCommand("SP_ReadBooks", con); cmd.CommandType = CommandType.StoredProcedure; opneconn(); drpbooknm.DataSource = cmd.ExecuteReader(); drpbooknm.DataTextField = "Book_name"; drpbooknm.DataValueField = "Book_id"; drpbooknm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readpayment", con); cmd.CommandType = CommandType.StoredProcedure; opneconn(); Grid_payment.DataSource = cmd.ExecuteReader();
Grid_payment.DataBind(); closeconn();
} protectedvoid opneconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try {
SqlCommand cmd = newSqlCommand("SP_Isertpayment", con); cmd.CommandType = CommandType.StoredProcedure; opneconn();
SqlParameter prm = newSqlParameter("@paymenttype", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtpymnttyp.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalpayment", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = TxtTotpymnt.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@bankname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbanknm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@branchname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbrnchnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@dateofpayment", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@cheqedate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtchqdt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@chequeno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtchqno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@customerid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcstmrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@courierid", SqlDbType.Int);
prm.Direction = ParameterDirection.Input; prm.Value = drpcouriernm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@bookid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } else { try { SqlCommand cmd = newSqlCommand("SP_updatepayment", con); cmd.CommandType = CommandType.StoredProcedure; opneconn();
SqlParameter prm = newSqlParameter("@paymenttype", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtpymnttyp.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalpayment", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = TxtTotpymnt.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@bankname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbanknm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@branchname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtbrnchnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@dateofpayment", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@cheqedate", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtchqdt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@chequeno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtchqno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@customerid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcstmrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@courierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcouriernm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@bookid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpbooknm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@slipno ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Slip_no"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } } protectedvoid Grid_payment_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Slip_no"] = id;
SqlCommand cmd = newSqlCommand("SP_editpayment", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@slipno", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
opneconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtpymnttyp.Text = red["payment_type"].ToString(); TxtTotpymnt.Text = red["Total_payment"].ToString(); Txtbanknm.Text = red["Bank_name"].ToString(); Txtbrnchnm.Text = red["Branch_name"].ToString(); Txtdop.Text = red["Date_of_payment"].ToString(); Txtchqdt.Text = red["Cheque_date"].ToString(); Txtchqno.Text = red["Cheque_No"].ToString(); drpcstmrnm.SelectedItem.Text = red["Cust_Id"].ToString(); drpcouriernm.SelectedItem.Text = red["Courier_id"].ToString(); drpbooknm.SelectedItem.Text = red["Book_id"].ToString(); } btnsave.Text = "Updated"; closeconn(); }
catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletepayment", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@slipno", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); opneconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_payment_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtpymnttyp.Text = ""; TxtTotpymnt.Text = ""; Txtbanknm.Text = ""; Txtbrnchnm.Text = ""; Txtdop.Text = ""; Txtchqdt.Text = ""; Txtchqno.Text = ""; drpcstmrnm.SelectedIndex = 0; drpcouriernm.SelectedIndex = 0; drpbooknm.SelectedIndex = 0; } }
using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls;
using using using using
System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Publication : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindcategory(); } } protectedvoid bindcategory() { SqlCommand cmd = newSqlCommand("SP_ReadCategorys", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcatnm.DataSource = cmd.ExecuteReader(); drpcatnm.DataTextField = "Cate_name"; drpcatnm.DataValueField = "Cate_id"; drpcatnm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readpublication", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_publication.DataSource = cmd.ExecuteReader(); Grid_publication.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Insertpublication", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@categoryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcatnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@publicationname", SqlDbType.VarChar);
prm.Direction = ParameterDirection.Input; prm.Value = Txtpublctnnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@price", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtprice.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntcno.Text; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updatepublication", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@categoryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcatnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@publicationname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtpublctnnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@price", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtprice.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@contectno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntcno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@publicationid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Pub_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} }
} protectedvoid btnreset_Click(object sender, EventArgs e) { drpcatnm.SelectedIndex = 0; Txtpublctnnm.Text = ""; Txtprice.Text = ""; Txtadd.Text = ""; Txtemailid.Text = ""; Txtcntcno.Text = ""; } protectedvoid Grid_publication_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Pub_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editpublication", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@publicationid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { drpcatnm.SelectedItem.Text = red["cate_id"].ToString(); Txtpublctnnm.Text = red["Pub_name"].ToString(); Txtprice.Text = red["price"].ToString(); Txtadd.Text = red["Address"].ToString(); Txtemailid.Text = red["Email_id"].ToString(); Txtcntcno.Text = red["Contect_no"].ToString(); }
btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletepublication", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@publicationid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_publication_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Purchase : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) {
if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindorder(); bindcustomer(); bindsupplier(); bindgrid(); } } publicvoid bindorder() { SqlCommand cmd = newSqlCommand("SP_Readordermaster", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpordernm.DataSource = cmd.ExecuteReader(); drpordernm.DataValueField = "Order_id"; drpordernm.DataBind(); closeconn(); } publicvoid bindcustomer() { SqlCommand cmd = newSqlCommand("SP_Readcoustomers", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcstmrnm.DataSource = cmd.ExecuteReader(); drpcstmrnm.DataValueField = "Cust_id"; drpcstmrnm.DataBind(); closeconn(); } publicvoid bindsupplier() { SqlCommand cmd = newSqlCommand("SP_Readsupplier", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpsplrnm.DataSource = cmd.ExecuteReader(); //drpsplrnm.DataTextField = "Sup_name"; drpsplrnm.DataValueField = "Sup_id"; drpsplrnm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readpurchase", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_purchase.DataSource = cmd.ExecuteReader(); Grid_purchase.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save")
{ try { SqlCommand cmd = newSqlCommand("SP_Insertpurchase"); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@purchasename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtprchsnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpordernm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@totalpayment", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotpymnt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalquantity", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@customerid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcstmrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@supplierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpsplrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@dateofpurchase", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } else { try { SqlCommand cmd = newSqlCommand("SP_updatepurchase"); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@purchasename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtprchsnm.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@orderid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpordernm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@totalpayment", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotpymnt.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@totalquantity", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txttotqun.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@customerid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcstmrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@supplierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpsplrnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@dateofpurchase", SqlDbType.DateTime); prm.Direction = ParameterDirection.Input; prm.Value = Txtdop.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@purchaseid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Pur_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString());
} } }
protectedvoid Grid_purchase_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Pur_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editpurchase", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@purchaseid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtprchsnm.Text = red["Pur_name"].ToString(); drpsplrnm.SelectedItem.Text = red["Order_id"].ToString(); Txttotpymnt.Text = red["Tot_payment"].ToString(); Txttotqun.Text = red["Tot_quantity"].ToString(); drpcstmrnm.SelectedItem.Text = red["Cus_id"].ToString(); drpsplrnm.SelectedItem.Text = red["Sup_id"].ToString(); Txtdop.Text = red["Date_Of_purchase"].ToString();
} btnsave.Text = "Update"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletepurchase", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@purchaseid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_purchase_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); }
} protectedvoid btnreset_Click(object sender, EventArgs e) { Txtprchsnm.Text = ""; drpordernm.SelectedIndex = 0; Txttotpymnt.Text = ""; Txttotqun.Text = ""; drpcstmrnm.SelectedIndex = 0; drpsplrnm.SelectedIndex = 0; Txtdop.Text = ""; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_state : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindcountry(); } } publicvoid bindcountry() { SqlCommand cmd = newSqlCommand("Sp_Readcountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcntrynm.DataSource = cmd.ExecuteReader(); drpcntrynm.DataTextField = "Country_name"; drpcntrynm.DataValueField = "Country_id"; drpcntrynm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_ReadState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_state.DataSource = cmd.ExecuteReader(); Grid_state.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn()
{ con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try {
SqlCommand cmd = newSqlCommand("SP_InsertState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@statename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtstatenm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntrynm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data Saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updateState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@statename", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtstatenm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntrynm.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["State_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); }
catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtstatenm.Text = ""; drpcntrynm.SelectedIndex = 0; } protectedvoid Grid_state_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["State_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editState", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtstatenm.Text = red["State_name"].ToString(); drpcntrynm.SelectedItem.Text = red["Country_id"].ToString();
} btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deleteState", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn();
} catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_state_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Subject : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); bindgrid(); bindpublication(); } } protectedvoid bindpublication() { SqlCommand cmd = newSqlCommand("SP_Readpublication", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drppubnm.DataSource = cmd.ExecuteReader(); drppubnm.DataValueField = "Pub_id"; drppubnm.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readsubject", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_subject.DataSource = cmd.ExecuteReader();
Grid_subject.DataBind(); closeconn();
} protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Insertsubject", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@subjectname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsubnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@authorname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtauthrnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@publicationid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drppubnm.SelectedValue.ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data Saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { try { SqlCommand cmd = newSqlCommand("SP_updatesubject", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@subjectname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsubnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@authorname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtauthrnm.Text; cmd.Parameters.Add(prm);
prm = newSqlParameter("@publicationid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drppubnm.SelectedValue.ToString(); cmd.Parameters.Add(prm);
prm = newSqlParameter("@subjectid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Sub_id"].ToString(); cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_subject_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Sub_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editsubject", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@subjectid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtsubnm.Text = red["Sub_name"].ToString(); Txtauthrnm.Text = red["Author_name"].ToString(); drppubnm.SelectedItem.Text = red["Pub_id"].ToString();
} btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletesubject", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@subjectid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); }
} protectedvoid Grid_subject_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtsubnm.Text = ""; Txtauthrnm.Text = ""; drppubnm.SelectedIndex = 0; btnsave.Text = "Save"; } }
using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient; LeeGunn.Web.UI.MessageBox;
publicpartialclassAdmin_Supplier : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring());
bindgrid(); bindcountry(); bindstate(); bindcity(); } } protectedvoid bindcountry() { SqlCommand cmd = newSqlCommand("Sp_Readcountry", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcntry.DataSource = cmd.ExecuteReader(); drpcntry.DataTextField = "Country_name"; drpcntry.DataValueField = "Country_id"; drpcntry.DataBind(); closeconn(); } protectedvoid bindstate() { SqlCommand cmd = newSqlCommand("SP_ReadState", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpstate.DataSource = cmd.ExecuteReader(); drpstate.DataTextField = "State_name"; drpstate.DataValueField = "State_id"; drpstate.DataBind(); closeconn(); } protectedvoid bindcity() { SqlCommand cmd = newSqlCommand("SP_ReadCity", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); drpcity.DataSource = cmd.ExecuteReader(); drpcity.DataTextField = "City_name"; drpcity.DataValueField = "City_id"; drpcity.DataBind(); closeconn(); } protectedvoid bindgrid() { SqlCommand cmd = newSqlCommand("SP_Readsupplier", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); Grid_supplier.DataSource = cmd.ExecuteReader(); Grid_supplier.DataBind(); closeconn(); } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid btnsave_Click(object sender, EventArgs e) { if (btnsave.Text == "Save") { try { SqlCommand cmd = newSqlCommand("SP_Insertsupplier", con); cmd.CommandType = CommandType.StoredProcedure; openconn();
SqlParameter prm = newSqlParameter("@suppliername", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsplrnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectpersonname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntctprsnnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntctno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@mobileno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtmobno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@gender", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = RadioButtonList1.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntry.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstate.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@cityid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcity.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@zipcode", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtzipcode.Text; cmd.Parameters.Add(prm); cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data Saved"); bindgrid(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else {
try { SqlCommand cmd = newSqlCommand("SP_updatesupplier", con); cmd.CommandType = CommandType.StoredProcedure; openconn(); SqlParameter prm = newSqlParameter("@suppliername", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtsplrnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectpersonname", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntctprsnnm.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@address", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtadd.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@contectno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtcntctno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@mobileno", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtmobno.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@emailid", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = Txtemailid.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@gender", SqlDbType.VarChar); prm.Direction = ParameterDirection.Input; prm.Value = RadioButtonList1.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@countryid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcntry.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@stateid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpstate.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@cityid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = drpcity.SelectedValue.ToString(); cmd.Parameters.Add(prm); prm = newSqlParameter("@zipcode", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = Txtzipcode.Text; cmd.Parameters.Add(prm); prm = newSqlParameter("@supplierid ", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = ViewState["Sup_id"].ToString(); cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery(); closeconn(); MessageBox.Show("Data updated");
bindgrid();
} catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } protectedvoid Grid_supplier_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edits") { try {
ViewState["Sup_id"] = id;
SqlCommand cmd = newSqlCommand("SP_editsupplier", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@supplierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString(); cmd.Parameters.Add(prm);
openconn(); SqlDataReader red; red = cmd.ExecuteReader(); while (red.Read()) { Txtsplrnm.Text = red["Sup_name"].ToString(); Txtcntctprsnnm.Text = red["ContectPerson_name"].ToString(); Txtadd.Text = red["Address"].ToString(); Txtcntctno.Text = red["Contect_no"].ToString(); Txtmobno.Text = red["Mobile_no"].ToString(); Txtemailid.Text = red["Email_id"].ToString(); RadioButtonList1.Text = red["Gender"].ToString(); drpcntry.SelectedItem.Text = red["Country_id"].ToString(); drpstate.SelectedItem.Text = red["State_id"].ToString(); drpcity.SelectedItem.Text = red["City_id"].ToString(); Txtzipcode.Text = red["Zip_code"].ToString();
} btnsave.Text = "Updated"; closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } if (e.CommandName == "Deletes") { try {
SqlCommand cmd = newSqlCommand("SP_deletesupplier", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter prm = newSqlParameter("@supplierid", SqlDbType.Int); prm.Direction = ParameterDirection.Input; prm.Value = id.ToString();
cmd.Parameters.Add(prm); openconn(); cmd.ExecuteNonQuery(); cmd.Dispose(); MessageBox.Show("Data deleted"); bindgrid(); closeconn(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } bindgrid(); } } protectedvoid Grid_supplier_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Button lnkedit = (Button)e.Row.FindControl("lnkedit"); lnkedit.CommandArgument = e.Row.RowIndex.ToString(); Button lnkdelete = (Button)e.Row.FindControl("lnkdelete"); lnkdelete.CommandArgument = e.Row.RowIndex.ToString(); } } protectedvoid btnreset_Click(object sender, EventArgs e) { Txtsplrnm.Text = ""; Txtcntctprsnnm.Text = ""; Txtadd.Text = ""; Txtcntctno.Text = ""; Txtmobno.Text = ""; Txtemailid.Text = ""; RadioButtonList1.Text = ""; drpcntry.SelectedIndex = 0; drpstate.SelectedIndex = 0; drpcity.SelectedIndex = 0; Txtzipcode.Text = ""; } }
using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient;
publicpartialclassclient_welcome : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); string strg = "select Cate_id, Cate_name from Category"; SqlCommand cmd = newSqlCommand(strg, con); openconn();
SqlDataReader dr = cmd.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); dr.Close(); cmd.Dispose(); closeconn(); } } protectedvoid openconn() { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid DataList1_SelectedIndexChanged(object sender, EventArgs e) { } protectedvoid DataList1_SelectedIndexChanged1(object sender, EventArgs e) { Response.Redirect("Category.aspx"); } protectedvoid DataList1_ItemCreated(object sender, DataListItemEventArgs e) { } protectedvoid DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "view") { Label category = (Label)e.Item.FindControl("lblid"); string query = ""; query += "CategoryId=" + category.Text + ""; Response.Redirect("Publication.aspx?Category=" + category.Text); } } } using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient;
publicpartialclassclient_subcategory : System.Web.UI.Page { publicstaticSqlConnection con; publicstaticString str1; protectedvoid Page_Load(object sender, EventArgs e) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); str1 = Convert.ToString(Request.QueryString["Category"]);
string strg = "select c.Cate_id,c.Cate_name,p.Pub_name,p.pub_id from Category c, Publication p where c.Cate_id=p.Cate_id and p.cate_id='" + str1 + "'"; SqlCommand cmd = newSqlCommand(strg, con); openconn(); SqlDataReader dr = cmd.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); dr.Close(); cmd.Dispose(); closeconn(); } protectedvoid openconn() { if (con.State == System.Data.ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid DataList1_SelectedIndexChanged(object sender, EventArgs e) { Response.Redirect("book.aspx"); } protectedvoid DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "view") { //Label Publication = (Label)e.Item.FindControl("lblpublicationid"); //string query = ""; //query += "CategoryId=" + Publication.Text + ""; Response.Redirect("book.aspx?Publication=" + str1); } } }
using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Data.SqlClient;
publicpartialclassclient_book : System.Web.UI.Page { publicstaticSqlConnection con; publicstaticstring str1; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); str1 = Request.QueryString["Publication"].ToString();
string strg = "select b.Book_id,b.Book_name,b.ImageName,b.Pub_id,b.Status ,c.Cate_id,c.Cate_name,p.Pub_id,p.price from Book b,Category c,Publication p where c.Cate_id=p.cate_id and b.Cat_id=c.Cate_id and b.Cat_id='" + str1 + "'"; SqlCommand cmd = newSqlCommand(strg, con); opneconn(); SqlDataReader dr = cmd.ExecuteReader(); DataList2.DataSource = dr; DataList2.DataBind(); dr.Close(); cmd.Dispose(); closeconn();
} } protectedvoid opneconn() { if (con.State == System.Data.ConnectionState.Open) { con.Close(); } con.Open(); } protectedvoid closeconn() { con.Close(); } protectedvoid Button1_Click(object sender, EventArgs e) { // Response.Redirect("OrderDetail.aspx"); } protectedvoid DataList2_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "View") { Label publication = (Label)e.Item.FindControl("lblpublicationid"); string query=""; query += "publicationid=" + publication.Text + ""; Response.Redirect("OrderDetail.aspx?publicationid=" + publication.Text); } } protectedvoid DataList2_SelectedIndexChanged(object sender, EventArgs e) { // Response.Redirect("OrderDetail.aspx"); } }
using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient;
publicpartialclassAdmin_Bookwisereport : System.Web.UI.Page { publicstaticSqlConnection con;
protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); con.Open(); bindtempbook(); } } protectedvoid bindgride() { } protectedvoid bindtempbook() { SqlCommand cmd; cmd = newSqlCommand("select Serial_no,book_name from Tempbook", con); cmd.CommandType = CommandType.Text; SqlDataReader red = cmd.ExecuteReader(); DropDownList1.DataSource = red; DropDownList1.DataTextField = "book_name"; DropDownList1.DataBind(); red.Close(); cmd.Dispose(); } protectedvoid Button1_Click(object sender, EventArgs e) { SqlCommand cmd = newSqlCommand("Select book_name,Quantity,price,Tot_amount from Tempbook where book_name='"+DropDownList1.SelectedItem.Text+"'", con); SqlDataReader red = cmd.ExecuteReader(); GridView1.DataSource = red; GridView1.DataBind(); red.Close(); cmd.Dispose(); } }
using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient;
publicpartialclassCategorywisereport : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); con.Open(); bindtempcategory(); } }
protectedvoid bindtempcategory() { SqlCommand cmd; cmd = newSqlCommand("select Serial_no,Category_Name from tempcategory", con); cmd.CommandType = CommandType.Text; SqlDataReader red = cmd.ExecuteReader(); drpcatnm.DataSource = red; drpcatnm.DataTextField = "Category_Name"; drpcatnm.DataBind(); red.Close(); cmd.Dispose(); } protectedvoid Button1_Click(object sender, EventArgs e) { SqlCommand cmd = newSqlCommand("Select Category_Name,Quantity,price,Tot_quantity tempcategory where Category_Name='" + drpcatnm.SelectedItem.Text + "'", con); SqlDataReader red = cmd.ExecuteReader(); GridView1.DataSource = red; GridView1.DataBind(); red.Close(); cmd.Dispose(); } }
from
Deaily Report cod ing c# using using using using using using using using using using using using using
System; System.Collections; System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient;
publicpartialclassAdmin_Dailyreport : System.Web.UI.Page { publicstaticSqlConnection con; protectedvoid Page_Load(object sender, EventArgs e) { con = newSqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myproject_con"].ToS tring()); con.Open(); } protectedvoid Button1_Click(object sender, EventArgs e) { SqlCommand cmd = newSqlCommand("Select * from OrderMaster where Order_date='" + Txtordrdt.Text + "'", con); SqlDataReader red = cmd.ExecuteReader(); GridView1.DataSource = red; GridView1.DataBind(); red.Close(); cmd.Dispose(); } }
11.2 Code Efficiency :Efficiency is the amount of computing resources and code required by a program to perform its functions. Efficient codes are required for the better performance of the system. Efficient coding makes a system robust. A method is robust if it does not fail even if it receives improper parameters. Robustness against internal bugs may be trade off against efficiency. The need for efficiency arises due to the cost of consideration. If some resources are scarce and expensive, it is desirable that those resources should be used efficiently. In the computer system the resources the most often considered for efficiency are processor time and less memory. This coding for the system has been started after completing the design phase, because all software methodologies emphasize the importance of first designing then coding. The codes that construct this system are structured, modular, efficient, and require less amount of computing resources. All functions of this system are understandable since the functions are small and coherent. Functions and variables are meaningful variable names to increase the readability and avoided abbreviations that may confuse the users. In order to execute the database queries faster used the following methods. During the retrieval of data from the database using SELECT statement all the known conditions are specified in the WHERE clause. If we want to find the maximum, minimum, sum and average value or the count of a database column, use a Select list with aggregate functions instead of computing the aggregates within the program. The RDBMS is responsible for aggregated computations instead of transferring large amount of data to the application. Overall network, application server and database load is also considerably less. Simplicity and clarity are the main properties of the coding.
11.3 Code Optimization :
If coding is done efficiently then it should also be used or done optimistically. i.e. best use of code. What is the reason behind this optimization? Optimization means make best or most effective use. E.g. There is one efficient function or efficient environment oriented language or tool is available but if optimum use of that function or tool or language makes the whole program more simpler, effective and user friendly also. Now, how to optimize? Again it mostly depends on the programmer, that how intelligently he is doing all those things, still there are some basic rules to make our code optimistic. First thing is, develop the code which is general i.e. that code cannot be purposefully developed only by one angle. i.e. only for current system. Programmer must be awake of all the general
usage of that code, at least he/she has to look out onto most of the probabilistic events or conditions or specifications that can occurr. The most usage of any function can also be cleared prior to making them, then only one can develop the general purpose code which can be said as optimization of code. So ultimately code must be reusable.
Second is, Modularization i.e. most important thing for optimization. If total code is distributed in proper modules prior to start of the actual coding then its a better way of coding. General Module i.e. Standard Module is used.
Third thing is capabilities; utilities and facilities which are provided by language or tool or environment in which the programmer is developing the code must be properly known. MDI is used so, automatically it optimizes the code. The Optimization goal is achieved by combining the OCX and MDI.
[12] Testing
Testing :Testing Strategies Testing is involved in every stage of software life cycle, but the testing done at each level of software development is different in nature and has different objectives. Unit Testing is done at the lowest level. It tests the basic unit of software, which is the smallest testable piece of software, and is often called “unit”, “module”, or “component” interchangeably. Integration Testing is performed when two or more tested units are combined into a larger structure. The test is often done on both the interfaces between the components and the larger structure being constructed, if its quality property cannot be assessed from its components. System Testing tends to affirm the end-to-end quality of the entire system. System test is often based on the functional/requirement specification of the system. Non-functional quality attributes, such as reliability, security, and maintainability, are also checked. Acceptance Testing is done when the completed system is handed over from the developers to the customers or users. The purpose of acceptance testing is rather to give confidence that the system is working than to find errors. Based on the testing information flow, a testing technique specifies the strategy used in testing to select input test cases and analyze test results. Different techniques reveal different quality aspects of a software system, and there are two major categories of testing techniques, functional and structural. Functional Testing: the software program or system under test is viewed as a “black box”. The selection of test cases for functional testing is based on the requirement or design specification of the software entity under test. Examples of expected results, some times are called test oracles, include requirement/design specifications, hand calculated values, and simulated results. Functional testing emphasizes on the external behavior of the software entity. Structural Testing: the software entity is viewed as a “white box”. The selection of test cases is based on the implementation of the software entity. The goal of selecting such test cases is to cause the execution of specific spots in the software entity, such as specific statements, program branches or paths. The expected results are evaluated on a set of coverage criteria. Examples of coverage criteria include path coverage, branch coverage, and data-flow coverage. Structural testing emphasizes on the internal structure of the software entity.
Error Handling Testing Error handling refers to the anticipation, detection, and resolution of programming, application, and communications errors. Specialized programs, called error handlers, are available for some applications. The best programs of this type forestall errors if possible, recover from them when they occur without terminating the application, or (if
all else fails) gracefully terminate an affected application and save the error information to a log file. • Create a set of erroneous transactions and enter them into the application system then find out whether the system is able to identify the problems. • Using iterative testing enters transactions and trap errors. Correct them. Then enter transactions with errors, which were not present in the system earlier. In programming, a development error is one that can be prevented. Such an error can occur in syntax or logic. Syntax errors, which are typographical mistakes or improper use of special characters, are handled by rigorous proofreading. A run-time error takes place during the execution of a program, and usually happens because of adverse system parameters or invalid input data. An example is the lack of sufficient memory to run an application or a memory conflict with another program. On the Internet, run-time errors can result from electrical noise, various forms of malware or an exceptionally heavy demand on a server. Run-time errors can be resolved, or their impact minimized, by the use of error handler programs, by vigilance on the part of network and server administrators, and by reasonable security countermeasures on the part of Internet users.
Black box testing It takes an external perspective of the test object to derive test cases. These tests can be functional or non-functional, though usually functional. The test designer selects valid and invalid input and determines the correct output. There is no knowledge of the test object's internal structure. This method of test design is applicable to all levels of software testing: unit, integration, functional testing, system and acceptance. The higher the level, an hence the bigger and more complex the box, the more one is forced to use black box testing to simplify. While this method can uncover unimplemented parts of the specification, one cannot be sure that all existent paths are tested. this technique, we do not use the code to determine a test suite; rather, knowing the problem that we're trying to solve, we come up with four types of test data: 1. Easy-to-compute data 2. Typical data 3. Boundary / extreme data 4. Bogus data
White Box White box testing is a security testing method that can be used to validate whether code implementation follows intended design, to validate implemented security functionality, and to uncover exploitable vulnerabilities. White box testing requires knowing what makes software secure or insecure, how to think like an attacker, and how to use different testing tools and techniques. The first step in white box testing is to comprehend and analyze source code, so knowing what makes software secure is a fundamental requirement. Second, to create tests that exploit software, a tester must think like an attacker. Third, to perform testing effectively, testers need to know the different tools and techniques available for white box testing. The three requirements do not work in isolation, but together.
Unit testing In computer programming, unit testing is a procedure used to validate that individual units of source code are working properly. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method; which may belong to a base/super class, abstract class or derived/child class. Ideally, each test case is independent from the others; mock objects and test harnesses can be used to assist testing a module in isolation. Unit testing is typically done by developers and not by Software testers or end-users.
Performance Testin g System performance is generally assessed in terms of response time and throughput rates under differing processing and configuration conditions. To attack the performance problems, there are several questions should be asked first: How much application logic should be remotely executed? How much updating should be done to the database server over the network from the client workstation? How much data should be sent to each in each transaction? • •
•
Performance testing can verify that a system meets the specifications claimed by its manufacturer or vendor. The process can compare two or more devices or programs in terms of parameters such as speed, data transfer rate, bandwidth, throughput, efficiency or reliability. Slow data transfer rate may be inherent in hardware but can also result from softwarerelated problems, such as: Too many applications running at the same time A corrupted file in a Web browser A security exploit Heavy-handed antivirus software The existence of active malware on the hard disk. Effective performance testing can quickly identify the nature or location of a softwarerelated performance problem. • • • • •
Test case Design Test Case No. Test Phase Functionality Environment
TC-01 : : :
Procedure
:
Expected Outcome
:
Test Case No. Test Phase Functionality Environment
TC-02 : : :
Procedure
:
Unit Test Add new user information to the database. Add New User option from the home page accessible by the user. 1. Input user information such as Uesr name, type, address, contact no, email etc 2. Click on ‘Submit’ button. 3. A ‘confirm’ message will appear. Click ‘Ok’ button to store the entered user information in the database. The information relating to the newly added user should be displayed in the “User Information” page by the admin.
Unit Test Display book information Homepage 1. Check books homepage.
and
categories
section
in
2. Click on any links on books and category name which will open details of books/category Expected Outcome
:
Books/Category information should be display on the screen with appropriate list
Test Case No. Test Phase Functionality Environment
TC-03 : : :
Procedure
:
Expected Outcome
:
Test Case No. Test Phase Functionality Environment
TC-04 : : :
Procedure
:
1. 2. 3. 4.
Expected Outcome
:
1. Output cart with user added book’s image, name and price multiplied with quantity and grand total of the cart 2. In the top corner displays number of books added and grand total price of the cart
Unit Test Login/User registration Login page 1. Create test user account 2. Login using the same test account credential 3. Use mismatched credentials for test the validation 1. If the user credentials are match with DB, redirects to user account page 2. If test account user credentials are wrong, output invalid message 3. For registration, all input values should be validated such as phone no, email id should be in format
Unit Test Shopping cart Main page, shopping cart page Click on ‘Add to Cart’ button Add more products/books to cart Open the cart page and test Check the top box which displays number of books added to cart and quantity
Test Reports Test Case Date No
Pass/Fail
Comments
TC-01
12-Jan-13
PASS
The information relating to the newly added user should be displayed in the “User Information” page by the admin.
TC-02
23-Jan-13
PASS
Books/Category information should be display on the screen with appropriate list
PASS
1. If the user credentials are match with DB, redirects to user account page 2. If test account user credentials are wrong, output invalid message 3. For registration, all input values should be validated such as phone no, email id should be in format
PASS
1. Output cart with user added book’s image, name and price multiplied with quantity and grand total of the cart 2. In the top corner displays number of books added and grand total price of the cart
TC-03
TC-04
25-jan-13
1-Feb-13
[13] Validation Checks
Security Mechanism: To Valid means totally accepted so validation checks indicate, to check whether the entered data is totally acceptable or not before actual insertion into the database. 1.
All text fields that integers, as inputs will be validated so that only the digits are allowed.
2.
All text fields that take inputs as alphanumeric will be validated, so that only alphabets are taken as parameters for input.
3.
All fields that are mapped to primary key, will be validated so that the data is not stored as NULL in the required fields.
4. All text fields max length, are set according to the mapped database fields, so that the characters do not exceed the maximum length. 5.
Before storing the data, all fields that take in NULL are store values as NULL.
6.
All Date field values are stored as “dd-mmm-yyyy” format and will be consistent through the system.
7.
All database fields that take in a single value, as
8.
Primary keys are IDENTITY columns, which makes then value field.
9.
Data Stores in the reference table/ column is validated through a visual Graphical Component like Combo, ListViews,Tree Views,which makes the Foreign Key Value consistent and sure to be present in the parent table.
flag will content Digit. Auto-Increment
[14] Cost Estimation
Cost Estimation Estimation is an integral part of the software development process and should not be taken lightly. A well-planned and well-estimated project is likely to be completed in time. Incomplete and inaccurate documentation may pose serious hurdles to the success of a software project. Software estimation is an important part of the software development process. Underestimating software project and under staffing it often leads to low quality deliverables, and the project misses the target deadline to customer dissatisfaction and loss of credibility to the company. The cost of a project is derived not only from the estimates of effort and size but from other parameters such as hardware, travel expenses, telecommunication costs, training cost etc. Should also be taken into account. The cost estimation of Oline Book Store as follows:
Cost estimation process
Cost
Development Cost
20,000.00 /-
Hardware Cost (per PC)
21,000.00 /-
Broadband Connection
600.00 /- Per Months
Training Cost
7,000.00 /-
Total Cost
38,600.00 /-
[15] Reports
Report
Daily Repor t
[16] Number of Modules
Number Of Modules:This project has the following functionalities:
1) A Home page with pro duct catalog: This is the page where the user will be navigated after a successful login. It will display all the book categories and will have a search keyword option to search for the required book. It also includes some special sections like recommended titles, weekly special books.
2) Search: A search by keyword option is provided to the user using a textbox .The keyword to be entered should be the book title.
3) Advanced Search: Advanced search helps the user to search for a book based on Title, Author, Category and price range. All the books which match the particular search criteria and their total count will be displayed. From here the user can select a book and add to the shopping cart.
4) Book Description : If the user would like to know details about a book he can click on the title from where he will be directed to a Book description page. It includes the notes on the book content and also a link to Amazon.com to get the book review. 5) User Voti ng: The user can give rating to a book based on his interest. He can rate it by giving a score of five as Excellent, four for very good, three for good, two for regular and one for deficient. The final rating of a book will depend on all the individual user rating.
6) Shopping Cart: The user can manage a shopping cart which will include all the books he selected. The user can edit, delete and update his shopping cart. A final shopping cart summary is displayed which includes all the items the user selected and the final total cost.
7) Managing user accounts : Each user should have an account to access all the functionalities of website. User can login using login page and logout using the logout page. All the user sessions will be saved in the database.
8) Administration: The Administrator will be provided with special functionalities like - Add or delete a book category - Add or delete a member - Manage member orders. - Add or delete a Credit Card type.
[17] Charts & Schedules
Chart & Scheduling The following Gannt Chart and PERT Chart will show the schedule of the various stages of the VERA Bookstore project.
Gantt Chart 1 weeks week
PRELIMINARY INVESTIGATION & FEASIBILITY STUDY
ANALYSIS
Feasibili ty Study
DESIGNING
Verification Menu Design Data Base Design
CODING
TESTING Unit Testing Combined Module Testing
IMPLEMENTATION
1 weeks
5 week
8 weeks
3 weeks
1 week
1
Schedules:-
Early Start
Duration
Early Finish
Analysis
Analysis(50 Days) 01-OCT-2014
20-NOV-2014 Actual Finish
Late Start
Slack
Late Finish
Actual Start
Early Start
Duration
Early Finish
Feasibility Study(25 Days)
Feasibility Study Late Start
Slack
Late Finish
Early Start
Duration
Early Finish
Soft. Eng. Para.
21-NOV-2014
15-DEC-2014
Actual Start
Actual Finish
Soft. Eng. Para. (15 Days) 15-DEC-2014
30-DEC-2014 Actual Finish
Late Start
Slack
Late Finish
Actual Start
Early Start
Duration
Early Finish
Requirement Spec(2 Days)
Requirement Spec Late Start
Slack
Late Finish
Early Start
Duration
Early Finish
Design Late Start
Slack
Late Finish
Early Start
Duration
Early Finish
Coding Late Start
Slack
Late Finish
01-JAN-2015
03-JAN-2015
Actual Start
Actual Finish
Design(30 Days) 04-JAN-2015
04-FEB-2015
Actual Start
Actual Finish
Coding(32 Days) 06-FEB-2015
08-MAR-2015
Actual Start
Actual Finish
[18] Tools & Platform Used In Project
Tools & Platform Used In Project: 1.
Hardware Specification:
C.P.U.: 2.1 GHz Monitor: CRT/TFT/LED
RAM: 2 GB and higher
Processor: Intel- I-3 and higher
Hard disk: 120 GB and higher
CDROM: CD/DVD writer and USB
Keyboard Mouse
2. Software Specification :
Asp.Net: (code behind C#)
SQL Server 2008: (Express Edition)
[19] Future Scope of the Project
Future Scope Of The Project:
Just Now my system does not support Mobile Computing.
My system does not provide the SMS alert system.
Does not provide the soft copy of Book in computing system.
Limitation of Book system does not provide online reading or downloading the books.
Does not provide online Banking transaction on A/c System.
[20] References & Bibliography
References & Bibliogr aphy
IGNOU MCA Study Material of MCS-014
Course material of the IGNOU MCA course relating to Systems Analysis and Design
2
IGNOU MCA Study Material of MCS-023
Course material of the IGNOU MCA course relating to Introduction to Database Management Systems
3
IGNOU MCA Study Material of MCS-034
Course material of the IGNOU MCA course relating to Software Engineering
IGNOU MCA Study Material of MCS-043
Course material of the IGNOU MCA course relating to Advanced Database Management Systems
1
4
http://msdn.microsoft.com Help for Microsoft Code 5
http://codeproject.com Help for C# Code
6
IEEE Std 830-1998 : IEEE Recommended practice for Software Requirements Specifications
7
IEEE Std 1016-1998 : IEEE Software Engineering Standards Committee Recommended practice for Software of the IEEE Society Design Descriptions
8
IEEE Std 829-1998 : IEEE Standard for Software Test Documentation
Software Engineering Standards Committee of the IEEE Society
9
IEEE Std 1016-1998 : IEEE Standard for Software Unit Testing
Software Engineering Standards C ommittee of the IEEE Society
10
IEEE Std 1063-2001 : IEEE Standard for Software User Documentation
Software Engineering Standards Committee of the IEEE Society
Software Engineering Standards Committee of the IEEE Society
[21] Synopsis
ONLINE BOOK STORE MANAGEMENT SYSTEM
SUBMITED BY: Jinendra S. Shah (BCA-118186666)
Submitted to the School of Computer and Information Sciences, IGNOU in partial fulfillment of the requirements for the degree of
Index Chapter 1:Title of Project Chapter 2:Introduction & Objective of the project Chapter 3: Project Category Chapter 4: Requirement of Analysis 4.1 Data Flow Diagram 4.2 ER Diagram 4.3 Data Model Diagram Chapter 5: Number of Modules Chapter 6: Data Structure Chapter 7: Process Logic Chapter 8: Types of Output/Report Generation Chapter 9: Security Mechanism Chapter 10: Tools & Platform used in Project Chapter 11: Future Scope of the Project
Chapter 1:Title of Project ONLINE BOOK STORE MANAGEMENT SYSTEM
Chapter 2:Introduction & Objective of the project
Introduction:-
Online Book Store is a ecommerce website for bookstore which provides online books shopping for user customers and customers can view the orders and the status of the order using login dashboards. This website has option of administrator who can add books, view orders and update the status of the orders which customers can see through his login order page. Using the system users or customers can view the store’s available books and can place orders through shopping cart. On checkout time user can register or existing user can use their existing credentials proceed the checkout. There will be different payment options to choose to place the orders. Using login section, Customers can view placed orders and the status of the orders whether it is delivered or still processing from admin side. This system has administration section where admin can access all orders, add/view/edit books to the shopping portal. As of now, the system offers only cash on delivery and DD/Cheque on delivery options.
Background :Online Book Store: An ecommerce website for bookstore is based on B2C project. This project has been composed on three major strands: Data collection from customer, administrative process for delivery and revision of report. This online store is mainly a shopping cart for customers and real time inventory control for admin with administration panel. Admin has proper report on orders and inventory. As per the follow-up to the project after the implementing multiple online-payment options through Google Checkout, PayPal and etc.
Objective:
Proposed online Book Store Management system provides very easy of buying Books.
It is more comfortable and flexible rather than offline System.
It takes very less time for processing of various tasks.
From any place user can get more information about various categories of books.
The advertisement work as an ideal task because through it people come to know about existing and upcoming books’ categories.
It can handle all the tasks very easily and accurately.
The process to store the data about customer and books is done by computer system so it provides much more accuracy and security.
process
Chapter 3: Project Category Internet / Intranet / RDBMS
Chapter 4: Requirement of Analysis 4.1 Data Flow Diagram Context Level Diagram: Search Book
Place Order Make Payment
Customer
Get Customer Details
Get Book, Bill,Receipt
Online Book Store Management System
Get Payment
Get BookDetails
Dispetch Order
Admin
1st Level Diagram of Online Book Store System: Manage Master Table
Admin
1.0
Get Update Data For Master Table
Admin
Order the Book Make the Payment
Customer Get Books Get Reports
2.0
Get & Receive Customer details
G e t & R e ce S a le s D iv e t h e e ta il s
Send Book Details
3.0
Order to Purchase Book
Purchase Make the Payment
s e i l s h c r a P u D e t e k h d t B o o n e r S e h s i l b t h e P u S e n d e t a i ls l ie r D p p u S S e n d t h e B o o k P u rc h s e D e t a il s
Get the Receipt
4.0 Print The reports
Reports
Get Report
Book
Book Sales
Get Book
Admin
Sales
s S a l e e h t S e n d D e t a i ls B o o k
S e n d t h e P u b li s D e ta i ls h e r
Supplier
Customer
s e h c r P u e t h d t e p o r n S e R r d e r O e h t S e n d p o r ts R e S e P a y m n d t h e e n t R e po r t
Publisher
Supplier
Purchase
Order
Payment
Send the Sales Report Send the Customer Report
2nd Level Diagram of Onli ne Book Store System: Fill the form
Customer Send the customer details
1.1 Customer Details
Customer
Search the data Receive the Data Categories 1.2 Book Search
r e e m o t s u C o T r e v i l e D
Get the data
G e P u b t t h e l i c Publication D e a t i o t n a i l s
Order of books
Fetch the Order Order detail Deatils Order s e nd t h e o r d e r d a ta S e n d t Order h 1.3
e d e a s t a t t i l s u s
Order Payment Confirm the Order r e d r o f o s e l i t a d e h t t e G
Admin
Book
1.5 Dispatch
Order Status 1.4 Payment
Payment Deatils
Payment
3rd Level Diagram of Onli ne Book Store System: Store Publication data Store Book data Store Categories data Store Customer data Fill the Table Data
Admin Send the customer details
2.1 Table Selection
Customer
Search the table data Receive the Data Categories 2.2
r e s U o t m r i f n o C
Table Manage
Get the data
G e t P u b l i c a t i o n G Publication e t d a t a o r d e r G e t d e t O a i r d l s e r Order d a Deatils a G G t
Correct the data
2.3 DataEntry
e t e t P O r d a e y m r e n S t t a t D u s e t a i l s
Validate the Data
2.5
Book
Order
Order Status
2.4
Store the data
Validation Payment
Storage Store Payment data Store Order Status data Store Order data
Store Order Details data
4th Level Diagram of Onli ne Book Store System:
Admin
Fill the Report Form
4.1 Report Selection
t n i r P t r o p e R m r i f n o C
Prepare Report Datat
4.2 Report Prepration
Finally report Check & Print
4.3
t a i l Customer e d r t o m e s u C G e t G e t C at a Categories g o r ie s D G e et ai ls t B o
o k D e G e t a i t P l s u b l i c a G t i o n e t D a O t a r d e r G D e t e t a i o l s r d e r D a t G a e t O r d G e e r t S P t a a t u y s m e n t D e t a il s
Book
Publication
Order Details
Order
Order Status
Report Print Payment
4.3 Data Model Diagram Country PK,I1 Country_Id
Country_Nm Country_Alias
Book PK,I1 Book_Id
Book_Nm Search_Keyword
State PK,I3
Sta te_Id
State_Nm FK1,I2,I1 Country_Id
Courier
Customer
PK Courier_Id
PK,I5
Cust_Id
I6 FK2,I4,I3 FK3,I8,I7 FK1,I1,I2
First_Nm Middle_Nm Last_Nm Contact_No Email_ Id Address Gender Country_Id State_Id City_ID Purchase_Date
City PK,I1
Courier_Nm Delivery_Date Receiving_Date Source Destination
Payment
Stock PK,I2
Stock_Id
FK1,I1 Book_Id Totquantity
Order PK,I1
Order_Id
FK1,I3,I2
Order_Date Description Totquantity Stock_Id
PK
Slip _No
FK3,I6,I5 FK2,I4,I3 FK1,I2,I1
Payment_Type TotPayment Bank_Nm Branch_Nm Date_Of_Payment Cheque_Date Cheque_No Cust_Id Courier_Id Book_Id
City_Nm FK1,I3,I2 State_Id
Admin
Delivery_Status PK,I 4
Status_Id
I1 FK1,I3,I2
C ou ri er _I d Date_Of_Purchase Source Destination Cust_Id
Order_Detail
Cit y_Id
P K, I6
Id
I5 FK2,I4,I3 FK3,I8,I7 FK1,I2,I1 I9
User_Nm Password User_type Ema il_Id First_Nm Middle_Nm Last_Nm Contact_No Address Gender Country_Id State_Id City_Id Zipcode
Purchase PK,I5
Pur_Id
FK2,I4,I3 FK1,I2,I1 FK3,I7,I6
Pur_Nm Order_Id TotPayment Totquantity Cust_Id Sup_Id Date_Of_Purchase
Category FK2,I4,I3 FK1,I2,I1
Order_Id Book_Id Totquantity Price TotAmount
Purchase_Details PK,I5
Trans_Id
FK2,I4,I3 FK1,I2,I1
Pur_Id Book_Id Quantity Price
PK,I1 Cate_Id
Cate_Nm Description
Publication PK,I6
Pub_Id
I5 FK2,I4,I3 FK3,I8,I7 FK1,I2,I1 I9
Pub_Nm Price Address Ema il_Id Contact_No Mobile_No Country_Id State_Id City_Id Zipcode
Supplier PK,I5 Sup_Id
Subject PK,I3
Sub_Id
Sub_Nm Author_Nm FK1,I2,I1 Pub_Id
I3 I2 I4 I1 I6
Sup_Nm ContactPerson_Nm Address Contact_No Mobile_No E ma il _I d Gender Countr y_Id S ta te _I d C it y_ Id Z ip co de
Chapter 5: Number of Modules
This project has the following functionalities:
1) A Home page with pro duct catalog: This is the page where the user will be navigated after a successful login. It will display all the book categories and will have a search keyword option to search for the required book. It also includes some special sections like recommended titles, weekly special books.
2) Search: A search by keyword option is provided to the user using a textbox .The keyword to be entered should be the book title.
3) Advanced Search: Advanced search helps the user to search for a book based on Title, Author, Category and price range. All the books which match the particular search criteria and their total count will be displayed. From here the user can select a book and add to the shopping cart.
4) Book Description : If the user would like to know details about a book he can click on the title from where he will be directed to a Book description page. It includes the notes on the book content and also a link to Amazon.com to get the book review. 5) User Voti ng: The user can give rating to a book based on his interest. He can rate it by giving a score of five as Excellent, four for very good, three for good, two for regular and one for deficient. The final rating of a book will depend on all the individual user rating.
6) Shopping Cart: The user can manage a shopping cart which will include all the books he selected. The user can edit, delete and update his shopping cart. A final shopping cart summary is displayed which includes all the items the user selected and the final total cost.
7) Managing user accounts : Each user should have an account to access all the functionalities of website. User can login using login page and logout using the logout page. All the user sessions will be saved in the database.
8) Administration: The Administrator will be provided with special functionalities like - Add or delete a book category - Add or delete a member - Manage member orders. - Add or delete a Credit Card type.
Chapter 6: Data Structure
1.Admin: FieldName Id User_Nm Password User_type Email_Id First_Nm Middle_Nm Last_Nm Contact_No Address Gender Country_Id State_Id City_Id ZipCode
Size 10 30 18 20 50 20 20 20 12 50 10 10 10 10 10
DataType Numeric Varchar Varchar Varchar Varchar Varchar Varchar Varchar Numeric Varchar Char Numeric Numeric Numeric Numeric
Validation PrimaryKey Not null Not null Not null Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null
2.Book: FieldName Book_Id Book_Nm Search_Keyword Image Cate_Id Status
Size 10 30 10 50 10 10
DatType Numeric Varchar Numeric Varchar Numeric Numeric
Validation PrimaryKey Not null Not null Not Null Foreign Key Not null
3.Category: FieldName Cate_Id Cate_Nm Description
Size 10 30 30
DataType Numeric Varchar Varchar
Validation PrimaryKey Not null Not null
Size 10 30 10
DataType Numeric Varchar Numeric
Validation PrimaryKey Not null Foreignkey
Size 10 30 15
DataType Numeric Varchar Varchar
Validation PrimaryKey Not null Not null
4.City: FieldName City_Id City_Nm State_Id
5.Country: FieldName Country_Id Country_Nm Country_Alias
6.Courier : FieldName Courier_Id Courier_Nm Delivery_date Receiving_date Source Destination
Size 10 30 10 10 30 30
DataType Numeric Varchar Date Date Varchar Varchar
Validation Primarykey Not null Not null Not null Not null Not null
Datatype Numeric Varchar Varchar Varchar Numeric Varchar Varchar Numeric Numeric Numeric Numeric Date Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null Not null Not null
Datatype Numeric Numeric Date Varchar Varchar
Validation Primarykey Foreignkey Not null Not null Not null
7.Customer: Fieldname Cust_Id First_Nm Middle_Nm Last_Nm Contact_No. Email_Id Address Country_Id State_Id City_Id Zipcode Date_of_purchase Status
Size 10 20 20 20 12 50 50 10 10 10 10 10 10
8.Delivery_Status: Fieldname Status_Id Courier_Id Date_Of_Purchase Source Destination
Size 10 10 10 30 30
9.Order Master: Fieldname Order_Id Order_date Description Totquantity Stock_Id
Size 10 10 30 10 10
Datatype Numeric Date Varchar Numeric Numeric
Validation Primarykey Not null Not null Not null Foreignkey
10.Order_Detail: Fieldname Order_Id Book_id Totquantity Price TotAmount
Size 10 10 10 10 10
Datatype Numeric Numeric Numeric Numeric Numeric
Validation Foreignkey Foreignkey Not null Not null Not null
11.Payment: Fieldname Slip_No Payment_type Totpayment Bank_Name Branch_Name Date_Of_Payment Cheque_date Cheque_No Cust_Id Courier_Id Book_Id
Size 10 10 10 30 30 10 10 20 10 10 10
Datatype Numeric Varchar Numeric Varchar Varchar Date Date Varchar Numeric Numeric Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey
12.Publication: Fieldname Pub_Id Pub_Nm Price Address Email_Id Contact_No
Size 10 30 10 50 20 10
Datatype Numeric Varchar Numeric Varchar Varchar Numeric
Validation Primarykey Not null Not null Not null Not null Not null
13.Purchase: Fieldname Pur_Id Pur_Nm Order_Id Totpayment Totquantity Cust_Id Sup_Id Date_Of_Purchase
Size 10 30 10 10 10 10 10 10
Datatype Numeric Varchar Numeric Numeric Numeric Numeric Numeric Date
Validation Primarykey Not null Foreignkey Not null Not null Foreignkey Foreignkey Not null
14.Purchase_Detail: Fieldname Trans_Id Pur_Id Book_Id Quantity Price
Size 10 10 10 10 10
Datatype Numeric Numeric Numeric Numeric Numeric
Validation Primarykey Foreignkey Foreignkey Not null Not null
Size 10 30 10
Datatype Numeric Varchar Numeric
Validation Primarykey Not null Foreignkey
Size 10 10 10
Datatype Numeric Numeric Numeric
Validation Primarykey Foreignkey Not null
Size 10 30 30 10
Datatype Numeric Varchar Varchar Numeric
Validation Primarykey Not null Not null Foreignkey
15.State: Fieldname State_Id State_Nm Country_Id
16.Stock: Fieldname Stock_Id Book_Id Totquantity
17.Subject: Fieldname Sub_Id Sub_Nm Author_Nm Pub_Id
18.Supplier: Fieldname Sup_Id Sup_Nm Contactperson_Nm Address Contact_No Mobile_No Email_Id Gender Country_Id State_Id City_Id Zipcode
Size 10 30 30 50 10 10 30 10 10 10 10 10
Datatype Numeric Varchar Varchar Varchar Numeric Numeric Varchar Char Numeric Numeric Numeric Numeric
Validation Primarykey Not null Not null Not null Not null Not null Not null Not null Foreignkey Foreignkey Foreignkey Not null
Chapter 7: Process Logic
1. Admin Side Algor ithm : Step 1: Start Step 2: Check User is Register or Not Step 3: If (User is not Register) then; Call Regis ter(); else Login(); Enter UserName Enter Password End step 4: Stop.
Manage Choice Of Master Algorithm : Step 1: Start Step 2: Select Admin Process 1. Book 2. Order 3. Payment 4. Publication 5. Purchase 6. Supplier step 3: Select Choice Step 4: Do Accept Process Step 5: Stop.
Manage Book Master Al gori thm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) BookAdd(); Enter Book_Id Enter Book_Nm Enter Search_Keyword Search Image Select Category_Id Enter Status Option:-
Validate data Store data
Book Modify(); Search Book_Id Option:Update record Store data Book Delete(); Search Book_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Order Master Algo rit hm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) OrderAdd(); Enter Order_Id Enter Order_date Enter Description Enter Totquantity Enter Stock_Id Option:-
Validate data Store data
Order Modify(); Search Order_Id
Option:-
Update record Store data
Order Delete(); Search Order_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Payment Master Al gor ith m: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PaymentAdd(); Enter Slip_No Enter Payment_type Enter TotPayment Enter Bank_Nm Enter Branch_Nm Enter Date_Of_Payment Enter Cheque_No Enter Cheque_Date Enter Cust_Id Enter Courier_Id Enter Book_Id Option:-
Validate data Store data
Payment Modify(); Search Slip_No Option:-
Update record Store data
Payment Delete(); Search Slip_No Delete the record. Do u Want to Delete? step 3: Stop.
Manage Publi cation Master Algor ithm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PublicationAdd(); Enter Pub_Id Enter Pub_Nm Enter Price Enter Address Enter Email_Id Enter Contact_No Option:-
Validate data Store data
Publication Modify(); Search Pub_Id Option:-
Update record Store data
Publication Delete(); Search Pub_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Purchase Master Algorithm : Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) PurchaseAdd(); Enter Pur_Id Enter Pur_Nm Enter Order_Id Enter Totpayment Enter Totquantity Enter Sup_Id Enter Date_of_Purchase Option:Validate data Store data Purchase Modify();
Search Pur_Id Option:Update record Store data Purchase Delete(); Search Pur_Id Delete the record. Do u Want to Delete? step 3: Stop.
Manage Supplier Master Algorithm: Step 1: Start step 2: Enter your Choice(Add/Modify/Delete) SupplierAdd(); Enter Sup_Id Enter Sup_Nm Enter ContactPerson_Nm Enter Address Enter Contact_No Enter Mobile_No Enter Email_Id Enter Gender Enter Country_Id Enter State_Id Enter City_Id Enter Zipcode Option:-
Validate data Store data
Supplier Modify(); Search Sup_Id Option:-
Update record Store data
Suppli er Delete(); Search Sup_Id Delete the record. Do u Want to Delete? step 3: Stop.
2. Client Side Algorithm:
Step 1: Start Step 2: Display the Home Page. Step 3: If (User is not Register) then; Client Register(); Enter Id Enter User_Nm Enter Password Enter User_type Enter Email_Id Enter First_Nm Enter Middle_Nm Enter Last_Nm Enter Contact_No Enter Address Enter Gender Enter Country_Id Enter State_Id Enter City_Id Enter ZipCode Option:-Validate data Store data else Login(); Enter UserName Enter Password End step 4: Stop.
Manage Client Side Purc hase Process: Step 1: Start Step 2: Show the Book Menu Step 3: Display The Book Name Step 4: Search the Book Step 5: Add the Cart Step 6: Place the Order Step 7: Paid the Amount Step 8: Stop.
Manage Client Side Order Process: Step 1: Start Step 2: Show the Book Menu Step 3: Display the Book Name Step 4: Search the Book Key Word Step 5: Show the Book & Price with Publication Name & Author Name. Step 6: If (User Purchase Book) Add the Cart Place the Order Paid the Amount Finish Else Finish End Step 7: Stop.
Chapter 8: Types ofOutput/Report Generation
Admin : Admin Home Add User Book Master Category Change Password City Master Country Master Customer Details Login Forgot Password Payment Master Publication Details Purchase Details State Details Stock Details Subject Detail Supplier Details Client About Us Add Cart Book Details Client Home Category Name Change Password Different Category Client User Contact Us Courier Details Customer Details Login Forgot Password Inquiry Form Order Form Search Book Report Generation Book Wise Report Category Wise Report Category Wise Most Popular Report Daily Report Month Wise Report Receipt
Chapter 9: Security Mechanism To Valid means totally accepted so validation checks indicate, to check whether the entered data is totally acceptable or not before actual insertion into the database. 1.
All text fields that integers, as inputs will be validated so that only the digits are allowed.
2.
All text fields that take inputs as alphanumeric will be validated, so that only alphabets are taken as parameters for input.
3.
All fields that are mapped to primary key, will be validated so that the data is not stored as NULL in the required fields.
4. All text fields max length, are set according to the mapped database fields, so that the characters do not exceed the maximum length. 5.
Before storing the data, all fields that take in NULL are store values as NULL.
6.
All Date field values are stored as “dd-mmm-yyyy” format and will be consistent through the system.
7.
All database fields that take in a single value, as
8.
Primary keys are IDENTITY columns, which makes then value field.
9.
Data Stores in the reference table/ column is validated through a visual Graphical Component like Combo, ListViews,Tree Views,which makes the Foreign Key Value consistent and sure to be present in the parent table.
flag will content Digit. Auto-Increment
Chapter 10: Tools & Platform used in Project 1.
Hardware Specification:
C.P.U.: 2.1 GHz Monitor: CRT/TFT/LED
RAM: 2 GB and higher
Processor: Core 2 duo and higher
Hard disk: 120 GB and higher
CDROM: CD/DVD writer and USB
Keyboard Mouse
2. Software Specification :
Front End : Asp.Net: (code behind C#)
Back End :SQL Server 2008: (Express Edition)