Professional Documents
Culture Documents
Allocate Employee details points Customer details Places nventory For Retailer Shop order Supplier details details Login Keep details Relogin Given Access Pays Have Modifyy Generates Given Places Given Pays Given
product_id:varchar Quantity:numeric s-price:numeric Add sales Details record() Employee Admin delete sales record() Admin Employee + Employee Admin << Employee includes>> Loginof join Creates a Date new + Admin Supplier Customer Place an Unit_Price Search and Add << << includes>> includes>> new customer Employee Firstname record record order << includes>> Purchase_product Sales_product Product supp_address cust_address Product Details Full fill the - Add << Add includes>> new new product supplier emp_address Sales Lastname Purchase record record look-up-for Class Name << includes>> product_id product_id product_size Image Image purchase_prodcut order display Add Update new customer existing Employee emp_id cust_id Username supp_id supplier record Record available quantity p_id:varchar Pay aproduct billproduct_id Update p_id order_id supp_id cust_id record attribute:data Process Data Data Entity Flow store type Genrate a emp_contact display Update details supplier employee order_id Password p_id record product_id:varchar Check stock Looks s_price -up-for Quantity supp_contact cust_contact product Functions/operations bill p_price Maintain Quantity:numeric details Looks Delete -up-for supplier emp_name s_date Type employee p_date record availiblity p-price:numeric Enquiry details p_quantity s_quantity product_name supp-email cust-email Genrate a display details Look-up-supplier product Salary Security_Question details Add purchase record() Buys aproduct product Delete supp_id supp_name cust_name record bill record() delete purchase details Delete display employee supplier Image Answer record Customer Genrate Bill Supplier + + details Modify Customer Details Admin/Login username:varchar Reloginpassword:varchar type:varchar security:varchar answer:varchar place order() cancle order() Generates Add customer() Delete customer() + Customer cust_id:varchar cust_name:varchar cust_address:varchar cust_email:varchar cust_contact:varchar cust_image:image
1.. * 1.. *
A Project Report On
UNIVERSITY OF MUMBAI Smt. CHANDIBAI HIMATHMAL MANSUKHANI COLLEGE OF ARTS, COMMERCE AND SCIENCE ULHASNAGAR- 3
This is to certify that the project entitled Sales and Inventory For Retailer Shop Undertaken at the
by
Mr./Ms._____________________________ Seat no. __________________ in partial fulfillment of B.Sc. IT degree (Semester- VI) Examination had not been submitted for any other examination and does not form part of any other course undergone by the candidate. It is further certified that he/she has completed all required phases of the project.
College seal C
INDEX
SR NO. Topic PAGE NO.
Abstract
10
Problem definition
11
13
System Planning
16
Gantt Chart
17
E-R Diagram
18
Use-Case Diagram
26
10
Class Diagram
32
11
Context Diagram
35
12
36
13
Screen layouts
40
14
Process Involved
46
15
Methodology Adopted
48
16
System Implementation
50
17
52
18
57
19
59
20
61
21
66
22
Coding
70
23
Data Dictionary
129
24
Acknowledgement
133
25
Bibliography
134
PREFACE
The major objective of this report is to define this scope and domain of the subject concern. The text in this report was carefully noted and scripted in a very semantic and a flowing manner. The text in this report has capacity to go beyond the more mechanics of project buildings. It serves as guide to develop deeper into the subject and to understand the exact goal of the project. It lays stress on graphical representations of the project parts, as it is very much clear that graphical representation is sure to have a larger impact on mind than a black and white text. The text, ranging from first to the last topic, is in simple language which should create no problem in understanding the finger point of the subject under consideration. We hope that this project report is well received and should be able to quench the thirst of knowledge of anybody, who wishes to understand the subject under study.
ABSTRACT
BALAJI TRADERS shop is an Retailer shop located in Vangani and has been providing service to customer since 7 years. It does not have any branches. This shop contains the products which are used for construction sites. These products are like cements, tor steel products, plastic products, etc. The main feature of this software is for optimal sales and inventory management processes. This software also provides Support for inventory management which helps you to record and track materials on the basis of both quantity and value. Using this software we can reduce costs for transportation, order fulfillment, and material handling while improving customer service. This software is user friendly and hence easy to use. This is a user friendly application and will help the owner to keep all the records and product details, in an efficient and easy way. The system used by BALAJI TRADERS has been using manual system. The basic details were stored in file format. The file management system had many disadvantages due to which maintaining the system was pretty difficult job. We have used Spiral methodology to develop this software project.
10
Time consuming Less accurate Less efficient Lot of paper work Slow data processing Difficult to keep old records
11
PROBLEM DEFINITION
As we know manual system are quite tedious, time consuming and less efficient and accurate in comparison to the computerized system. So following are some disadvantages of the old system:
1.
2.
Less accurate: In manual system there are many chances of occurrence of human
errors.
3.
Less efficient: Due to lot of manual work updating and modification of data is very
4.
Lot of paper work : There is redundancy in data as most of the data are to be written in
5.
Slow data processing : Due to huge amount of records and lots of writing work, the
6.
Difficult to keep old records: As all the records written in files manually, there may be chance of loss
13
OBJECTIVES:
Understand a system Understand the different phases of system developments life cycle Know the components of system analysis Know the components of system designing
DEFINING A SYSTEM:
14
A collection of components that work together to realize some objective forms a system. Basically there are three major components in every system, namely input, processing and output.
In a system the different components are connected with each other and they are interdependent. The objective of the system demands that some output is produced as a result of processing the suitable inputs. REQUIREMENT ANALYSIS STRUCTURE: The process of establishing the system to be developed and the constraints under which it must operate is called Requirements and capture an analysis.
SYSTEM ENGINEERING AND ANALYSIS: As software is always a part of a larger system, work begins by establishing requirements for all system elements and then allocating some subset of these requirements to software. In our project database management system, we mainly carried out this step by keeping in mind the
15
various things needed in a shop and understanding the need for such a system.
SOFTWARE REQUIREMENT ANALYSIS: The requirement gathering process is intensified and focused specifically on software. To understand the nature of the programs to be built, the software engineer must understand the information domain for software, as well as required functions, behavior, performance and interface. Here, I generated all the requirements of our system by calculating the needs of the software and then the output. FACT FINDING TECHNIQUES: In system analysis we have found number of fact finding techniques about the system, which is under study. These facts helped us to understand what the existing system is, the flow of the existing system and what the problems are in the existing system.
By observing the activities of the Retailer Shop, the system flow of the shop is examined. All the details of the shop process are given to the administrator. This report has to be maintained properly.
16
SYSTEM PLANNING
The planning of this system started way back in December 2012. I started with gathering all the basic requirements of the system, according to what the Shops requirements. We went down to the system design. After designing what the system layout would look like, we came to the creation of the database, following which we came down to the actual coding of the project. Later we tried various levels in the implementation and debugged the entire code. After coding, we provided the necessary security to the system. Then finally the system goes live.
17
When creating a software schedule, the planner begins with a set of tasks. Effort, duration and start date are then input for each task. In addition task may be assigned to specific individuals.
GANTT CHART
A Gantt chart is constructed with a horizontal axis representing the total time span of the project, broken down into increments (for example days, weeks months) and a vertical axis representing the tasks that make up the project. Horizontal bars are varying in lengths represents the sequences, timing and time span for the each task. This is graphically represented in the Gantt chart below: Dec-08 Requirement Gathering Planning Dec-20 Jan-8 Jan-20 Feb-28 March-28
18
Planned Time
Actual Time
E-R Diagram
all set of objects. An entity set of same type that share same properties or attributes. An entity is represented by a set of attributes.
E-R diagram is a relationship between two entity sets. E-R diagram can express the overall structure of a database E-R diagram consists of the following major components: logically.
19
information.
Relationships:
Relationships
illustrate
how
two
entities
share
of the entity. For example, an employee's social security number might be the employee's key attribute
Components of ER Diagram:Sr No. 1 Rectangle Represents entity set. 2 Ellipse Represents attribute. 3 Diamond Represents relationship. Shape Diagrams Description
Flow lines
20
Double ellipse
Dashed ellipse
Double rectangle
Double diamond
Line
Lines, which link attributes to entity set &entity setsto r relationship sets.
21
Customer:
22
Supplier: Employee:
Product:
Purchase:
Sales:
23
Purchase_product:
Sales_product:
24
ER-Diagram
25
UseCase Diagrams
A use case diagram is a set of scenarios that describing an interaction between user and system. A use case diagram displays the relationship among actors & use cases. The 2 main components of use case diagram are use case and actor.
Diagrams:-
Actor
Use case
An actor represents a user or another system will interact with the system that you are modeling. A use case is an external view of the system that represents some action that might perform in order to complete a task.
Admin subsystem :
When new employee turns for job, admin add his details. Admin update the existing employee record look up- employee details.
26
Admin delete the employee record as well as product record. Admin update the product record look-up-product details. Admin display the employee & product details.
Supplier subsystem:
When admin purchases products from a new supplier, then admin adds If an existing supplier has made changes in his contact details, then If a supplier no longer exist nor admin has purchased any products from
his details.
27
Employee subsystem:
Employee add new product record. When the customer place order,employee add his details. Employee display the customer & supplier record ,if required. If employee wants to check for the details of a supplier & customer as
Product subsystem:
28
not, Available the he place order & creates a new record of product.
Supplier full fills the order & generates the proper bill. Admin pay the bill.
29
CLASS DIAGRAM
Class diagram are widely used to describe the types of objects in a system and their relationships. Class. Class diagrams model, class structure and contents using design elements such as classes, packages and objects. Class diagram describes three different perspectives when designing. These perspectives become evident as the diagram is created and help solidity the design.
Name: It stores the name of class which is one of the components of the system.
Attribute: These are nothing but the member variables of a particular class that
Operations: There are nothing but the member functions for methods of class that is
Attributes list
Operations/Method list
31
Plus operator for public items + Minus o perator for private members Hash operator for protected items # Cardinality *..1,1..1,*..*
32
Class Diagram:
Context diagram
A static model that describes other systems in the environment. Use a subsystem model to show other systems.
33
A data flow diagram is graphical tool used to describe and analyze movement of data through a system. These are the central tool and the basis from which the other components are developed. The transformation of data from input to output, through processed, may be described logically and independently of physical components associated with the system. These are known as the logical data flow diagrams. The physical data flow diagrams show the actual implements and movement of data between people, departments and workstations. A full description of a system actually consists of a set of data flow diagrams. Using two familiar notations Yourdon, Gane and Sarson notation develops the data flow diagrams. Each component in a DFD is labeled with a descriptive name. Process is further identified with a number that will be used for identification purpose. The development of DFDs is done in several levels. Each process in lower level diagrams can be broken down into a more detailed DFD in the next level. The lop-level diagram is often called context diagram. It consists a single process bit, which plays vital role in studying the current system. The process in the context level diagram is exploded into other process at the first level DFD.
DFD SYMBOLS:
1. 2.
A square defines a source(originator) or destination of system data An arrow identifies data flow. It is the pipeline through which the
information flows
3.
A circle or a bubble represents a process that transforms incoming data An open rectangle is a data store, data at rest or a temporary repository of
data.
36
verify
Failure success
37
verify
Success Failure
SCREEN LAYOUT:
SplashScreen.cs
38
39
Login.cs:
40
Home.cs:
41
Customer.cs:
42
Search customer.cs:
43
Edit product.cs:
44
Purchase.cs:
45
Type supplier.cs:
46
PurchaseDetails.cs:
47
purchaseReportByDate.cs:
48
Bill.cs:
PROCESS INVOLVED
Software project management is all about turning basic technology concepts into workable solutions. It involves taking a simple concept or idea
49
and overseeing its development until the product is ready to launch as a fully functioning and workable system. There are some key duties that are involved in softwadevelopment process that are:
the project and gives project directors clear goals for each project stage.
Allocating resources :
Various resources such as software tools, equipment and staff are
50
Dates and deadlines are determined to meet the needs of the client but with realistic expectations of what is achievable within those time frames also considered.
software is meeting the needs of the client and keeps the client informed on project developments.
The final report is submitted or a release order is signed once work is completed. It ensures that all systems are operating effectively.
METHODOLOGY ADOPTED
51
We have adopted spiral methodology for developing this software. The spiral model is similar to the incremental model, with more emphases placed on risk analysis. The spiral model has four phases: Planning, Risk Analysis, Engineering and Evaluation. A software project repeatedly passes through these phases in iterations (called Spirals in this model). The baseline spiral, starting in the planning phase, requirements is gathered and risk is assessed. Each subsequent spiral builds on the baseline spiral. Requirements are gathered during the planning phase. In the risk analysis phase, a process is undertaken to identify risk and alternate solutions. A prototype is produced at the end of the risk analysis phase. Software is produced in the engineering phase, along with testing at the end of the phase. The evaluation phase allows the customer to evaluate the output of the project to date before the project continues to the next spiral. In the spiral model, the angular component represents progress, and the radius of the spiral represents cost.
52
ADVANTAGES:
High amount of risk analysis Good for large and mission-critical projects. Software is produced early in the software life cycle.
DISADVANTAGES:
Can be a costly model to use. Risk analysis requires highly specific expertise. Projects success is highly dependent on the risk analysis phase.
53
SYSTEM IMPLEMENTATION
Implementation means to take into practice. A crucial phase in the system life cycle is the successful implementation of the new system design. Implementation includes all those activities that take place to convert from the old system to the new one. The new system may be completely new, replacing an existing manual or automated system. The proposed system is completely new system i.e. the existing system is manual. The Main Aspects of Implementation are as follows: -
Training Personnel: Even well designed system can succeed or fail because of the way they are operated and used. Therefore the quality of training received by the person involved with the system in various capacities helps in successful implementation of Proposed System.
Conversion Procedure: Conversion is the process of changing from the old system to the new one. It must be properly planned and executed. Four methods are common in use, they are
54
Parallel System Direct Conversion Pilot System Systems Phase-in For the proposed system Parallel System will be beneficial. Under this
approach, users continue to operate the old system in usual manner but they will also start using the new system this method is safest one because it ensures that in case of any problems in using the new system, the organization can still fall back to the old system without loss of time and money.
Demonstration: After the system is implemented and conversion is complete, demonstration of the system is given to persons directly or indirectly related with the system.
55
management system (RDBMS) that offers a variety of administrative tools to ease the burdens of database development, maintenance and administration. In this article, we'll cover six of the more frequently used tools: Enterprise Manager, Query Analyzer, SQL Profiler, Service Manager, Data Transformation Services and Books Online. Let's take a brief look at each: Enterprise Manager is the main administrative console for SQL Server installations. It provides you with a graphical "birds-eye" view of all of the SQL Server installations on your network. You can perform high-level administrative functions that affect one or more servers, schedule common maintenance tasks or create and modify the structure of individual databases. Query Analyzer offers a quick and dirty method for performing queries
56
against any of your SQL Server databases. It's a great way to quickly pull information out of a database in response to a user request, test queries before implementing them in other applications, create/modify stored Procedures.
SQL Profiler provides a window into the inner workings of your database. You can monitor many different event types and observe database performance in real time. SQL Profiler allows you to capture and replay system "traces" that log various activities. It's a great tool for optimizing databases with performance issues or troubleshooting particular problems. Service Manager is used to control the SQLServer (the main SQL Server process), MSDTC (Microsoft Distributed Transaction Coordinator) and SQLServer Agent processes. An icon for this service normally resides in the system tray of machines running SQL Server. You can use Service Manager Procedure.
INTRODUCTION TO ROGRAMMING
LANGUAGE:
from Microsoft. It is used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed
57
code for all platforms supported by Microsoft Windows, Windows Mobile, Windows CE, .NET Framework, .NET Compact Framework and Microsoft Silverlight it can also develop windows presentation foundation(WPF) application.
Visual Studio includes a code editor supporting IntelliSense as well as code refactoring. The integrated debugger works both as a source-level debugger and a machine-level debugger. Other built-in tools include a forms designer for building GUI applications, web designer, class designer, and database schema designer. It accepts plug-ins that enhance the functionality at almost every levelincluding adding support for source-control systems (like Subversion and Visual SourceSafe) and adding new toolsets like editors and visual designers for domain-specific languages or toolsets for other aspects of the software development lifecycle . Visual Studio supports different programming languages by means of language services, which allow the code editor and debugger to support (to varying degrees) nearly any programming language, provided a languagespecific service exists. Built-in languages include C/C++[5] (via Visual C+ +), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio 2010[6]). Support for other languages such as M, Python, and Ruby among others is available via language services installed separately. It
58
also supports XML/XSLT, HTML/XHTML, JavaScript and CSS. Individual language-specific versions of Visual Studio also exist which provide more limited language services to the user: Microsoft Visual Basic, Visual J#, Visual C#, and Visual C++. Microsoft provides "Express" editions of its Visual Studio 2010 components Visual Basic, Visual C#, Visual C++, and Visual Web Developer at no cost. Visual Studio 2012, 2010, 2008 and 2005 Professional
Editions, along with language-specific versions (Visual Basic, C++, C#, J#) of Visual Studio Express 2010 are available for free to students as downloads via Microsoft's DreamSpark program.
Code editor
The Visual Studio code editor also supports setting bookmarks in code for quick navigation. Other navigational aids include collapsing code blocks and incremental search, in addition to normal text search and regex search. The code editor also includes a multi-item clipboard and a task list.
Debugger
Visual Studio includes a debugger that works both as a source-level debugger and as a machine-level debugger. It works with both managed
59
code as well as native code and can be used for debugging applications written in any language supported by Visual Studio. In addition, it can also attach to running processes and monitor and debug those processes . The Visual Studio debugger can also create memory dumps as well as load them
later for debugging. The debugger can be configured to be launched when an application running outside the Visual Studio environment crashes.
Extensibility
Visual Studio allows developers to write extensions for Visual Studio to extend its capabilities. These extensions "plug into" Visual Studio and extend its functionality. Extensions come in the form of macros, add-ins, and packages. Macros represent repeatable tasks and actions that developers can record programmatically for saving, replaying, and distributing. Packages are created using the Visual Studio SDK and provide the highest level of extensibility.
HARDWARE REQUIREMENTS:
Processor: Pentium 4 or more for optimum performance RAM: Recommended 256MB Hard Disk: Minimum 20GB
60
SOFTWARE REQUIREMENTS:
Operating System - Certified Distribution of WINDOWS Visual Studio 2008(.NET with c#) Database(Backend) - SQL Server 8
Correcting errors that were not discovered during the product Improving the implementation of the system and enhancing the
Functionality of the system according to the customers requirements. This is called Perfective maintenance.
61
EVALUATION:
Evaluation refers to a particular phase in the staged model where Substantial changes are made to the software. The proposals for change are the driver for system evaluation. Change identification and evaluation continues throughout the system lifetime. The process of evaluation is driven by requests for changes from different stakeholders. Software re-engineering is concerned with re-structuring and redocumenting software to make it easier to change. The business value of a system and its quality should determine the evaluation strategy that is used. The various goals of evaluation are: The evaluation adapts the application to the ever-changing user 2. The evaluation corrects the faults in the application. 3. Evaluation responds to both developer and user learning. The process in the evaluation depends on:
1.
62
1. 2. 3.
The type of the software being maintained. The development processes used. The skills and the experience of the people involved.
63
A cost benefit analysis finds, quantifies, and adds all the positive factors. These are the benefits. Then it identifies, quantifies, and subtracts all the negatives, the costs. Cost-benefit analysis compares the expected financial gain derived from a particular set of actions with the expected cost of providing each
action to determine the most profitable option. The projected benefits of a plan or program are divided by its estimated total long-term cost. Cost-benefit analysis can break a multifaceted scenario down into discrete factors and then assist personnel in quantifying those factors and comparing their relative significance in numerical terms. Cost-benefit analysis is a term that refers both to: - a formal discipline used to help appraise, or assess, the case for a project or proposal, which itself is a process known as project appraisal; and - an informal approach to making decisions of any kind. PRINCIPLES OF THE COST-BENEFIT ANALYSIS:
There Must Be a Common Unit of Measurement. CBA Valuations Should Represent Consumers or Producers Valuations Benefits Are Usually Measured by Market Choices Gross Benefits of an Increase in Consumption is an Area under the
Demand
64
Curve
Some Measurements of Benefits Require the Valuation of Human Life The Analysis of a Project Should Involve a With Versus Without
Comparison
Cost Benefit Analysis Involves a Particular Study Area Double Counting of Benefits or Costs Must be avoided Decision Criteria for Projects
produced. It was also used to check that the integrity of the external information is maintained.
If the user initially executes the software , the system should respond by
After the login is successful , the system should show the main menu The details of the employees, supplier, and customers are displayed when
During deletion of any entry its information should be deleted from all
displayed.
UNIT TESTING:
66
The Unit Testing focuses verification effort on the smallest unit of software design- the software component or the module. All the interface modules were checked to see whether information flows in and out as desired .The relations in the database are examined to ensure that data stored maintains its integrity during all steps in an algorithms execution.
INTEGRATION TESTING:
Integration Testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. For Integration Testing the Top-Down method
was used. Beginning with the main control module (main menu) modules (user interface forms) is integrated by moving downward through the control
hierarchy.
The
Top-Down
Integration
Testing
method
allowed
verification of decision points early in the test process. The decision making occurs at upper-level and hence made it possible for early recognition of major control problems.
VALIDATION TESTING:
67
The Validation Testing is used to check if the software functions in a manner that is expected by the user. However a reasonable amount of beta testing was done by making some people use the software and their feedback were taken into account. Thus beta testing helped to uncover those problems which could only be found out by the end-users. Software Testing is the process of executing a program or system with the intent of finding errors. Or, it involves any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results. Software is not unlike other physical processes where inputs are received and outputs are produced. Where software differs is in the manner in which it fails. Most physical systems fail in a fixed (and reasonably small) set of ways. By contrast, software can fail in many bizarre ways. Detecting all of the different failure modes for software is generally infeasible.
Typically, more than 50% percent of the development time is spent in testing. Testing is usually performed for the following purposes:
To improve quality.
68
As
computers
and
software
are
used
in
critical
applications, the outcome of a bug can be severe. Bugs can cause huge losses. Bugs in critical systems have caused airplane crashes, allowed space shuttle missions to go awry, halted trading on the stock market, and worse. Bugs can kill. Bugs can cause disasters. The so-called year 2000 (Y2K) bug has given birth to a cottage industry of consultants and programming tools dedicated to making sure the modern world doesn't come to a screeching halt on the first day of the next century. In a computerized embedded world, the quality and reliability of software is a matter of life and death. Quality means the conformance to the specified design requirement. Being correct, the minimum requirement of quality, means performing as required under specified circumstances. Debugging, a narrow view of software testing, is performed heavily to find out design defects by the programmer. The imperfection of human nature makes it almost impossible to make a moderately complex program correct the first time. Finding the problems and get them fixed ,is the purpose of debugging in programming phase.
69
Another important purpose of testing is verification and validation (V&V). Testing can serve as metrics. It is heavily used as a tool in the V&V process. Testers can make claims based on interpretations of the testing results, which either the product works under certain situations, or it does not work. We can also compare the quality among different products under the same specification, based on results from the same test. We cannot test quality directly, but we can test related factors to make quality visible. Quality has three sets of factors -functionality, engineering, and adaptability. These three sets of factors can be thought of as dimensions in the software quality space. Each dimension may be broken down into its component factors and considerations at successively lower levels of detail.
70
TESTREPORT
Editcustomer.cs
71
Searchsupplier.cs:
72
Editsupplier.cs:
73
Editproduct.cs:
REPORTS
74
purchaseReport.cs:
75
SalesReport.cs:
billReport.cs:
76
77
CODING
Login.cs
public partial class login : Form { public static String type; SqlCommand cmd; DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); SqlDataReader dr; public login() { Thread t = new Thread(new ThreadStart(splashscreen)); t.Start(); Thread.Sleep(5000); InitializeComponent(); t.Abort(); } private void button1_Click(object sender, EventArgs e) { try
78
{ con.Open(); cmd = new SqlCommand("select * from login where username='" + textBox1.Text + "'AND password='" + textBox2.Text + "'AND type='"+comboBox1.Text+"'", con); dr = cmd.ExecuteReader(); if (dr.Read()) { type = dr.GetString(4); Home h = new Home(); h.ShowDialog(); textBox1.Text = ""; textBox2.Text = ""; comboBox1.Text = ""; } else { MessageBox.Show("Invalid Username Or Password"); } } catch (Exception E) {
79
MessageBox.Show(E.Message); } con.Close(); }
private void button2_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; comboBox1.Items.Clear() ; }
Customer.cs
public partial class customer : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Security=True"); SqlCommand cmd; DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter();
80
Catalog=retailerdb;Integrated
private void button11_Click(object sender, EventArgs e) { try { Regex reg1 = new Regex(@"^[a-zA-Z1-9]+$"); Match m1 = reg1.Match(textBox1.Text); if (!(m1.Success)) { errorProvider1.SetError(textBox1, "Enter the correct id"); textBox1.Focus(); MessageBox.Show("Enter the correct id"); } else { Regex reg2 = new Regex(@"^[a-zA-Z ]+$"); Match m2 = reg2.Match(textBox2.Text); if (!(m2.Success)) { errorProvider1.SetError(textBox2, "Please Enter Ur name");
81
textBox2.Focus(); MessageBox.Show("Please Enter Ur name!"); } else { Regex reg3 = new Regex(@"^[a-zA-Z0-9 ,.()\n]+$"); Match m3 = reg3.Match(richTextBox1.Text); if (!(m3.Success)) { errorProvider1.SetError(richTextBox1, "Please Enter Address"); richTextBox1.Focus(); MessageBox.Show("Please Enter Address!"); } else { Regex reg4 = new Regex(@"^[_a-z0-9-]+(\.[_a-z0-9-] +)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"); Match m4 = reg4.Match(textBox4.Text); if (!(m4.Success)) { errorProvider1.SetError(textBox4, "Enter the correct email id");
82
textBox4.Focus(); MessageBox.Show("Enter the correct email id"); } else { Regex reg5 = new Regex(@"^\b\d\d\d\d\d\d\d\d\d\d$"); Match m5 = reg5.Match(textBox5.Text); if (!(m5.Success)) { errorProvider1.SetError(textBox5, "Enter the correct 10 digit number"); textBox5.Focus(); MessageBox.Show("Enter the correct 10 digit number"); } else { con.Close(); con.Open(); String path = textBox3.Text; byte[] c_image2 = ReadFile2(path);//read image bytes into byte array
83
cmd = new SqlCommand("insert into customer values(@c_id,@c_name,@c_add,@c_email,@c_no,@c_image,@path)", con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@c_id", textBox1.Text); cmd.Parameters.AddWithValue("@c_name", textBox2.Text); cmd.Parameters.AddWithValue("@c_add", richTextBox1.Text); cmd.Parameters.AddWithValue("@c_email", textBox4.Text); cmd.Parameters.AddWithValue("@c_no", textBox5.Text); cmd.Parameters.AddWithValue("@c_image", (object)c_image2); cmd.Parameters.AddWithValue("@path", path); cmd.ExecuteNonQuery(); MessageBox.Show("Data Inserted Successfully"); textBox2.Clear(); richTextBox1.Clear(); textBox4.Clear();
84
textBox5.Clear(); AutoIncrementID(); } }
} } }
con.Close(); }
85
private void customer_Load(object sender, EventArgs e) { con.Close(); AutoIncrementID(); textBox3.Text "D:\\RetailerShop(recent).old\\splashscreen\\Resources\\User-blueicon.png"; pictureBox1.Enabled = false; button10.Enabled = false; } private byte[] ReadFile2(string p)//open file into a filestream and read data in byte array { byte[] data = null;//intialize byte array with null value FileInfo f = new FileInfo(p);//get file size long num = f.Length; FileStream fs = new FileStream(p, FileMode.Open, FileAccess.Read);//read file BinaryReader br = new BinaryReader(fs);//read filestream into byte array data = br.ReadBytes((int)num);//read entire file so supply total no of bytes return data; } =
86
private void button12_Click(object sender, EventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Image File(*.jpg; *.jpeg; *.gif; *.bmp; *.png| *.jpg; *.jpeg; *.gif; *.bmp; *.png"; if (ofd.ShowDialog() == DialogResult.OK) { pictureBox1.Image = new Bitmap(ofd.FileName); textBox3.Text = ofd.FileName; }
87
public void AutoIncrementID() { try { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand("Select Max(cust_id) from customer", con); SqlDataReader dr = null; dr = cmd.ExecuteReader(); if (dr.Read()) { string s = dr[0].ToString(); if (s != "") { string[] ss = s.Split('C'); int r = Convert.ToInt32(ss[1]); textBox1.Text = "C" + (r + 1).ToString();
88
con.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { con.Close(); } } private void textBox1_TextChanged(object sender, EventArgs e) { errorProvider1.Clear(); }
89
private void textBox2_TextChanged(object sender, EventArgs e) { errorProvider1.Clear(); } private void textBox4_TextChanged(object sender, EventArgs e) { errorProvider1.Clear(); } private void textBox5_TextChanged(object sender, EventArgs e) { errorProvider1.Clear(); } private void button2_Click(object sender, EventArgs e) { try { con.Close(); con.Open(); DialogResult dr; dr=MessageBox.Show("Once Record is Deleted there is no Undo\n Do you want to Continue??","Confirm Deletion",MessageBoxButtons.YesNo);
90
if (dr == DialogResult.Yes) { da.DeleteCommand = new SqlCommand("delete from customer where cust_id=@custid", con); da.DeleteCommand.Parameters.Add("@custid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0]; da.DeleteCommand.ExecuteNonQuery(); ds.Clear(); da.Fill(ds); } else { MessageBox.Show("Deletion Canceled"); } con.Close(); } catch (Exception E) { MessageBox.Show(E.Message); } con.Close(); }
91
private void button9_Click(object sender, EventArgs e) { try { Regex reg1 = new Regex(@"^[a-zA-Z1-9]+$"); Match m1 = reg1.Match(textBox1.Text); if (!(m1.Success)) { errorProvider1.SetError(textBox1, "Enter the correct id"); textBox1.Focus(); MessageBox.Show("Enter the correct id"); } else { Regex reg2 = new Regex(@"^[a-zA-Z ]+$"); Match m2 = reg2.Match(textBox2.Text); if (!(m2.Success)) { errorProvider1.SetError(textBox2, "Please Enter Ur name"); textBox2.Focus(); MessageBox.Show("Please Enter Ur name!"); } else
92
{ Regex reg3 = new Regex(@"^[a-zA-Z1-9 ,]+$"); Match m3 = reg3.Match(richTextBox1.Text); if (!(m3.Success)) { errorProvider1.SetError(richTextBox1, "Please Enter Address"); richTextBox1.Focus(); MessageBox.Show("Please Enter Address!"); }
else { Regex reg4 = new Regex(@"^[_a-z0-9-]+(\.[_a-z0-9-] +)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"); Match m4 = reg4.Match(textBox4.Text); if (!(m4.Success)) { errorProvider1.SetError(textBox4, "Enter the correct email id"); textBox4.Focus(); MessageBox.Show("Enter the correct email id"); }
93
else { Regex reg5 = new Regex(@"^\b\d\d\d\d\d\d\d\d\d\d$"); Match m5 = reg5.Match(textBox5.Text); if (!(m5.Success)) { errorProvider1.SetError(textBox5, "Enter the correct 10 digit number"); textBox5.Focus(); MessageBox.Show("Enter the correct 10 digit number"); } else { con.Close(); con.Open(); String path = textBox3.Text; byte[] c_image1 = ReadFile1(textBox3.Text); da.UpdateCommand = new SqlCommand("update customer t_contact=@custcontact,c_image=@cimage,path=@path cust_id=@custid", con); set where cust_name=@custname,cust_add=@custadd,cust_email=@custemail,cus
94
da.UpdateCommand.Parameters.Add("@custname ", SqlDbType.VarChar).Value = textBox2.Text; da.UpdateCommand.Parameters.Add("@custadd", SqlDbType.VarChar).Value = richTextBox1.Text; da.UpdateCommand.Parameters.Add("@custemail ", SqlDbType.VarChar).Value = textBox4.Text; da.UpdateCommand.Parameters.Add("@custconta ct", SqlDbType.VarChar).Value = textBox5.Text; da.UpdateCommand.Parameters.Add("@cimage", SqlDbType.Image).Value = (Object)c_image1; da.UpdateCommand.Parameters.Add("@path", SqlDbType.NVarChar).Value = textBox3.Text; da.UpdateCommand.Parameters.Add("@custid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0]; da.UpdateCommand.ExecuteNonQuery(); ds.Clear(); da.Fill(ds);
button9.Visible = false; textBox2.ReadOnly = true; richTextBox1.ReadOnly = true; textBox4.ReadOnly = true; textBox5.ReadOnly = true;
95
button1.Visible = true; button2.Visible = true; button3.Visible = true; label3.Visible = false; pictureBox1.Enabled = false; button10.Enabled = false; button11.Visible = true; con.Close(); } } } } } } catch (Exception E) { MessageBox.Show(E.Message); } } private void button3_Click(object sender, EventArgs e) { button9.Visible = true;
96
textBox2.ReadOnly = false; richTextBox1.ReadOnly = false; textBox4.ReadOnly = false; textBox5.ReadOnly = false; button1.Visible = false; button2.Visible = false; label3.Visible = true; pictureBox1.Enabled = true; button10.Enabled = true; button11.Visible = false; button3.Visible = false; } private void button4_Click(object sender, EventArgs e) { bs.MoveFirst(); dgupdate(); con.Close(); con.Open(); String query = "select * from customer where cust_id='" + textBox1.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); String path = dr.GetString(6);
97
pictureBox1.ImageLocation = path; con.Close(); } private void dgupdate() { dataGridView1.ClearSelection(); dataGridView1.Rows[bs.Position].Selected = true; } private void button1_Click(object sender, EventArgs e) { button2.Enabled = true; button3.Enabled = true; groupBox2.Enabled = true; button9.Visible = false; textBox2.ReadOnly = true; richTextBox1.ReadOnly = true; textBox4.ReadOnly = true; textBox5.ReadOnly = true; button1.Visible = true; button2.Visible = true; button3.Visible = true; label3.Visible = false; pictureBox1.Enabled = false; button10.Enabled = false;
98
button11.Enabled = false; try { con.Close(); con.Open(); da.SelectCommand = new SqlCommand("SELECT cust_id,cust_name,cust_add,cust_email,cust_contact FROM customer", con); ds.Clear(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; bs.DataSource = ds.Tables[0]; textBox1.DataBindings.Add(new Binding("Text", bs, "cust_id")); textBox2.DataBindings.Add(new Binding("Text", bs, "cust_name")); richTextBox1.DataBindings.Add(new Binding("Text", bs, "cust_add")); textBox4.DataBindings.Add(new Binding("Text", bs, "cust_email"));
99
textBox5.DataBindings.Add(new Binding("Text", bs, "cust_contact")); textBox3.DataBindings.Add(new Binding("text", bs, "path")); String query = "select * from customer where cust_id='" + textBox1.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); String path = dr.GetString(6); pictureBox1.ImageLocation = path; con.Close(); } catch (Exception E) {
100
con.Close(); con.Open(); String query = "select * from customer where cust_id='" + textBox1.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); String path = dr.GetString(6); pictureBox1.ImageLocation = path; con.Close(); } private void button5_Click(object sender, EventArgs e) { bs.MovePrevious(); dgupdate(); con.Close(); con.Open(); String query = "select * from customer where cust_id='" + textBox1.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); String path = dr.GetString(6);
101
pictureBox1.ImageLocation = path; con.Close(); } private void button7_Click(object sender, EventArgs e) { bs.MoveLast(); dgupdate(); con.Close(); con.Open(); String query = "select * from customer where cust_id='" + textBox1.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); String path = dr.GetString(6); pictureBox1.ImageLocation = path; con.Close(); }
SearchCustomer.cs
public partial class custbyid : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Catalog=retailerdb;Integrated Security=True");
102
DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); BindingSource bs = new BindingSource(); SqlCommand cmd = new SqlCommand(); SqlDataReader dr; private void button1_Click(object sender, EventArgs e) { try { Regex reg1 = new Regex(@"^[a-zA-Z1-9]+$"); Match m1 = reg1.Match(textBox1.Text); if (!(m1.Success)) { errorProvider1.SetError(textBox1, "Enter the correct id"); textBox1.Focus(); MessageBox.Show("Enter the correct id"); } else { con.Open();
103
da.SelectCommand = new SqlCommand("SELECT * FROM customer where cust_id=@custid", con); da.SelectCommand.Parameters.Add("@custid", SqlDbType.VarChar).Value = textBox1.Text; ds.Clear(); da.Fill(ds); cmd = new SqlCommand("SELECT * FROM customer where cust_id='" + textBox1.Text + "'", con); dr = cmd.ExecuteReader(); if (dr.Read()) { dataGridView1.DataSource = ds.Tables[0]; } else { MessageBox.Show("record not found"); } } } catch (Exception E) { MessageBox.Show(""+E);
104
} con.Close(); } private void button2_Click_2(object sender, EventArgs e) { try { Regex reg2 = new Regex(@"^[a-zA-Z]+$"); Match m2 = reg2.Match(textBox7.Text); if (!(m2.Success)) { errorProvider1.SetError(textBox7, "Please Enter Ur name"); textBox7.Focus(); MessageBox.Show("Please Enter Ur name!"); } else { con.Open(); da.SelectCommand = new SqlCommand("SELECT * FROM customer where cust_name =@custname", con); da.SelectCommand.Parameters.Add("@custname", SqlDbType.VarChar).Value = textBox7.Text; ds.Clear();
105
da.Fill(ds); cmd = new SqlCommand("SELECT * FROM customer where cust_name='" + textBox7.Text + "'", con); dr = cmd.ExecuteReader(); if (dr.Read()) { dataGridView1.DataSource = ds.Tables[0]; } else { MessageBox.Show("record not found"); } } } catch (Exception E) { MessageBox.Show("" + E); } con.Close(); } private void textBox1_TextChanged(object sender, EventArgs e) { errorProvider1.Clear();
106
EditProduct.cs
public partial class editproduct : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Catalog=retailerdb;Integrated Security=True"); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); BindingSource bs = new BindingSource(); public editproduct() { InitializeComponent(); } private void button6_Click(object sender, EventArgs e)
107
{ button7.Enabled = true; button8.Enabled = true; groupBox3.Enabled = true; try { con.Open(); da.SelectCommand = new SqlCommand("SELECT * FROM Product", con); ds.Clear(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; bs.DataSource = ds.Tables[0]; textBox1.DataBindings.Add(new Binding("Text", bs, "Product_id")); textBox2.DataBindings.Add(new Binding("Text", bs, "supp_id")); textBox5.DataBindings.Add(new Binding("Text", bs, "Product_name")); textBox6.DataBindings.Add(new Binding("Text", bs, "Product_size")); textBox3.DataBindings.Add(new Binding("Text", bs, "Product_quantity")); textBox4.DataBindings.Add(new Binding("Text", bs, "Unit_price"));
108
catch (Exception E) { } } private void button7_Click(object sender, EventArgs e) { try { DialogResult dr; dr = MessageBox.Show("Once Record is Deleted there is no Undo\n Do you want to Continue??", "Confirm Deletion", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { da.DeleteCommand = new SqlCommand("delete from Product where Product_id=@pid", con); da.DeleteCommand.Parameters.Add("@pid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0]; da.DeleteCommand.ExecuteNonQuery(); ds.Clear(); da.Fill(ds); } else
109
{ MessageBox.Show("Deletion Canceled"); } } catch (Exception E) { MessageBox.Show(E.Message); } } private void button8_Click(object sender, EventArgs e) { button5.Visible = true; textBox1.ReadOnly = false; textBox2.ReadOnly = false; textBox5.ReadOnly = false;
110
textBox6.ReadOnly = false; textBox3.ReadOnly = false; textBox4.ReadOnly = false; button6.Visible = false; button7.Visible = false; button8.Visible = false; label8.Visible = true; } private void button5_Click(object sender, EventArgs e) { try { Regex reg1 = new Regex(@"^[a-zA-Z1-9]+$"); Match m1 = reg1.Match(textBox1.Text); if (!(m1.Success)) { errorProvider1.SetError(textBox1, "Enter the correct id"); textBox1.Focus(); MessageBox.Show("Enter the correct id"); }
111
else { Regex reg2 = new Regex(@"^[a-zA-Z1-9]+$"); Match m2 = reg2.Match(textBox2.Text); if (!(m2.Success)) { errorProvider1.SetError(textBox2, "Enter the correct id"); textBox2.Focus(); MessageBox.Show("Enter the correct id"); }
else { Regex reg3 = new Regex(@"^[0-9]+$"); Match m3 = reg3.Match(textBox3.Text); if (!(m3.Success)) { errorProvider1.SetError(textBox3, "Enter the numeric value"); textBox3.Focus(); MessageBox.Show("Enter the numeric value"); } else { Regex reg4 = new Regex(@"^[0-9]+$");
112
Match m4 = reg4.Match(textBox4.Text); if (!(m4.Success)) { errorProvider1.SetError(textBox4, "Enter the numeric value"); textBox4.Focus(); MessageBox.Show("Enter the numeric value"); } else { if (textBox3.Text == "0") { MessageBox.Show("please enter the valid value"); } else { if (textBox4.Text == "0") { MessageBox.Show("please enter the valid value"); } else { da.UpdateCommand = new SqlCommand("update Product ity=@Productquantity,Unit_price=@prdprice where Product_id=@prdid", con); set supp_id=@suppid,Product_name=@prdnm,Product_size=@prdsize,Product_quant
113
da.UpdateCommand.Parameters.Add("@prdnm", SqlDbType.VarChar).Value = textBox5.Text; da.UpdateCommand.Parameters.Add("@prdsize", SqlDbType.VarChar).Value = textBox6.Text; da.UpdateCommand.Parameters.Add("@Productquantity" , SqlDbType.Int).Value = textBox3.Text; da.UpdateCommand.Parameters.Add("@prdprice", SqlDbType.Int).Value = textBox4.Text; da.UpdateCommand.Parameters.Add("@prdid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0];
da.UpdateCommand.ExecuteNonQuery(); label8.Visible = false; button5.Visible = false; textBox1.ReadOnly = true; textBox2.ReadOnly = true; textBox5.ReadOnly = true; textBox6.ReadOnly = true;
114
textBox3.ReadOnly = true; textBox4.ReadOnly = true; button6.Visible = true; button7.Visible = true; button8.Visible = true; } } } } } } } catch (Exception E) {} } private void button1_Click(object sender, EventArgs e) { bs.MoveFirst(); dgupdate(); } private void dgupdate() {
115
private void button2_Click(object sender, EventArgs e) { bs.MovePrevious(); dgupdate(); } private void button3_Click(object sender, EventArgs e) { bs.MoveNext(); dgupdate(); } private void button4_Click(object sender, EventArgs e) { bs.MoveLast(); dgupdate(); } private void button9_Click(object sender, EventArgs e)
116
{ this.Close(); } private void label8_Click(object sender, EventArgs e) { } private DataGridViewCellEventArgs e) { MessageBox.Show("Please Select the Buttons given Below\n select the information"); } private void editproduct_Load(object sender, EventArgs e) { } } } to void dataGridView1_CellClick(object sender,
117
Purchase.cs
public partial class Purchase : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Catalog=retailerdb;Integrated Security=True"); SqlCommand cmd; SqlDataReader dr; SqlDataAdapter da = new SqlDataAdapter(); public Purchase() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) {
118
} private void button6_Click(object sender, EventArgs e) { Application.Exit(); } private void button5_Click(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } private void button1_Click(object sender, EventArgs e) { try { if (textBox4.Text == "0")
119
{ MessageBox.Show("please enter the valid value"); } else { if (textBox5.Text == "0") { MessageBox.Show("please enter the valid value"); } else { con.Open(); int i = Convert.ToInt32(textBox4.Text); cmd = new SqlCommand("select * from Product where Product_id='" + textBox3.Text + "'", con); dr = cmd.ExecuteReader(); if (dr.Read()) { con.Close(); con.Open(); da.UpdateCommand = new SqlCommand("update Product set Product_quantity=Product_quantity+" + i + "where Product_id=@Productid", con);
120
cmd = new SqlCommand("insert into Purchase values(@p_id,@s_id,@p_date)", con); cmd.Parameters.AddWithValue("@p_id", textBox1.Text); cmd.Parameters.AddWithValue("@s_id", textBox2.Text); cmd.Parameters.AddWithValue("@p_date", dateTimePicker1.Value); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into Purchase_Product values(@p_id,@prod_id,@p_qty,@p_price)", con); cmd.Parameters.AddWithValue("@p_id", textBox1.Text); cmd.Parameters.AddWithValue("@prod_id", textBox3.Text); cmd.Parameters.AddWithValue("@p_qty", textBox4.Text);
121
catch (Exception E) { MessageBox.Show(E.Message); } con.Close(); } private void groupBox1_Enter(object sender, EventArgs e) { } private void button5_Click_1(object sender, EventArgs e) { this.Close();
122
} } }
PurchaseDetail.cs
public partial class purchasedetail : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Catalog=retailerdb;Integrated Security=True"); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); BindingSource bs = new BindingSource(); public purchasedetail() { InitializeComponent(); if (login.type == "Employee") { button2.Visible = false; } }
123
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void button5_Click(object sender, EventArgs e) { Application.Exit(); } private void button4_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { try { con.Open(); da.SelectCommand = new SqlCommand("select Purchase_Product.p_id,Purchase.supp_id,Purchase_Product.Product_id,Purchase_
124
from
textBox1.DataBindings.Add(new Binding("Text", bs, "Product_id")); } catch (Exception E) { MessageBox.Show(E.Message); } } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) {
DialogResult dr;
125
dr = MessageBox.Show("Are You Sure Want To Delete Record ", "confirm deletion", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { da.DeleteCommand = new SqlCommand("delete from Purchase_Product where p_id=@pid", con); da.DeleteCommand.Parameters.Add("@pid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0]; da.DeleteCommand.ExecuteNonQuery();
da.DeleteCommand = new SqlCommand("delete from Purchase where p_id=@pid", con); da.DeleteCommand.Parameters.Add("@pid", SqlDbType.VarChar).Value = ds.Tables[0].Rows[bs.Position][0]; da.DeleteCommand.ExecuteNonQuery(); ds.Clear(); da.Fill(ds); } else { MessageBox.Show("Deletion Canceled"); } }
126
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { } private void button4_Click_1(object sender, EventArgs e) { bs.MoveFirst(); dgupdate(); }
private void button5_Click_1(object sender, EventArgs e) { bs.MovePrevious(); dgupdate(); } private void button6_Click(object sender, EventArgs e) { bs.MoveNext(); dgupdate();
127
} private void button7_Click(object sender, EventArgs e) { bs.MoveLast(); dgupdate(); } private void dgupdate() { dataGridView1.ClearSelection(); dataGridView1.Rows[bs.Position].Selected = true; }
private void button8_Click(object sender, EventArgs e) { purchasereport pr = new purchasereport(); pr.ShowDialog(); } private void groupBox1_Enter(object sender, EventArgs e) { } }
128
Billform.cs:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Deployment.Application; using System.Diagnostics; namespace splashscreen { public partial class biilform : Form { SqlConnection con = new SqlConnection("Data Source=RAJYADAV\\RAJYADAV;Initial Catalog=retailerdb;Integrated Security=True"); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter();
129
BindingSource bs = new BindingSource(); SqlDataReader dr; SqlCommand cmd = new SqlCommand(); public biilform() { InitializeComponent(); } private void biilform_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { try { con.Open(); cmd = new SqlCommand("insert into bill values(@bid,@pname,@psize,@price)", con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@bid", textBox1.Text); cmd.Parameters.AddWithValue("@pname", comboBox1.Text); cmd.Parameters.AddWithValue("@psize", comboBox2.Text);
130
cmd.Parameters.AddWithValue("@price", comboBox3.Text); cmd.ExecuteNonQuery(); MessageBox.Show("data inserted successfully"); da.SelectCommand = new SqlCommand("SELECT prod_name,prod_size,u_price FROM Bill where bill_no=@billno", con); da.SelectCommand.Parameters.Add("@billno", SqlDbType.VarChar).Value = textBox1.Text; ds.Clear(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; con.Close(); } catch (Exception E) { MessageBox.Show(E.Message); } } private void comboBox1_SelectedValueChanged(object sender, EventArgs e) { if (comboBox1.SelectedItem == "Cement") { comboBox2.Items.Clear(); object o1 = new object();
131
o1 = "ambuja 50 kg"; object o2 = new object(); o2 = "birla 50 kg"; object o3 = new object(); o3 = "ACC 50 kg"; object o4 = new object(); o4 = "Altratech 50 kg"; object o5 = new object(); o5 = "Binani 50 kg"; object o6 = new object(); o6 = "ambuja 100 kg"; object o7 = new object(); o7 = "birla 100 kg"; object o8 = new object(); o8 = "ACC 100 kg"; object o9 = new object(); o9 = "Altratech 100 kg"; object o10 = new object(); o10 = "Binani 100 kg"; comboBox2.Items.Add(o1); comboBox2.Items.Add(o2); comboBox2.Items.Add(o3); comboBox2.Items.Add(o4); comboBox2.Items.Add(o5);
132
comboBox2.Items.Add(o6); comboBox2.Items.Add(o7); comboBox2.Items.Add(o8); comboBox2.Items.Add(o9); comboBox2.Items.Add(o10); } if (comboBox1.SelectedItem == "Tor Steel") { comboBox2.Items.Clear(); object o1 = new object(); o1 = "8.00 mmq"; object o2 = new object(); o2 = "10.00 mmq"; object o3 = new object(); o3 = "12.00 mmq"; object o4 = new object(); o4 = "16.00 mmq"; comboBox2.Items.Add(o1); comboBox2.Items.Add(o2); comboBox2.Items.Add(o3); comboBox2.Items.Add(o4); } if (comboBox1.SelectedItem == "Plastic") { comboBox2.Items.Clear();
133
object o1 = new object(); o1 = "m.s. pipe 1/2"; object o2 = new object(); o2 = "m.s. pipe 1"; object o3 = new object(); o3 = "m.s. pipe 1+1/2"; object o4 = new object(); o4 = "m.s. pipe 2"; comboBox2.Items.Add(o1); comboBox2.Items.Add(o2); comboBox2.Items.Add(o3); comboBox2.Items.Add(o4); } if (comboBox1.SelectedItem == "Flooring Tiles") { comboBox2.Items.Clear(); object o1 = new object(); o1 = "2''x 2''"; object o2 = new object(); o2 = "12''x 8''"; object o3 = new object(); o3 = "12''x 12''"; object o4 = new object(); o4 = "16''x 16''";
134
object o5 = new object(); o5 = "18''x 10''"; comboBox2.Items.Add(o1); comboBox2.Items.Add(o2); comboBox2.Items.Add(o3); comboBox2.Items.Add(o4); comboBox2.Items.Add(o5); } if (comboBox1.SelectedItem == "Plumbing Pipes") { comboBox2.Items.Clear(); object o1 = new object(); o1 = "1/2''"; object o2 = new object(); o2 = "3/4''"; object o3 = new object(); o3 = "1''"; object o4 = new object(); o4 = "1+1/2''"; object o5 = new object(); o5 = "2''"; comboBox2.Items.Add(o1); comboBox2.Items.Add(o2); comboBox2.Items.Add(o3);
135
comboBox2.Items.Add(o4); comboBox2.Items.Add(o5); } } private void button3_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) {
136
Microsoft.Office.Interop.Excel._Worksheet worksheet = null; // see the excel sheet behind the program app.Visible = true;
// get the reference of first sheet. By default its name is Sheet1. // store its reference to worksheet worksheet = workbook.Sheets["Sheet1"]; worksheet = workbook.ActiveSheet; // changing the name of active sheet worksheet.Name = "Exported from gridview";
// storing Each row and column value to excel sheet for (int i=0; i < dataGridView1.Rows.Count-1 ; i++)
137
{ for(int j=0;j<dataGridView1.Columns.Count;j++) { worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString(); } } } private void button3_Click_1(object sender, EventArgs e) { comboBox1.Items.Clear(); comboBox2.Items.Clear(); } } }
Data Dictionary
It describes the entity relation diagram in the table format. It also describes the data types and the constrains applied on the attributes.
Customer:
Column Name cust_id Cust_name Cust_add Cust_email Cust_contact C_image path Data Type Varchar(50) Varchar(50) Varchar(50) Varchar(50) Varchar(50) Image nvarchar(max) Constrains Not null Not null Not null Not null Not null Allow null Allow null
Supplier:
Column Name Supp_id Supp_name Supp_add Supp_email Supp_contact Supp_image path Data Type Varchar(50) Varchar(50) Varchar(50) Varchar(50) Varchar(50) Image nvarchar(max) Constrains Not null Not null Not null Not null Not null Allow null Allow null
Employee:
Column Name Emp_id Emp_name
139
Not null Not null Not null Not null Not null Allow null Allow null
Login:
Column Name Firstname Lastname Username Password Type Security_question Answer Data Type Varchar(50) Varchar(50) Varchar(50) Varchar(50) Varchar(50) Varchar(50) Varchar(50) Constrains Not null Not null Not null Not null Not null Not null Not null
Product :
Column Name Product_id Supp_id
140
Purchase:
Column Name P_id Supp_id P_Date Data Type Varchar(50) Varchar(50) datetime Constrains Not null Not null Not null
Purchase_Product:
Column Name P_id Product_id P_qty P_price Data Type Varchar(50) Varchar(50) Int Float Constrains Not null Not null Not null Not null
Sales:
141
Sales_Product:
Column Name Order_id Product_id S_qty S_price Data Type Varchar(50) Varchar(50) int Float Constrains Not null Not null Not null Not null
ACKNOWLEDGEMENT
142
It gives me great pleasure in presenting this project report. Its justification will never sound good if I do not express my vote of thanks to our C.H.M. College and respective Principal. I would also like to thank our H.O.D Mr. AJI THOMAS sir for his timely Support in this completion of this project. I thank our internal project guide Mrs. PREETI BASANTANI madam who has help us a lot to keep this project work systematically and to be submit it on schedule. I am thankful for their valuable guidance at every stage of the project. Finally, I would thank to all others, who give there extended support to complete this project.
BIBLOGRAPHY
143
Websites:1)
2)
3)
144