Vous êtes sur la page 1sur 122

SYNOPSIS The Project is entitled Online Shopping.

The main objective of this project is to reduce gap between sellers and customers. Online shopping is a form of electronic commerce which allows consumers to directly buy

goods from a seller over the internet. An online shopping system that permits a customer to submit online orders for items and/or services from a store that serves both walk-in customers and online customers. The online shopping system presents an online display of an order cutoff time and an associated delivery window for items selected by the customer. The system accepts the customer's submission of a purchase order for the item in response to a time of submission being before the order cutoff time. The online shopping system does not settle with a credit supplier of the customer until the item selected by the customer is picked from inventory but before it is delivered. Therefore, the customer can go online and make changes to the order. In addition, available service windows are presented to the customer as a function of customer selected order and service types and further, the order picking is assigned in accordance with a picker's preference. This Project is made using ASP.Net as front end and Microsoft Access as back end. MODULES DESCRIPTION: Authentication Customer Info Product Info Supplier Info Staff Info Purchase Info Sales Info Authentication: The security and authentication module contains about access privileges to customers and employees for various operations. The security is very important for online transactions to done correctly without being hacked.
1

Customer Info: The customer module contains information about the products and offers and the price of the products. Before that the customer has to register in this application for this registration form is developed the new users must register and can continue the shopping. Product Info: Products Info provided by the supplier such as product details, personal details, etc and data provided by the supplier such as feedback and booking details will be maintained in a data base by the website administrator. Booking Info The Administrator after Login to the site he verifies for recent bookings from members. Then he needs to forward all bookings details to the members. Staff Info The Employee module contains Employees who are working in the company. The details of every employee are stored in this page. The Employees process the data of the customers and their orders. Profile Owner, Staff and Member can view their details edit and update their details separately.

CONTENTS

Chapter No 1.

Title Introduction 1.1. 1.2. Organization Profile Problem Statement

Page No 1

2.

System Analysis 2.1. Approach 2.2. Existing System 2.3. Proposed System 2.4. Need For Computerization

3.

System Configuration 3.1. Hardware Configuration 3.2. Software Configuration

4.

System Development 4.1. Project Specification 4.2. Module Description 4.3. Form Validation

5.

System Design 5.1. Input Design 5.2. Code Design 5.3. Database Design 5.4. Output Design 5.5. Data Flow Diagram

6. 7. 8. 9. 10.

Testing and Implementation Future Enhancement Conclusion Bibliography Appendices A. Input Screen B. Sampling Code

Chapter1

INTRODUCTION
1.1 Organization Profile
5

1.2 Problem Statement This project Online Shopping deals with globalizing the shopping process. No effective communication between user and the vendor. If one person wants to buy goods, he will spent lots of time and money for this process. Online shopping tries to enhance access to care and improve the continuity and efficiency of services. Depending on the specific setting and locale, case managers are responsible for a variety of tasks, ranging from linking clients to services to actually providing intensive shopping and delivery services themselves it introduces a new channel to interact with members. It adapts to all networks. This is the objective of the project.

Chapter 2

SYSTEM ANALYSIS
8

2. 2.1.APPROACH

SYSTEM ANALYSIS

The data which were manually collected and the same is analyzed for computerization. System Analysis means the set of requirement and the description for the new system. This aims to understand how an existing system operation there by project to proposed system. 2.2.EXISTING SYSTEM The existing system was an automated system. But it was found to be inefficient in meeting the growing demands of population. LIMITATTIONS OF EXISTING SYSTEM: 1. Time Consuming 2. Expensive 3. Needed an agent 4. We have to out for that. 5. They limited to limited cities. 6. No effective communication between user and the vendor. 2.3.Proposed System Proposed system is being developed using Asp.net as front end and Ms-Access as back end. The aim of proposed system is to develop a system of improved facilities. The proposed system can overcome all the limitations of the existing system. The development of this new system contains the following activities, which try to develop on-line application by keeping the entire process in the view of database integration approach. Secure registration and profile management facilities for Customers.

Browsing through the e-Mall to see the items that are there in each category of products like Apparel, Kitchen accessories, Bath accessories, Food items etc. Creating a Shopping cart so that customer can Shoppe n no. of items and checkout finally with the entire shopping cart Customers should be able to mail the Shop about the items they would like to see in the Shop Secured mechanism for checking out from the Shop Updates to customers about the Recent Items in the Shop. Uploading Most Purchased Items in each category of products in the Shop like Apparel, Kitchen accessories, Bath accessories, Food items etc.

ADVANTAGES OF THE PROPOSED SYSTEM:

The system is very simple in design and to implement. The system requires very low system resources and the system will work in almost all configurations. (1) It simplifies the operation. (2) It avoids a lot of manual work. (3) Every transaction is obtained and processed immediately. (4) Avoids errors by avoiding the manual work. (5) User friendly screen to enter the data and enquire the database tables. (6) Online help messages available to the operating system. (7) User can easily access the system without much experience. (8) Provide hardware and software securities. (9) Portable and flexible for further extensions.

2.4 NEED FOR COMPUTERIZATION The storage and the retrieval of the data were difficult and data entry was time consuming are some of the reasons for computerization are: Can be used to give operational characteristics. For the usage of 24 hours usage.
10

For the users comfort ability. To get the information in worldwide level. To reach people who is abroad. To achieve secrecy and confidentiality Its user friendly and helps in obtaining knowledge.

11

Chapter 3

System Configuration
3.SYSTEM CONFIGURATION
12

3.1.Software requirements: Operating System Server: Windows XP or later Database Server: Microsoft SQL Server-2005 Client: Microsoft Internet Explorer Tools: Microsoft Visual Studio .Net-2008 User Interface: Asp.Net with Ajax Code Behind: ASP.Net 3.2.Hardware Specification: Processor: Intel Pentium or More Ram: 512 MB Ram Hard Disk: PC with 20GB

13

Chapter 4

System Specifications
14

4.SYSTEM SPECIFICATIONS 4.1 PROJECT SPECIFICATION MICROSOFT WINDOWS XP Microsoft Windows XP is a series of operating systems produced by Microsoft. Microsoft introduced an operating environment named windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces (GUIs). Microsoft Windows came to dominate the worlds personal computer market, overtaking Mac OS, which has been introduced in 1984. The most recent client version of Windows is Windows 7; the most recent server version is Windows server 2008 R2; the most recent mobile version is Windows Phone 7. Future of Windows XP The window XP service pack is the operating system which provides more security, flexibility and high performance in comparison with the previous version and offers full level compatibility with the windows updating and innovative support services creates the best desktop operating system for business. Architectural independence Less Crashing Faster Internet Performance Better Photo Handling and Printing Treats a CD-RW like a real drive System Restore Centralized Administration Large memory space Remote access server MICROSOFT VISUAL BASIC.NET Visual Basic .NET is the next generation of Microsoft's popular Visual Basic programming languages. Some programmers refer to the new incarnation as VB 7, but this is incorrect. Visual
15

Basic .NET is actually not backwards-compatible with VB6, meaning that code written in the old version will not compile under VB.NET. In fact, the languages are sufficiently different that many programmers consider them independent. . NET FRAMEWORK Introduction In this article we are going to look at Microsoft .NET Framework. This is the newly established software development environment which helps developers to develop applications quickly and gives optimum, efficient, scalable, performance oriented applications in different languages like Visual Basic .NET, C#, ASP .NET, and Jscript .NET etc., Overview of the .NET Framework The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet. Services

NET Framework provides the following services: Tools for developing software applications, Run-time environments for software application to execute, Server infrastructure, Value added intelligent software which helps developers to do less coding and work efficiently, The .Net Framework will enable developers to develop applications for various devices and platforms like windows application web applications windows services and web services. Objectives The .NET Framework is designed to fulfill the following objectives: A consistent object-oriented programming environment, where object code can be stored and executed locally, executed locally but Internet-distributed, or executed remotely.

16

A code-execution environment that minimizes software deployment and versioning conflicts. A code-execution environment that guarantees safe execution of code, including code created by an unknown or semi-trusted third party. Developers can experience consistency across widely varying types of applications, such as Windows-based applications and Web-based applications. Build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code. .NET Framework Architecture The .NET Framework has two components: the .NET Framework class library and the common language runtime. The .NET Framework class library facilitates types (CTS) that are common to all .NET languages. The common language runtime consists of (class loader) that load the IL code of a program into the runtime, which compiles the IL code into native code, and executes and manage the code to enforce security and type safety, and provide thread support. MICROSOFT ACCESS Microsoft Access stores information in what is called a database. Database Create your Microsoft Access database and specify what kind of data you will be storing. A retail business might create a database to store all their sales information (i.e items sold, customer, employee, commission, etc.) The name database is actually a very descriptive name. The database is two things in one: Data: A place to store your data. This data could be a record of sales, employees, salaries, or anything else.

17

base: It is the basic building block that many other features in access use to function. With a properly created database you can create informative reports about the data, custom charts visually display values, and create queries. Query Using queries we can view, change, and analyze the data in different ways. We can also use them as the source of records for forms, reports, and data access pages. This is a fancy terms to basically describe the process of retrieving information from the database. Table A table is a collection of data about specific topics. A table in Access is quite different then a table in real life. Instead of having wooden legs and being used for meals, Access Tables are a grid made up of rows and columns. Table organize the data into columns (called fields) and rows (called records). 4.2. MODULE DESCRIPTION Authentication Customer Info Product Info Supplier Info Staff Info Purchase Info Sales Info Authentication: The security and authentication module contains about access privileges to customers and employees for various operations. The security is very important for online transactions to done correctly without being hacked. Customer Info:

18

The customer module contains information about the products and offers and the price of the products. Before that the customer has to register in this application for this registration form is developed the new users must register and can continue the shopping. Product Info: Products Info provided by the supplier such as product details, personal details, etc and data provided by the supplier such as feedback and booking details will be maintained in a data base by the website administrator. Booking Info The Administrator after Login to the site he verifies for recent bookings from members. Then he needs to forward all bookings details to the members. Staff Info The Employee module contains Employees who are working in the company. The details of every employee are stored in this page. The Employees process the data of the customers and their orders. Profile Owner, Staff and Member can view their details edit and update their details separately.

4.3 FORM VALIDATION Owner Info Form: Validation was done to ensure that the owner has entered numeric values in numeric fields and has entered the alphabets for text fields and has entered the correct date in the date/time field. Member Info Form: Validation was done to ensure that the member has entered numeric values in numeric fields and has entered the alphabets for text fields and has entered the correct date in the date/time field.

19

Property Info Form: Each field was tested by the programmer. Validation was done to ensure the owner has enters a numeric value in the amount field.

20

Chapter 5

System Design
5.SYSTEM DESIGN
21

Design is a iterative process thought which requirements a translated into or blue print for constructing the software design must implement all the implicit all threw implicit requirements and explicit requirements. It must be a readable and understandable. It is not coding. The initial focus of the project will be on in-house league formats. However, the user interface is designed to organize the users' data efficiently and intuitively and can be easily extended to support almost any kind of athletic event. The scheduling system will be developed in Java, while web-based components will be developed in HTML. 5.1.Input Design Input design is the process of converting a user-oriented description of the input into a computerbased system. This design is important to avoid errors in the data input process and show the correct direction to the management for getting correct information from the computerized system. It is achieved by creating user-friendly screens for the data entry to handle large volume of data. The goal of designing input is to make data entry easier and to free from errors. The data entry screens is designed such a way that all the data manipulates can be performed. It also provides record viewing facilities. When the data is entered it will check for its validity. Data can be entered with the help of the screen. Appropriate message are provided as when needed so that the user will not be in maize of instant. The design of input focuses on controlling the amount of input required, controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The input is designed in such a way so that it provides security.

5.2.CODE DESIGN A code is an ordered collection of symbols designed to prove unique identification to an entry or an attribute. Purpose of using code is: To achieve unique identification. Can be used instead of the name. To specify an objects physical or performance characteristics.
22

Can be used to give Operational characteristics. 5.3.DATA BASE DESIGN Table : Login Field Name LoginId Username Password Usertype Data Type Number Text Text Text Size 20 50 50 50 Description Login Id User Name Password User Type

Table : Customer Info Field Name CustomerId CustomerName Address PhoneNO EMailId TINNo UserName Password Data Type Number Text Text Text Text Text Text Text Size 20 50 50 20 50 50 50 50 Description Customer Id Customer Name Address Phone Number Email Id TIN Number UserName Password

23

Table : Product Info Field Name ProductId ProductName GroupName SubGroupName PurchaseRate SalesRate ReOrderLevel BarCode Data Type Number Text Text Text Number Number Number Text Size 20 50 50 50 20 20 20 20 Description Product Id Product Name Group Name Sub Group Name Purchase Rate Sales Rate Re Order Level Bar Code

Table : Purchase Info Field Name PurchaseId PurchaseDate SupplierName ProductName Rate Qty Amount TaxPer TaxAmt RoundOff TotalAmount Data Type Number Date/Time Text Text Number Number Number Number Number Number Number 50 50 20 20 20 20 20 20 20 Size 20 Description Purchase Id Purchase Date Supplier Name Product Name Rate Quantity Amount Tax Percentage Tax Amount Round Off Total Amount

24

Table : Sales Field Name SalesId SalesDate CustomerName ProductName Rate Qty Amount TaxPer TaxAmt RoundOff TotalAmount Status Data Type Number Date/Time Text Text Number Number Number Number Number Number Number Text 50 50 20 20 20 20 20 20 20 50 Size 20 Description Sales Id Sales Date Customer Name Product Name Rate Quantity Amount Tax Percentage Tax Amount Round Off Total Amount Status

Table : Staff Info Field Name StaffId StaffName Address PhoneNO Gender DOJ DOB Salary Data Type Number Text Text Text Text Date/Time Date/Time Number 20 Size 20 50 50 50 20 Description Staff Id Staff Name Address Phone Number Gender Date Of Joining Date Of Birth Salary

25

Table: Supplier Info Field Name SupplierId SupplierName CompanyName Address PhoneNo EMailId ProductInfo WebsiteName Data Type Number Text Text Text Text Text Text Text Size 20 50 50 50 20 50 50 50 Description Supplier Id Supplier Name Company Name Address Phone Number Email Id Product Info Website Name

5.4.Output Design Designing computer output should processed in an organized, well thought out manner; the right output must be developed while ensuring that each output element is designed so that people will find the system can use easily and effectively. When analysis designs computer output should design: Identify the specific output that is needed to meet the requirements. Create document, report, or other formats that contain information produced by the system. Select the appropriate methods for presenting the information. A quality output is one, which meets the requirements of the end user and presents the information clearly. In output designs it is determined how the information is to be displaced for immediate need and also the hard copy output. It is the most important and direct source information to the user. Efficient and intelligent output design improves the systems relationship to help user decision making.

26

5.5Data Flow Diagram

27

Chapter 6

Testing and Implementation


28

6. SYSTEM IMPLEMENTATION AND TESTING 6.1.SYSTEM TESTING A strategy for software testing may also be viewed in the context of the spiral. Unit testing begins at the vertex of the spiral and concentrates on each unit of the software as implemented in source code. Testing progress by moving outward along the spiral to integration testing, where the focus is on the design and the construction of the software architecture. Talking another turn on outward on the spiral we encounter validation testing where requirements established as part of software requirements analysis are validated against the software that has been constructed. Finally we arrive at system testing, where the software and other system elements are tested as a whole. UNIT TESTING All modules were tested and individually as soon as they were completed and were checked for their correct functionality. Unit testing focuses verification effort on the smallest unit of software design, the module. The unit testing we have is white box oriented and some modules the steps are conducted in parallel. To follow the concept of white box testing we have tested each form .we have created independently to verify that Data flow is correct, All conditions are exercised to check their validity, All loops are executed on their boundaries. INTEGRATION TESTING The entire project was split into small program; each of this single programs gives a frame as an output. These programs were tested individually; at last all these programs where combined together by creating another program where all these constructors were used. It give a lot of problem by not functioning is an integrated manner. The user interface testing is important since the user has to declare that the arrangements made in frames are convenient and it is satisfied. when the frames where given for the test, the end user gave suggestion. Based on their suggestions the frames where modified and put into practice.

29

VALIDATION TESTING At the culmination of the black box testing software is completely assembled as a package. Interfacing errors have been uncovered and corrected and a final series of test i.e., Validation succeeds when the software function in a manner that can be reasonably Accepted by the customer. 6.2. SYSTEM IMPLEMENTATION System implementation is stage in the project where the theoretical design is turned into the working system. The most crucial stage is giving the users confidence that the new system will work effectively and efficiently. The performance of reliability of the system is tested and it gained acceptance. The system was implemented successfully. Implementation is a process that means converting a new system in to operation. Proper implementation is essential to provide a reliable system to meet organization requirements. During the implementation stage a live demon was undertaken and made in front of end-users. The various features provided in the system were discussed during implementation.

30

7.FUTURE ENHANCEMENT In future we will add carts for customers and owners means if any customer places an order then alerts will automatically go to the suppliers mobile. Also if any customers signs up into our site then his user name and password sends to his mobile. Any new products updates will also sends to customers mobile. If any new discounts or offers also sends to customers mobile. We also extend our website too many cities and also with much more cities. Also we will provide automated mail communication between customer and owner.

31

Chapter 8

Conclusion

32

8.CONCLUSION The central concept of the application is to allow the customer to shop virtually using the Internet and allow customers to buy the items and articles of their desire from the store. The information pertaining to the products are stores on an RDBMS at the server side (store).The Server process the customers and the items are shipped to the address submitted by them. The application was designed into two modules first Os for the customers who wish to buy the articles. Second is for the storekeepers who maintains and updates the information pertaining to the articles and those of the customers. The end user of this product is a departmental store where the application is hosted on the web and the administrator maintains the database. The application which is deployed at the customer database, the details of the items are brought forward from the database for the customer view based on the selection through the menu and the database of all the products are updated at the end of each transaction.

33

Chapter 10

Appendices

34

APPENDICES A.INPUT SCREEN

Home Page:

35

Admin Login:

36

Admin:

37

Product Entry:

38

Purchase Info:

39

Sales Info:

40

Customer Info:

41

Customer Info Edited:

42

Supplier Info

43

Staff Info Entry:

44

Staff Info Edit:

45

Staff Info Delete:

46

Customer Login:

47

Customer Page:

48

Product Purchase:

49

Purchased:

50

Order:

51

Profile

B.SAMPLE CODE Login page Form Imports System.Data.OleDb

Partial Class frmLogin Inherits System.Web.UI.Page

52

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub btnSignIn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSignIn.Click If txtUserId.Text.Trim() = "" Then MsgBox("Please Enter User Id ") txtUserId.Focus() ElseIf txtPassword.Text.Trim() = "" Then MsgBox("Please Enter Password") txtPassword.Focus() ElseIf ddlUserType.Text.Trim() = "" Then MsgBox("Please select User Type") ddlUserType.Focus() Else

Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

53

Dim qry, LoginId As String qry = String.Format("select LoginId from Login where UserName='{0}' and Password='{1}' and UserType='{2}'", txtUserId.Text, txtPassword.Text, ddlUserType.Text)

Dim cmd As New OleDbCommand(qry, con) LoginId = cmd.ExecuteScalar() If LoginId = "" Then MsgBox("invalid User") Else Session("UserId") = txtUserId.Text Session("UserType") = ddlUserType.Text If ddlUserType.Text = "Admin" Then Response.Redirect("frmAdmin.aspx") ElseIf ddlUserType.Text = "Customer" Then Response.Redirect("frmCustomer.aspx") End If End If

con.Close() End If

54

End Sub

Protected Sub btnSignUp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSignUp.Click Response.Redirect("frmSignUp.aspx") End Sub End Class Signup Page Imports System.Data.OleDb

Partial Class frmSignUp Inherits System.Web.UI.Page

Sub NewForm() txtCustomerId.Text = NewId() txtCustomerName.Text = "" txtAddress.Text = "" txtPhoneNo.Text = "" txtEMailId.Text = "" txtTINNo.Text = "" txtUserName.Text = ""

55

txtPassword.Text = "" txtCustomerName.Focus() End Sub

Function NewId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(CustomerId)+1 from CustomerInfo"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close()

56

Catch ex As Exception

End Try Return NID End Function

Function NewLoginId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(LoginId)+1 from Login"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar()

57

If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NId End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtCustomerName.Text = "" Then MsgBox("Enter the Customer Name") txtCustomerName.Focus() Exit Sub
58

End If

If txtUserName.Text = "" Then MsgBox("Enter the User Name") txtUserName.Focus() Exit Sub End If

If txtPassword.Text = "" Then MsgBox("Enter the Paassword") txtPassword.Focus() Exit Sub End If

If txtRePassword.Text = "" Then MsgBox("Enter the Re.Passwore") txtRePassword.Focus() Exit Sub End If

59

If txtPassword.Text <> txtRePassword.Text Then MsgBox("Password is MisMatch") txtPassword.Focus() Exit Sub End If

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into CustomerInfo values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", txtCustomerId.Text, txtCustomerName.Text, txtAddress.Text, txtPhoneNo.Text, txtEMailId.Text, txtTINNo.Text, txtUserName.Text, txtPassword.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then

60

qry = String.Format("Insert into Login values({0},'{1}','{2}','{3}')", NewLoginId, txtUserName.Text, txtPassword.Text, "Customer") cmd = New OleDbCommand(qry, con) cmd.ExecuteNonQuery() MsgBox("Submited") Response.Redirect("frmLogin.aspx") End If Catch ex As Exception

End Try End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub End Class Customer Info Page Imports System.Data.OleDb

Partial Class frmAdminCustomerNew Inherits System.Web.UI.Page


61

Sub NewForm() txtCustomerId.Text = NewId() txtCustomerName.Text = "" txtAddress.Text = "" txtPhoneNo.Text = "" txtEMailId.Text = "" txtTINNo.Text = "" txtUserName.Text = "" txtPassword.Text = "" txtCustomerName.Focus() End Sub

Function NewId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString)

62

con.Open()

Dim qry As String qry = "select Max(CustomerId)+1 from CustomerInfo"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NID End Function

Function NewLoginId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty

63

connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(LoginId)+1 from Login"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NId End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm()
64

End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtCustomerName.Text = "" Then MsgBox("Enter the Customer Name") txtCustomerName.Focus() Exit Sub End If

If txtUserName.Text = "" Then MsgBox("Enter the User Name") txtUserName.Focus() Exit Sub End If

If txtPassword.Text = "" Then MsgBox("Enter the Paassword")

65

txtPassword.Focus() Exit Sub End If

If txtRePassword.Text = "" Then MsgBox("Enter the Re.Passwore") txtRePassword.Focus() Exit Sub End If

If txtPassword.Text <> txtRePassword.Text Then MsgBox("Password is MisMatch") txtPassword.Focus() Exit Sub End If

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

66

Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into CustomerInfo values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", txtCustomerId.Text, txtCustomerName.Text, txtAddress.Text, txtPhoneNo.Text, txtEMailId.Text, txtTINNo.Text, txtUserName.Text, txtPassword.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then qry = String.Format("Insert into Login values({0},'{1}','{2}','{3}')", NewLoginId, txtUserName.Text, txtPassword.Text, "Customer") cmd = New OleDbCommand(qry, con) cmd.ExecuteNonQuery() MsgBox("Submited") Response.Redirect("frmAdminCustomer.aspx") End If Catch ex As Exception

End Try End Sub

67

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub

End Class

Customer Info Edit Page Imports System.Data.OleDb

Partial Class frmAdminCustomerEdit Inherits System.Web.UI.Page

Sub ViewForm() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

68

Dim qry As String qry = "select * from CustomerInfo where CustomerId=" + Request("CID") Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader If dr.Read Then txtCustomerId.Text = dr.Item("CustomerId") txtCustomerName.Text = dr.Item("CustomerName") txtAddress.Text = dr.Item("Address") txtPhoneNo.Text = dr.Item("PhoneNo") txtEMailId.Text = dr.Item("EMailId") txtTINNo.Text = dr.Item("TINNo") txtUserName.Text = dr.Item("UserName") txtPassword.Text = dr.Item("Password") txtRePassword.Text = dr.Item("Password") End If con.Close() Catch ex As Exception

End Try

69

End Sub Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtCustomerName.Text = "" Then MsgBox("Enter the Customer Name") txtCustomerName.Focus() Exit Sub End If

If txtUserName.Text = "" Then MsgBox("Enter the User Name") txtUserName.Focus() Exit Sub End If

If txtPassword.Text = "" Then MsgBox("Enter the Paassword") txtPassword.Focus() Exit Sub

70

End If

If txtRePassword.Text = "" Then MsgBox("Enter the Re.Passwore") txtRePassword.Focus() Exit Sub End If

If txtPassword.Text <> txtRePassword.Text Then MsgBox("Password is MisMatch") txtPassword.Focus() Exit Sub End If

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

71

Dim qry As String qry = String.Format("Update CustomerInfo set CustomerName='{1}',Address='{2}',PhoneNo='{3}',EMailId='{4}',TINNo='{5}',UserName='{6 }',[Password]='{7}' where CustomerId={0}", txtCustomerId.Text, txtCustomerName.Text, txtAddress.Text, txtPhoneNo.Text, txtEMailId.Text, txtTINNo.Text, txtUserName.Text, txtPassword.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then qry = String.Format("update Login set [Password]='{1}' where UserName='{0}' and UserType='Customer'", txtUserName.Text, txtPassword.Text) cmd = New OleDbCommand(qry, con) cmd.ExecuteNonQuery() MsgBox("Submited") Response.Redirect("frmAdminCustomer.aspx") End If Catch ex As Exception

End Try End Sub

72

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ViewForm() End If End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click ViewForm() End Sub

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click If MsgBox("Do you want to Delete this?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

73

Dim qry As String qry = "delete from CustomerInfo where CustomerId=" + Request("CID") Dim cmd As New OleDbCommand(qry, con) If cmd.ExecuteNonQuery Then MsgBox("Deleted") Response.Redirect("frmAdminCustomer.aspx") End If

Catch ex As Exception

End Try

End If End Sub End Class Product Info Page Imports System.Data.OleDb

Partial Class frmAdminProductNew Inherits System.Web.UI.Page Sub NewForm()

74

txtId.Text = NewId() txtName.Text = "" txtGroupName.Text = "" txtSubGroupName.Text = "" txtPurchaseRate.Text = "" txtSalesRate.Text = "" txtReOrderLevel.Text = "" txtBarCode.Text = "" txtName.Focus() End Sub

Function NewId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

75

Dim qry As String qry = "select Max(ProductId)+1 from ProductInfo"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NID End Function

Function NewLoginId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString)

76

con.Open()

Dim qry As String qry = "select Max(LoginId)+1 from Login"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NId End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() End If End Sub

77

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtName.Text = "" Then MsgBox("Enter the Name") txtName.Focus() Exit Sub End If

Try If FileUpload1.HasFile Then FileUpload1.SaveAs(Request.PhysicalApplicationPath + "Images\Product\" + txtName.Text + ".jpg") End If

Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

78

Dim qry As String qry = String.Format("Insert into ProductInfo values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", txtId.Text, txtName.Text, txtGroupName.Text, txtSubGroupName.Text, txtPurchaseRate.Text, txtSalesRate.Text, txtReOrderLevel.Text, txtBarCode.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then MsgBox("Submited") Response.Redirect("frmAdminProduct.aspx") End If Catch ex As Exception

End Try End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub End Class

79

Purchase Info Imports System.Data.OleDb

Partial Class frmAdminPurchaseNew Inherits System.Web.UI.Page Sub NewForm() txtId.Text = NewId() txtDate.Text = "" ddlSupplierName.Text = "" ddlProductName.Text = "" txtRate.Text = "" txtQty.Text = "" txtAmount.Text = "" txtTaxPer.Text = "" txtTaxAmt.Text = "" txtRoundOff.Text = "" txtTotalAmount.Text = "" txtDate.Focus() End Sub

Function NewId() As String

80

Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(PurchaseId)+1 from Purchase"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NID End Function

81

Sub LoadSupplierName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select SupplierName from SupplierInfo"

Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader() ddlSupplierName.Items.Clear() ddlSupplierName.Items.Add("") While dr.Read ddlSupplierName.Items.Add(dr.Item(0)) End While

82

con.Close() Catch ex As Exception

End Try End Sub

Sub LoadProductName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select ProductName from ProductInfo"

Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader()

83

ddlProductName.Items.Clear() ddlProductName.Items.Add("") While dr.Read ddlProductName.Items.Add(dr.Item(0)) End While con.Close() Catch ex As Exception

End Try End Sub

Function GetPurchaseRate() As String Dim PRate As String = "" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String

84

qry = "select PurchaseRate from ProductInfo where ProductName='" + ddlProductName.Text + "'" Dim cmd As New OleDbCommand(qry, con) PRate = cmd.ExecuteScalar() con.Close() Catch ex As Exception

End Try Return PRate End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() LoadProductName() LoadSupplierName() End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

85

If txtDate.Text = "" Then MsgBox("Enter the Name") txtDate.Focus() Exit Sub End If

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into Purchase values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", txtId.Text, txtDate.Text, ddlSupplierName.Text, ddlProductName.Text, txtRate.Text, txtQty.Text, txtAmount.Text, txtTaxPer.Text, txtTaxAmt.Text, txtRoundOff.Text, txtTotalAmount.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then

86

MsgBox("Submited") Response.Redirect("frmAdminPurchase.aspx") End If Catch ex As Exception

End Try End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub

Sub DisplayAmount() txtAmount.Text = Val(txtRate.Text) * Val(txtQty.Text) txtTaxAmt.Text = (Val(txtAmount.Text) * Val(txtTaxPer.Text)) / 100 txtTotalAmount.Text = Val(txtAmount.Text) + Val(txtTaxAmt.Text) txtRoundOff.Text = Math.Round(Val(txtTotalAmount.Text)) - Val(txtTotalAmount.Text) txtTotalAmount.Text = Math.Round(Val(txtTotalAmount.Text)) End Sub Protected Sub FindAmount(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRate.TextChanged, txtQty.TextChanged, txtTaxPer.TextChanged
87

DisplayAmount() End Sub

Protected Sub ddlProductName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlProductName.TextChanged txtRate.Text = GetPurchaseRate() txtQty.Text = "1" DisplayAmount() End Sub End Class Purchase Info Edit Imports System.Data.OleDb

Partial Class frmAdminPurchaseEdit Inherits System.Web.UI.Page Sub ViewForm() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()
88

Dim qry As String qry = "select * from Purchase where PurchaseId=" + Request("ID") Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader If dr.Read Then txtId.Text = dr.Item("PurchaseId") txtDate.Text = dr.Item("PurchaseDate") ddlSupplierName.Text = dr.Item("SupplierName") ddlProductName.Text = dr.Item("ProductName") txtRate.Text = dr.Item("Rate") txtQty.Text = dr.Item("Qty") txtAmount.Text = dr.Item("Amount") txtTaxPer.Text = dr.Item("TaxPer") txtTaxAmt.Text = dr.Item("TaxAmt") txtRoundOff.Text = dr.Item("RoundOff") txtTotalAmount.Text = dr.Item("TotalAmount") End If con.Close() Catch ex As Exception

89

End Try End Sub

Sub LoadSupplierName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select SupplierName from SupplierInfo"

Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader() ddlSupplierName.Items.Clear() ddlSupplierName.Items.Add("") While dr.Read

90

ddlSupplierName.Items.Add(dr.Item(0)) End While con.Close() Catch ex As Exception

End Try End Sub

Sub LoadProductName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select ProductName from ProductInfo"

Dim cmd As New OleDbCommand(qry, con)

91

Dim dr As OleDbDataReader dr = cmd.ExecuteReader() ddlProductName.Items.Clear() ddlProductName.Items.Add("") While dr.Read ddlProductName.Items.Add(dr.Item(0)) End While con.Close() Catch ex As Exception

End Try End Sub

Function GetPurchaseRate() As String Dim PRate As String = "" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

92

Dim qry As String qry = "select PurchaseRate from ProductInfo where ProductName='" + ddlProductName.Text + "'" Dim cmd As New OleDbCommand(qry, con) PRate = cmd.ExecuteScalar() con.Close() Catch ex As Exception

End Try Return PRate End Function

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtDate.Text = "" Then MsgBox("Enter the Date") txtDate.Focus() Exit Sub End If
93

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Update Purchase set PurchaseDate='{1}',SupplierName='{2}',ProductName='{3}',Rate='{4}',Qty='{5}',Amount='{6}' ,TaxPer='{7}',TaxAmt='{8}',RoundOff='{9}',TotalAmount='{10}' where PurchaseId={0}", txtId.Text, txtDate.Text, ddlSupplierName.Text, ddlProductName.Text, txtRate.Text, txtQty.Text, txtAmount.Text, txtTaxPer.Text, txtTaxAmt.Text, txtRoundOff.Text, txtTotalAmount.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then MsgBox("Submited") Response.Redirect("frmAdminPurchase.aspx") End If Catch ex As Exception

94

End Try End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then LoadProductName() LoadSupplierName() ViewForm() End If End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click ViewForm() End Sub

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click If MsgBox("Do you want to Delete this?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Try

95

Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "delete from Purchase where PurchaseId=" + Request("ID") Dim cmd As New OleDbCommand(qry, con) If cmd.ExecuteNonQuery Then MsgBox("Deleted") Response.Redirect("frmAdminPurchase.aspx") End If

Catch ex As Exception

End Try

End If End Sub

96

Sub DisplayAmount() txtAmount.Text = Val(txtRate.Text) * Val(txtQty.Text) txtTaxAmt.Text = (Val(txtAmount.Text) * Val(txtTaxPer.Text)) / 100 txtTotalAmount.Text = Val(txtAmount.Text) + Val(txtTaxAmt.Text) txtRoundOff.Text = Math.Round(Val(txtTotalAmount.Text)) - Val(txtTotalAmount.Text) txtTotalAmount.Text = Math.Round(Val(txtTotalAmount.Text)) End Sub Protected Sub FindAmount(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRate.TextChanged, txtQty.TextChanged, txtTaxPer.TextChanged DisplayAmount() End Sub

Protected Sub ddlProductName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlProductName.TextChanged txtRate.Text = GetPurchaseRate() txtQty.Text = "1" DisplayAmount() End Sub End Class Sales Info Page Imports System.Data.OleDb

97

Partial Class frmAdminSalesNew Inherits System.Web.UI.Page Sub NewForm() txtId.Text = NewId() txtDate.Text = "" ddlCustomerName.Text = "" ddlProductName.Text = "" txtRate.Text = "" txtQty.Text = "" txtAmount.Text = "" txtTaxPer.Text = "" txtTaxAmt.Text = "" txtRoundOff.Text = "" txtTotalAmount.Text = "" ddlStatus.Text = "" txtDate.Focus() End Sub

Function NewId() As String Dim NId As String NId = "1"

98

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(SalesId)+1 from Sales"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

End Try Return NID End Function

99

Sub LoadCustomerName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select CustomerName from CustomerInfo"

Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader() ddlCustomerName.Items.Clear() ddlCustomerName.Items.Add("") While dr.Read ddlCustomerName.Items.Add(dr.Item(0)) End While con.Close() Catch ex As Exception

100

End Try End Sub

Sub LoadProductName() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select ProductName from ProductInfo"

Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader() ddlProductName.Items.Clear() ddlProductName.Items.Add("")

101

While dr.Read ddlProductName.Items.Add(dr.Item(0)) End While con.Close() Catch ex As Exception

End Try End Sub

Function GetSalesRate() As String Dim PRate As String = "" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select SalesRate from ProductInfo where ProductName='" + ddlProductName.Text + "'" Dim cmd As New OleDbCommand(qry, con)
102

PRate = cmd.ExecuteScalar() con.Close() Catch ex As Exception

End Try Return PRate End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() LoadProductName() LoadCustomerName() End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtDate.Text = "" Then MsgBox("Enter the Date")


103

txtDate.Focus() Exit Sub End If

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into Sales values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')", txtId.Text, txtDate.Text, ddlCustomerName.Text, ddlProductName.Text, txtRate.Text, txtQty.Text, txtAmount.Text, txtTaxPer.Text, txtTaxAmt.Text, txtRoundOff.Text, txtTotalAmount.Text, ddlStatus) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then MsgBox("Submited") Response.Redirect("frmAdminSales.aspx") End If


104

Catch ex As Exception

End Try End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub

Sub DisplayAmount() txtAmount.Text = Val(txtRate.Text) * Val(txtQty.Text) txtTaxAmt.Text = (Val(txtAmount.Text) * Val(txtTaxPer.Text)) / 100 txtTotalAmount.Text = Val(txtAmount.Text) + Val(txtTaxAmt.Text) txtRoundOff.Text = Math.Round(Val(txtTotalAmount.Text)) - Val(txtTotalAmount.Text) txtTotalAmount.Text = Math.Round(Val(txtTotalAmount.Text)) End Sub Protected Sub FindAmount(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRate.TextChanged, txtQty.TextChanged, txtTaxPer.TextChanged DisplayAmount() End Sub

105

Protected Sub ddlProductName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlProductName.TextChanged txtRate.Text = GetSalesRate() txtQty.Text = "1" DisplayAmount() End Sub End Class Staff Info Page Imports System.Data.OleDb

Partial Class frmAdminStaffNew Inherits System.Web.UI.Page Sub NewForm() txtId.Text = NewId() txtName.Text = "" txtAddress.Text = "" txtPhoneNo.Text = "" txtGender.Text = "" txtDOB.Text = "" txtDOJ.Text = "" txtSalary.Text = ""

106

txtName.Focus() End Sub

Function NewId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(StaffId)+1 from StaffInfo"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1" con.Close() Catch ex As Exception

107

End Try Return NID End Function

Function NewLoginId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(LoginId)+1 from Login"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1"

108

con.Close() Catch ex As Exception

End Try Return NId End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtName.Text = "" Then MsgBox("Enter the Name") txtName.Focus() Exit Sub End If
109

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into StaffInfo values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", txtId.Text, txtName.Text, txtAddress.Text, txtPhoneNo.Text, txtGender.Text, txtDOB.Text, txtDOJ.Text, txtSalary.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then qry = String.Format("Insert into Login values({0},'{1}','{2}','{3}')", NewLoginId, txtName.Text, "Admin", "Admin") cmd = New OleDbCommand(qry, con) cmd.ExecuteNonQuery() MsgBox("Submited") Response.Redirect("frmAdminStaff.aspx") End If

110

Catch ex As Exception

End Try End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub End Class Supplier Page Info Imports System.Data.OleDb

Partial Class frmAdminSupplierNew Inherits System.Web.UI.Page Sub NewForm() txtSupplierId.Text = NewId() txtSupplierName.Text = "" txtCompanyName.Text = "" txtAddress.Text = "" txtPhoneNo.Text = ""

111

txtEMailId.Text = "" txtWebSite.Text = "" txtProducts.Text = "" End Sub

Function NewId() As String Dim NId As String NId = "1" Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select Max(supplierId)+1 from SupplierInfo"

Dim cmd As New OleDbCommand(qry, con) NId = cmd.ExecuteScalar() If NId = "" Then NId = "1"

112

con.Close() Catch ex As Exception

End Try Return NID End Function

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then NewForm() End If End Sub

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtSupplierName.Text = "" Then MsgBox("Enter the Supplier Name") txtSupplierName.Focus() Exit Sub End If
113

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Insert into SupplierInfo values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", txtSupplierId.Text, txtSupplierName.Text, txtCompanyName.Text, txtAddress.Text, txtPhoneNo.Text, txtEMailId.Text, txtProducts.Text, txtWebSite.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then MsgBox("Submited") Response.Redirect("frmAdminSupplier.aspx") End If Catch ex As Exception

114

End Try

End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click NewForm() End Sub End Class Customer Order Page <%@ Page Language="VB" MasterPageFile="~/MasterCustomer.master" AutoEventWireup="false" CodeFile="frmCustomerOrder.aspx.vb" Inherits="frmCustomerOrder" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="69px"> <RowStyle BackColor="#EFF3FB" /> <Columns>

115

<asp:BoundField DataField="BillDate" HeaderText="BillDate" SortExpression="BillDate"> <ItemStyle Width="50px" /> </asp:BoundField> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName"> <ItemStyle Width="150px" /> </asp:BoundField> <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Rate"> <ItemStyle Width="50px" /> </asp:BoundField> <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Qty"> <ItemStyle Width="50px" /> </asp:BoundField> <asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount"> <ItemStyle Width="100px" /> </asp:BoundField> </Columns> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />

116

<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#2461BF" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT FROM WHERE Sales (Status = 'Pending' and CustomerName=?)"> SalesDate AS BillDate, ProductName, Rate, Qty, Amount

<SelectParameters> <asp:SessionParameter Name="?" SessionField="UserId" /> </SelectParameters> </asp:SqlDataSource> </asp:Content> Profile Page Info Imports System.Data.OleDb

Partial Class frmCustomerProfile Inherits System.Web.UI.Page

117

Sub ViewForm() Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = "select * from CustomerInfo where UserName='" + Session("UserId") + "'" Dim cmd As New OleDbCommand(qry, con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader If dr.Read Then txtCustomerId.Text = dr.Item("CustomerId") txtCustomerName.Text = dr.Item("CustomerName") txtAddress.Text = dr.Item("Address") txtPhoneNo.Text = dr.Item("PhoneNo") txtEMailId.Text = dr.Item("EMailId") txtTINNo.Text = dr.Item("TINNo") txtUserName.Text = dr.Item("UserName")

118

txtPassword.Text = dr.Item("Password") txtRePassword.Text = dr.Item("Password") End If con.Close() Catch ex As Exception

End Try

End Sub Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

If txtCustomerName.Text = "" Then MsgBox("Enter the Customer Name") txtCustomerName.Focus() Exit Sub End If

If txtUserName.Text = "" Then MsgBox("Enter the User Name")

119

txtUserName.Focus() Exit Sub End If

If txtPassword.Text = "" Then MsgBox("Enter the Paassword") txtPassword.Focus() Exit Sub End If

If txtRePassword.Text = "" Then MsgBox("Enter the Re.Passwore") txtRePassword.Focus() Exit Sub End If

If txtPassword.Text <> txtRePassword.Text Then MsgBox("Password is MisMatch") txtPassword.Focus() Exit Sub End If

120

Try Dim connString As String = String.Empty connString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim con As New OleDbConnection(connString) con.Open()

Dim qry As String qry = String.Format("Update CustomerInfo set CustomerName='{1}',Address='{2}',PhoneNo='{3}',EMailId='{4}',TINNo='{5}',UserName='{6 }',[Password]='{7}' where CustomerId={0}", txtCustomerId.Text, txtCustomerName.Text, txtAddress.Text, txtPhoneNo.Text, txtEMailId.Text, txtTINNo.Text, txtUserName.Text, txtPassword.Text) Dim cmd As New OleDbCommand(qry, con)

If cmd.ExecuteNonQuery Then qry = String.Format("update Login set [Password]='{1}' where UserName='{0}' and UserType='Customer'", txtUserName.Text, txtPassword.Text) cmd = New OleDbCommand(qry, con) cmd.ExecuteNonQuery() MsgBox("Submited")

121

Response.Redirect("frmcustomer.aspx") End If Catch ex As Exception

End Try End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ViewForm() End If End Sub

Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click ViewForm() End Sub End Class

122

Vous aimerez peut-être aussi